@woosh/meep-engine 3.61.3 → 3.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/package.json +1 -1
  2. package/src/engine/graphics3/PickingSystem.d.ts.map +1 -1
  3. package/src/engine/graphics3/PickingSystem.js +415 -413
  4. package/src/engine/graphics3/decal/GPUDecalRenderer.d.ts.map +1 -1
  5. package/src/engine/graphics3/decal/GPUDecalRenderer.js +2 -1
  6. package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
  7. package/src/engine/graphics3/decal/shader_decal_composite.js +26 -16
  8. package/src/engine/graphics3/decal/shader_decal_tile_copy.d.ts.map +1 -1
  9. package/src/engine/graphics3/decal/shader_decal_tile_copy.js +6 -11
  10. package/src/engine/graphics3/highlight/GPUHighlightRenderer.d.ts.map +1 -1
  11. package/src/engine/graphics3/highlight/GPUHighlightRenderer.js +6 -2
  12. package/src/engine/graphics3/highlight/shader_highlight_outline.d.ts.map +1 -1
  13. package/src/engine/graphics3/highlight/shader_highlight_outline.js +167 -150
  14. package/src/engine/graphics3/shader_picking_gather.d.ts.map +1 -1
  15. package/src/engine/graphics3/shader_picking_gather.js +133 -120
  16. package/src/shade/device/mock/SoftwareGPUTexture.d.ts.map +1 -1
  17. package/src/shade/device/mock/SoftwareGPUTexture.js +11 -0
  18. package/src/shade/device/pipeline/rp_validate_and_rewrite_for_color_attachments.js +1 -1
  19. package/src/shade/playground/contact_shadows/ContactShadowLab.js +6 -6
  20. package/src/shade/playground/contact_shadows/shader_contact_lab_composite.d.ts.map +1 -1
  21. package/src/shade/playground/contact_shadows/shader_contact_lab_composite.js +6 -4
  22. package/src/shade/playground/contact_shadows/shader_contact_lab_reference.d.ts.map +1 -1
  23. package/src/shade/playground/contact_shadows/shader_contact_lab_reference.js +6 -4
  24. package/src/shade/playground/contact_shadows/shader_contact_shadow_march.d.ts.map +1 -1
  25. package/src/shade/playground/contact_shadows/shader_contact_shadow_march.js +6 -4
  26. package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.js +1 -1
  27. package/src/shade/playground/ssr_variance/capture.js +1 -1
  28. package/src/shade/renderer/Renderer.d.ts +2 -2
  29. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  30. package/src/shade/renderer/Renderer.js +40 -53
  31. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.d.ts.map +1 -1
  32. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.js +3 -1
  33. package/src/shade/renderer/deferred/chunk_ss_trace_contact_shadow_soft.d.ts.map +1 -1
  34. package/src/shade/renderer/deferred/chunk_ss_trace_contact_shadow_soft.js +5 -4
  35. package/src/shade/renderer/deferred/shader_deferred_main.d.ts.map +1 -1
  36. package/src/shade/renderer/deferred/shader_deferred_main.js +6 -4
  37. package/src/shade/renderer/extension/GBufferTextures.d.ts +5 -1
  38. package/src/shade/renderer/extension/GBufferTextures.d.ts.map +1 -1
  39. package/src/shade/renderer/extension/GBufferTextures.js +5 -1
  40. package/src/shade/renderer/extension/ViewTextures.d.ts +11 -7
  41. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  42. package/src/shade/renderer/extension/ViewTextures.js +17 -13
  43. package/src/shade/renderer/gbuffer/G_BUFFER_ALBEDO_FORMAT.d.ts +2 -0
  44. package/src/shade/renderer/gbuffer/G_BUFFER_ALBEDO_FORMAT.d.ts.map +1 -1
  45. package/src/shade/renderer/gbuffer/G_BUFFER_ALBEDO_FORMAT.js +2 -0
  46. package/src/shade/renderer/gbuffer/G_BUFFER_COLOR_TARGETS.d.ts.map +1 -1
  47. package/src/shade/renderer/gbuffer/G_BUFFER_COLOR_TARGETS.js +8 -5
  48. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.d.ts +7 -5
  49. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.d.ts.map +1 -1
  50. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.js +29 -16
  51. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.d.ts +9 -3
  52. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.d.ts.map +1 -1
  53. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.js +40 -32
  54. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.d.ts.map +1 -1
  55. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.js +14 -15
  56. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_debug_draw.d.ts.map +1 -1
  57. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_debug_draw.js +7 -3
  58. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_diffuse.js +1 -1
  59. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.d.ts.map +1 -1
  60. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.js +5 -3
  61. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.d.ts.map +1 -1
  62. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.js +1 -3
  63. package/src/shade/renderer/global_illumination/ibl/shader_diffuse_IBL.js +1 -1
  64. package/src/shade/renderer/global_illumination/ibl/shader_specular_IBL.js +2 -2
  65. package/src/shade/renderer/global_illumination/lpv/shader_diffuse_LPV.js +1 -1
  66. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  67. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +14 -1
  68. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  69. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +10 -1
  70. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_diffuse.js +2 -2
  71. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
  72. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +5 -3
  73. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +1 -1
  74. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.d.ts.map +1 -1
  75. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.js +5 -3
  76. package/src/shade/renderer/global_illumination/sharc/shader/debug/shader_colored_hash.js +1 -1
  77. package/src/shade/renderer/global_illumination/sharc/shader/debug/shader_sharc_debug_radiance.js +1 -1
  78. package/src/shade/renderer/global_illumination/sharc/shader/shader_sharc_update.js +1 -1
  79. package/src/shade/renderer/material/GPUMaterialManager.d.ts +22 -9
  80. package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
  81. package/src/shade/renderer/material/GPUMaterialManager.js +159 -65
  82. package/src/shade/renderer/material/MATERIAL_MASK.d.ts +19 -0
  83. package/src/shade/renderer/material/MATERIAL_MASK.d.ts.map +1 -0
  84. package/src/shade/renderer/material/MATERIAL_MASK.js +19 -0
  85. package/src/shade/renderer/material/dispatch/GPUMaterialComputeDispatch.d.ts +8 -8
  86. package/src/shade/renderer/material/dispatch/GPUMaterialComputeDispatch.d.ts.map +1 -1
  87. package/src/shade/renderer/material/dispatch/GPUMaterialComputeDispatch.js +11 -92
  88. package/src/shade/renderer/material/dispatch/chunk_material_quad_keys.d.ts.map +1 -1
  89. package/src/shade/renderer/material/dispatch/chunk_material_quad_keys.js +10 -2
  90. package/src/shade/renderer/material/dispatch/gbuffer_compute.js +2 -2
  91. package/src/shade/renderer/material/dispatch/graph_material_dispatch_compute.d.ts +7 -7
  92. package/src/shade/renderer/material/dispatch/graph_material_dispatch_compute.d.ts.map +1 -1
  93. package/src/shade/renderer/material/dispatch/graph_material_dispatch_compute.js +20 -16
  94. package/src/shade/renderer/material/dispatch/shader_material_pixel_count.d.ts.map +1 -1
  95. package/src/shade/renderer/material/dispatch/shader_material_pixel_count.js +3 -1
  96. package/src/shade/renderer/material/dispatch/shader_material_pixel_scatter.d.ts.map +1 -1
  97. package/src/shade/renderer/material/dispatch/shader_material_pixel_scatter.js +3 -1
  98. package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts.map +1 -1
  99. package/src/shade/renderer/material/standard/fragment_gbuffer.js +26 -25
  100. package/src/shade/renderer/material/standard/material_gbuffer_vertex.d.ts +10 -8
  101. package/src/shade/renderer/material/standard/material_gbuffer_vertex.d.ts.map +1 -1
  102. package/src/shade/renderer/material/standard/material_gbuffer_vertex.js +16 -13
  103. package/src/shade/renderer/material/template/ShadeMaterialTemplate.d.ts +1 -1
  104. package/src/shade/renderer/material/template/ShadeMaterialTemplate.js +1 -1
  105. package/src/shade/renderer/postprocess/denoise/LigmaDenoiser.d.ts +5 -2
  106. package/src/shade/renderer/postprocess/denoise/LigmaDenoiser.d.ts.map +1 -1
  107. package/src/shade/renderer/postprocess/denoise/LigmaDenoiser.js +7 -4
  108. package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.d.ts +3 -3
  109. package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.d.ts.map +1 -1
  110. package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js +12 -10
  111. package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.js +2 -2
  112. package/src/shade/renderer/postprocess/denoise/shader_temporal_reprojection_luma.d.ts.map +1 -1
  113. package/src/shade/renderer/postprocess/denoise/shader_temporal_reprojection_luma.js +6 -4
  114. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +9 -7
  115. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
  116. package/src/shade/renderer/postprocess/gtao/GTAO.js +11 -8
  117. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts +3 -3
  118. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  119. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +17 -12
  120. package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js +1 -1
  121. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +1 -1
  122. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +4 -4
  123. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.js +2 -2
  124. package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.js +41 -41
  125. package/src/shade/renderer/postprocess/ssr/prefilter/chunk_load_neighbourhood_sample.js +1 -1
  126. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_temporal_accumulate.js +3 -3
  127. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.d.ts.map +1 -1
  128. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +5 -2
  129. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +4 -4
  130. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.d.ts.map +1 -1
  131. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.js +4 -2
  132. package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.d.ts +2 -1
  133. package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.d.ts.map +1 -1
  134. package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.js +10 -2
  135. package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.js +1 -1
  136. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.js +4 -4
  137. package/src/shade/renderer/postprocess/taa/shader_reprojection_map.d.ts.map +1 -1
  138. package/src/shade/renderer/postprocess/taa/shader_reprojection_map.js +6 -4
  139. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +6 -8
  140. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  141. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +29 -33
  142. package/src/shade/renderer/rasterize/TemplatePassDescriptor.d.ts.map +1 -1
  143. package/src/shade/renderer/rasterize/TemplatePassDescriptor.js +1 -0
  144. package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.d.ts +6 -3
  145. package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.d.ts.map +1 -1
  146. package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.js +8 -3
  147. package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.d.ts.map +1 -1
  148. package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.js +3 -0
  149. package/src/shade/renderer/rasterize/expand/RasterizationCollectionType.d.ts +1 -0
  150. package/src/shade/renderer/rasterize/expand/RasterizationCollectionType.js +5 -0
  151. package/src/shade/renderer/rasterize/expand/graph_meshlets_rasterize.d.ts +8 -3
  152. package/src/shade/renderer/rasterize/expand/graph_meshlets_rasterize.d.ts.map +1 -1
  153. package/src/shade/renderer/rasterize/expand/graph_meshlets_rasterize.js +54 -5
  154. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +1 -0
  155. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
  156. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +1 -1
  157. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts +1 -1
  158. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
  159. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +2 -1
  160. package/src/shade/renderer/rasterize/native/graph_rasterize_meshes_alpha_tested.d.ts +7 -2
  161. package/src/shade/renderer/rasterize/native/graph_rasterize_meshes_alpha_tested.d.ts.map +1 -1
  162. package/src/shade/renderer/rasterize/native/graph_rasterize_meshes_alpha_tested.js +73 -9
  163. package/src/shade/renderer/rasterize/native/viz/shader_vertex.js +4 -4
  164. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_alpha_tested_pass_descriptor.d.ts.map +1 -1
  165. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_alpha_tested_pass_descriptor.js +23 -40
  166. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.d.ts.map +1 -1
  167. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.js +55 -76
  168. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.d.ts +4 -2
  169. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.d.ts.map +1 -1
  170. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.js +6 -2
  171. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.d.ts +4 -2
  172. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.d.ts.map +1 -1
  173. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.js +6 -2
  174. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.d.ts +5 -2
  175. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.d.ts.map +1 -1
  176. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.js +43 -2
  177. package/src/shade/renderer/rasterize/visibility/VISIBILITY_BUFFER.d.ts +39 -0
  178. package/src/shade/renderer/rasterize/visibility/VISIBILITY_BUFFER.d.ts.map +1 -0
  179. package/src/shade/renderer/rasterize/visibility/VISIBILITY_BUFFER.js +45 -0
  180. package/src/shade/renderer/rasterize/visibility/chunk_visibility_decode.d.ts +26 -0
  181. package/src/shade/renderer/rasterize/visibility/chunk_visibility_decode.d.ts.map +1 -0
  182. package/src/shade/renderer/rasterize/visibility/chunk_visibility_decode.js +48 -0
  183. package/src/shade/renderer/rasterize/visibility/shader_visible_meshlets_append.d.ts +40 -0
  184. package/src/shade/renderer/rasterize/visibility/shader_visible_meshlets_append.d.ts.map +1 -0
  185. package/src/shade/renderer/rasterize/visibility/shader_visible_meshlets_append.js +172 -0
  186. package/src/shade/renderer/restir/di/chunk_restir_reconstruct_surface.d.ts.map +1 -1
  187. package/src/shade/renderer/restir/di/chunk_restir_reconstruct_surface.js +6 -4
  188. package/src/shade/renderer/restir/di/chunk_restir_spatial_reuse.js +1 -1
  189. package/src/shade/renderer/restir/di/shader_restir_di_denoise.js +2 -2
  190. package/src/shade/renderer/shader/chunk/color/sRGB/chunk_sRGBTransferEOTF.d.ts +9 -0
  191. package/src/shade/renderer/shader/chunk/color/sRGB/chunk_sRGBTransferEOTF.d.ts.map +1 -0
  192. package/src/shade/renderer/shader/chunk/color/sRGB/chunk_sRGBTransferEOTF.js +18 -0
  193. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_determinant.d.ts +20 -0
  194. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_determinant.d.ts.map +1 -0
  195. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_determinant.js +26 -0
  196. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.d.ts +60 -18
  197. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.d.ts.map +1 -1
  198. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.js +163 -45
  199. package/src/shade/renderer/shader/chunk/geometry/mat4/chunk_mat4_linear_determinant.d.ts.map +1 -1
  200. package/src/shade/renderer/shader/chunk/geometry/mat4/chunk_mat4_linear_determinant.js +19 -18
  201. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_g_buffer_face_normal.d.ts +13 -0
  202. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_g_buffer_face_normal.d.ts.map +1 -0
  203. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_g_buffer_face_normal.js +22 -0
  204. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.d.ts +8 -1
  205. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.d.ts.map +1 -1
  206. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.js +10 -8
  207. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_g_buffer_face_normal.d.ts +22 -0
  208. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_g_buffer_face_normal.d.ts.map +1 -0
  209. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_g_buffer_face_normal.js +32 -0
  210. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_g_buffer_normal.d.ts +11 -1
  211. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_g_buffer_normal.d.ts.map +1 -1
  212. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_g_buffer_normal.js +14 -6
  213. package/src/shade/renderer/shader/chunk/material/chunk_decode_g_buffer_albedo.d.ts +14 -0
  214. package/src/shade/renderer/shader/chunk/material/chunk_decode_g_buffer_albedo.d.ts.map +1 -0
  215. package/src/shade/renderer/shader/chunk/material/chunk_decode_g_buffer_albedo.js +24 -0
  216. package/src/shade/renderer/shader/chunk/material/chunk_encode_g_buffer_albedo.d.ts +17 -0
  217. package/src/shade/renderer/shader/chunk/material/chunk_encode_g_buffer_albedo.d.ts.map +1 -0
  218. package/src/shade/renderer/shader/chunk/material/chunk_encode_g_buffer_albedo.js +27 -0
  219. package/src/shade/renderer/shader/chunk/screen_space/SCREEN_SPACE_RESOURCES.d.ts +7 -1
  220. package/src/shade/renderer/shader/chunk/screen_space/SCREEN_SPACE_RESOURCES.d.ts.map +1 -1
  221. package/src/shade/renderer/shader/chunk/screen_space/SCREEN_SPACE_RESOURCES.js +8 -1
  222. package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_load_world_space_normal.js +1 -1
  223. package/src/shade/renderer/shader/chunk/screen_space/chunk_screen_space_newton_ray.js +10 -10
  224. package/src/shade/renderer/shader/pass/RenderPassDescriptor.d.ts +8 -0
  225. package/src/shade/renderer/shader/pass/RenderPassDescriptor.d.ts.map +1 -1
  226. package/src/shade/renderer/shader/pass/RenderPassDescriptor.js +9 -0
  227. package/src/shade/renderer/shader/util/shader_decode_octahedral_normal.js +1 -1
  228. package/src/shade/renderer/shadow/contact/graph_contact_shadow_linear.d.ts +3 -3
  229. package/src/shade/renderer/shadow/contact/graph_contact_shadow_linear.d.ts.map +1 -1
  230. package/src/shade/renderer/shadow/contact/graph_contact_shadow_linear.js +3 -3
  231. package/src/shade/renderer/shadow/contact/shader_contact_shadow_linear.d.ts.map +1 -1
  232. package/src/shade/renderer/shadow/contact/shader_contact_shadow_linear.js +6 -4
  233. package/src/shade/renderer/shadow/ray/RTXShadows.d.ts +6 -4
  234. package/src/shade/renderer/shadow/ray/RTXShadows.d.ts.map +1 -1
  235. package/src/shade/renderer/shadow/ray/RTXShadows.js +16 -5
  236. package/src/shade/renderer/shadow/ray/shader_ray_shadow_code.d.ts.map +1 -1
  237. package/src/shade/renderer/shadow/ray/shader_ray_shadow_code.js +7 -7
  238. package/src/shade/renderer/shadow/ray/shader_shadow_upscale.js +2 -2
  239. package/src/shade/renderer/shadow/ray/staged/gen/graph_gen_rays.d.ts +4 -2
  240. package/src/shade/renderer/shadow/ray/staged/gen/graph_gen_rays.d.ts.map +1 -1
  241. package/src/shade/renderer/shadow/ray/staged/gen/graph_gen_rays.js +79 -74
  242. package/src/shade/renderer/shadow/ray/staged/gen/shader_generate_rays.d.ts.map +1 -1
  243. package/src/shade/renderer/shadow/ray/staged/gen/shader_generate_rays.js +7 -7
  244. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.d.ts.map +1 -1
  245. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.js +7 -3
  246. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.d.ts +7 -5
  247. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.d.ts.map +1 -1
  248. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.js +29 -16
  249. package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts +5 -5
  250. package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts.map +1 -1
  251. package/src/shade/renderer/texture/virtual/VirtualTextureManager.js +8 -8
  252. package/src/shade/renderer/texture/virtual/build_shader_vt_feedback.d.ts.map +1 -1
  253. package/src/shade/renderer/texture/virtual/build_shader_vt_feedback.js +13 -14
  254. package/src/shade/renderer/water/GPUWaterRenderer.d.ts +2 -1
  255. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  256. package/src/shade/renderer/water/GPUWaterRenderer.js +6 -4
  257. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  258. package/src/shade/renderer/water/chunk_water_transport.js +11 -9
  259. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  260. package/src/shade/renderer/water/shader_water.js +13 -11
  261. package/src/shade/renderer/gbuffer/G_BUFFER_MIP_LEVELS.d.ts +0 -7
  262. package/src/shade/renderer/gbuffer/G_BUFFER_MIP_LEVELS.d.ts.map +0 -1
  263. package/src/shade/renderer/gbuffer/G_BUFFER_MIP_LEVELS.js +0 -6
  264. package/src/shade/renderer/postprocess/ssr/shader_downsample_encoded_normal.d.ts +0 -3
  265. package/src/shade/renderer/postprocess/ssr/shader_downsample_encoded_normal.d.ts.map +0 -1
  266. package/src/shade/renderer/postprocess/ssr/shader_downsample_encoded_normal.js +0 -104
@@ -1,8 +1,10 @@
1
1
  import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+ import { MATERIAL_MASK_NONE } from "../MATERIAL_MASK.js";
2
3
 
3
4
  /**
4
5
  * Group 1 binding of the material-seen bitset the shared G-buffer vertex stage reads: bit
5
- * `id & 31` of word `id >> 5` is set when material `id` holds a pixel of the view.
6
+ * `place & 31` of word `place >> 5` is set when the material at that place in the G-buffer pass's
7
+ * list holds a pixel of the view.
6
8
  *
7
9
  * @type {number}
8
10
  */
@@ -10,20 +12,21 @@ export const MATERIAL_SEEN_BINDING = 4;
10
12
 
11
13
  /**
12
14
  * Shared vertex stage of every material template's G-buffer pipeline: a fullscreen triangle placed
13
- * at depth `material.id / 2^24`, matched against the material-depth mask with `depthCompare: 'equal'`
15
+ * at depth `place / MATERIAL_MASK_NONE`, matched against the material mask with `depthCompare: 'equal'`
14
16
  * so the fragment stage only runs on this material's pixels.
15
17
  *
16
- * The material id rides in the instance index — the material pass draws `draw(3, 1, 0, id)` — so a
17
- * template's group 0 can be laid out however the template needs, and is visible to the fragment
18
- * stage alone. A direct draw's `firstInstance` needs no device feature.
18
+ * The material's place in the pass's list rides in the instance index — the material pass draws
19
+ * `draw(3, 1, 0, place)` — so a template's group 0 can be laid out however the template needs, and
20
+ * is visible to the fragment stage alone. A direct draw's `firstInstance` needs no device feature.
19
21
  *
20
22
  * A material that holds no pixel of the view — its bit clear in `material_seen`, of the shared group
21
23
  * 1 — gets all three corners on one point: a triangle of no area, which rasterizes nothing, so the
22
- * draw costs three vertex invocations rather than a fullscreen pass of depth tests. An id past the
24
+ * draw costs three vertex invocations rather than a fullscreen pass of depth tests. A place past the
23
25
  * end of the bitset is drawn.
24
26
  *
25
- * `id / 16777216` is the expression the material-depth pass writes, and a division by a power of two
26
- * is exact for every id below 2^24, so the two meet at depth-equal.
27
+ * `place / MATERIAL_MASK_NONE` is the expression the material-depth pass writes, and both are
28
+ * quantised to the same 16-bit code for every place below MATERIAL_MASK_NONE, so the two meet at
29
+ * depth-equal.
27
30
  *
28
31
  * @type {string}
29
32
  */
@@ -45,20 +48,20 @@ struct VertexOutput {
45
48
  @vertex
46
49
  fn main(
47
50
  @builtin(vertex_index) id : u32,
48
- @builtin(instance_index) material_id : u32,
51
+ @builtin(instance_index) place : u32,
49
52
  ) -> VertexOutput {
50
53
 
51
54
  var out: VertexOutput;
52
55
 
53
- let word = material_id >> 5u;
56
+ let word = place >> 5u;
54
57
 
55
- // an id past the bitset was not counted, so it is drawn as though seen
58
+ // a place past the bitset was not counted, so it is drawn as though seen
56
59
  let seen = word >= arrayLength(&material_seen)
57
- || (material_seen[word] & (1u << (material_id & 31u))) != 0u;
60
+ || (material_seen[word] & (1u << (place & 31u))) != 0u;
58
61
 
59
62
  let ndc = select(pos[0], pos[id], seen);
60
63
 
61
- out.position = vec4<f32>(ndc, f32(material_id)/16777216 , 1.0);
64
+ out.position = vec4<f32>(ndc, f32(place) / ${MATERIAL_MASK_NONE}.0, 1.0);
62
65
 
63
66
  return out;
64
67
  }
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * **Group 0 is the template's.** It is declared with fragment visibility, and one bind group per
11
11
  * material built on it serves the G-buffer pass and both alpha-tested passes. Groups 1 and 2 belong
12
- * to the passes, so a template must not reuse their names (`viz_buffer_triangle`, `viz_buffer_mesh`,
12
+ * to the passes, so a template must not reuse their names (`visibility`, `visible_meshlets`,
13
13
  * `view`, `camera`, `scene_database`, `geometries`, `meshlets`, `meshlet_metadata`, `meshlet_data`,
14
14
  * `materials`, `t_noise`) — nor those of the experimental compute material dispatch, which
15
15
  * assembles a laydown of its own around {@link gbuffer_surface} (`material_quads`, `g_buffer_pbr`,
@@ -25,7 +25,7 @@ let ordinal_counter = 0;
25
25
  *
26
26
  * **Group 0 is the template's.** It is declared with fragment visibility, and one bind group per
27
27
  * material built on it serves the G-buffer pass and both alpha-tested passes. Groups 1 and 2 belong
28
- * to the passes, so a template must not reuse their names (`viz_buffer_triangle`, `viz_buffer_mesh`,
28
+ * to the passes, so a template must not reuse their names (`visibility`, `visible_meshlets`,
29
29
  * `view`, `camera`, `scene_database`, `geometries`, `meshlets`, `meshlet_metadata`, `meshlet_data`,
30
30
  * `materials`, `t_noise`) — nor those of the experimental compute material dispatch, which
31
31
  * assembles a laydown of its own around {@link gbuffer_surface} (`material_quads`, `g_buffer_pbr`,
@@ -27,7 +27,9 @@ export class LigmaDenoiser {
27
27
  * @param {number} options.frame_index
28
28
  * @param {number} options.input_current_depth
29
29
  * @param {number} options.input_previous_depth
30
- * @param {number} options.input_current_normal
30
+ * @param {number} options.input_current_normal the G-buffer's shading normal, for the spatial filter
31
+ * @param {number} options.input_current_pbr the G-buffer's PBR target, for the face normal the temporal
32
+ * reprojection weighs history by
31
33
  * @param {number} options.input_velocity
32
34
  * @param {number} options.input_mip_level
33
35
  * @param {number} options.input
@@ -38,12 +40,13 @@ export class LigmaDenoiser {
38
40
  * @param {number[]} options.resolution
39
41
  * @param {boolean} [options.denoise_spatial] should spatial denoising be applied?
40
42
  */
41
- execute({ graph, frame_index, input_current_depth, input_previous_depth, input_current_normal, input_velocity, input_mip_level, input, camera_current, camera_previous, input_occlusion, jitter, resolution, denoise_spatial }: {
43
+ execute({ graph, frame_index, input_current_depth, input_previous_depth, input_current_normal, input_current_pbr, input_velocity, input_mip_level, input, camera_current, camera_previous, input_occlusion, jitter, resolution, denoise_spatial }: {
42
44
  graph: FrameGraph;
43
45
  frame_index: number;
44
46
  input_current_depth: number;
45
47
  input_previous_depth: number;
46
48
  input_current_normal: number;
49
+ input_current_pbr: number;
47
50
  input_velocity: number;
48
51
  input_mip_level: number;
49
52
  input: number;
@@ -1 +1 @@
1
- {"version":3,"file":"LigmaDenoiser.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/denoise/LigmaDenoiser.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IASI;;;OAGG;IACH,sCAYC;IAED;;;OAGG;IACH,qCAMC;IAED;;;;OAIG;IACH,yBAHW,MAAM,qBAOhB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH;QAf+B,KAAK;QACT,WAAW,EAA3B,MAAM;QACU,mBAAmB,EAAnC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACU,cAAc,EAA9B,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,KAAK,EAArB,MAAM;QACoB,cAAc;QACd,eAAe;QACzB,eAAe,EAA/B,MAAM;QACY,MAAM,EAAxB,MAAM,EAAE;QACU,UAAU,EAA5B,MAAM,EAAE;QACU,eAAe,GAAjC,OAAO;YA0IjB;;CACJ"}
1
+ {"version":3,"file":"LigmaDenoiser.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/denoise/LigmaDenoiser.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IASI;;;OAGG;IACH,sCAYC;IAED;;;OAGG;IACH,qCAMC;IAED;;;;OAIG;IACH,yBAHW,MAAM,qBAOhB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH;QAjB+B,KAAK;QACT,WAAW,EAA3B,MAAM;QACU,mBAAmB,EAAnC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACU,iBAAiB,EAAjC,MAAM;QAEU,cAAc,EAA9B,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,KAAK,EAArB,MAAM;QACoB,cAAc;QACd,eAAe;QACzB,eAAe,EAA/B,MAAM;QACY,MAAM,EAAxB,MAAM,EAAE;QACU,UAAU,EAA5B,MAAM,EAAE;QACU,eAAe,GAAjC,OAAO;YA2IjB;;CACJ"}
@@ -71,7 +71,9 @@ export class LigmaDenoiser {
71
71
  * @param {number} options.frame_index
72
72
  * @param {number} options.input_current_depth
73
73
  * @param {number} options.input_previous_depth
74
- * @param {number} options.input_current_normal
74
+ * @param {number} options.input_current_normal the G-buffer's shading normal, for the spatial filter
75
+ * @param {number} options.input_current_pbr the G-buffer's PBR target, for the face normal the temporal
76
+ * reprojection weighs history by
75
77
  * @param {number} options.input_velocity
76
78
  * @param {number} options.input_mip_level
77
79
  * @param {number} options.input
@@ -88,6 +90,7 @@ export class LigmaDenoiser {
88
90
  input_current_depth,
89
91
  input_previous_depth,
90
92
  input_current_normal,
93
+ input_current_pbr,
91
94
  input_velocity,
92
95
  input_mip_level = 0,
93
96
  input,
@@ -132,7 +135,7 @@ export class LigmaDenoiser {
132
135
  const depth_current = resources.get(data.depth_current);
133
136
  const depth_previous = resources.get(data.depth_previous);
134
137
  const history = resources.get(data.history);
135
- const normal = resources.get(data.normal);
138
+ const pbr = resources.get(data.pbr);
136
139
  const input_occlusion = resources.get(data.input_occlusion);
137
140
 
138
141
  const out = resources.get(data.output);
@@ -156,7 +159,7 @@ export class LigmaDenoiser {
156
159
  VelocityBuffer: velocity.obtainView(input_view_descriptor),
157
160
  DepthBuffer: depth_current.obtainView(input_view_descriptor),
158
161
  PrevDepthBuffer: depth_previous.obtainView(input_view_descriptor),
159
- NormalBuffer: normal.obtainView(input_view_descriptor),
162
+ PBRBuffer: pbr.obtainView(input_view_descriptor),
160
163
  Jitter: jitter_buffer,
161
164
  tOcclusion: input_occlusion.obtainView(input_view_descriptor),
162
165
  camera_current: camera_current.buffer,
@@ -187,7 +190,7 @@ export class LigmaDenoiser {
187
190
  reprojection_data.depth_current = reprojection_builder.read(input_current_depth);
188
191
  reprojection_data.velocity = reprojection_builder.read(input_velocity);
189
192
  reprojection_data.depth_previous = reprojection_builder.read(input_previous_depth);
190
- reprojection_data.normal = reprojection_builder.read(input_current_normal);
193
+ reprojection_data.pbr = reprojection_builder.read(input_current_pbr);
191
194
  reprojection_data.history = reprojection_builder.read(gr_history);
192
195
  reprojection_data.input_occlusion = reprojection_builder.read(input_occlusion);
193
196
  reprojection_data.output = reprojection_builder.write(gr_output);
@@ -4,18 +4,18 @@
4
4
  * @param {FrameGraph} options.graph
5
5
  * @param {number} options.input_current_depth
6
6
  * @param {number} options.input_previous_depth
7
- * @param {number} options.input_current_normal
7
+ * @param {number} options.input_current_pbr the G-buffer's PBR target, for its face normal
8
8
  * @param {number} options.input_velocity
9
9
  * @param {GPUCameraContext} options.camera_current
10
10
  * @param {GPUCameraContext} options.camera_previous
11
11
  * @param {number[]} options.jitter
12
12
  * @param {number[]} options.resolution
13
13
  */
14
- export function graph_pass_debug_reprojection({ graph, input_current_depth, input_previous_depth, input_current_normal, input_velocity, camera_current, camera_previous, jitter, resolution }: {
14
+ export function graph_pass_debug_reprojection({ graph, input_current_depth, input_previous_depth, input_current_pbr, input_velocity, camera_current, camera_previous, jitter, resolution }: {
15
15
  graph: FrameGraph;
16
16
  input_current_depth: number;
17
17
  input_previous_depth: number;
18
- input_current_normal: number;
18
+ input_current_pbr: number;
19
19
  input_velocity: number;
20
20
  camera_current: GPUCameraContext;
21
21
  camera_previous: GPUCameraContext;
@@ -1 +1 @@
1
- {"version":3,"file":"graph_pass_debug_reprojection.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js"],"names":[],"mappings":"AA0FA;;;;;;;;;;;;GAYG;AACH;IAV+B,KAAK;IACT,mBAAmB,EAAnC,MAAM;IACU,oBAAoB,EAApC,MAAM;IACU,oBAAoB,EAApC,MAAM;IACU,cAAc,EAA9B,MAAM;IACoB,cAAc;IACd,eAAe;IACvB,MAAM,EAAxB,MAAM,EAAE;IACU,UAAU,EAA5B,MAAM,EAAE;QAyGlB"}
1
+ {"version":3,"file":"graph_pass_debug_reprojection.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js"],"names":[],"mappings":"AA4FA;;;;;;;;;;;;GAYG;AACH;IAV+B,KAAK;IACT,mBAAmB,EAAnC,MAAM;IACU,oBAAoB,EAApC,MAAM;IACU,iBAAiB,EAAjC,MAAM;IACU,cAAc,EAA9B,MAAM;IACoB,cAAc;IACd,eAAe;IACvB,MAAM,EAAxB,MAAM,EAAE;IACU,UAAU,EAA5B,MAAM,EAAE;QAyGlB"}
@@ -5,7 +5,9 @@ import { TextureBindingLayout } from "../../../../descriptor/binding/TextureBind
5
5
  import { ComputePipelineDescriptor } from "../../../../descriptor/pipeline/compute/ComputePipelineDescriptor.js";
6
6
  import { TextureResourceDescriptor } from "../../../../device/graph/TextureResourceDescriptor.js";
7
7
  import { CAMERA_UNIFORM_STRUCT } from "../../../camera/CAMERA_UNIFORM_STRUCT.js";
8
- import { chunk_decode_g_buffer_normal } from "../../../shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.js";
8
+ import {
9
+ chunk_decode_g_buffer_face_normal
10
+ } from "../../../shader/chunk/geometry/normal/chunk_decode_g_buffer_face_normal.js";
9
11
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
10
12
  import { draw_texture_as_rgba } from "../../../texture/draw_texture_as_rgba.js";
11
13
  import { chunk_compute_reprojection_weight } from "../chunk_compute_reprojection_weight.js";
@@ -22,7 +24,7 @@ const NUM_THREADS_Y = 8;
22
24
  @group(1) @binding(0) var VelocityBuffer: texture_2d<f32>;
23
25
  @group(1) @binding(1) var DepthBuffer: texture_2d<f32>;
24
26
  @group(1) @binding(2) var PrevDepthBuffer: texture_2d<f32>;
25
- @group(1) @binding(3) var NormalBuffer: texture_2d<u32>;
27
+ @group(1) @binding(3) var PBRBuffer: texture_2d<f32>;
26
28
  @group(1) @binding(4) var<uniform> Jitter: vec2<f32>;
27
29
  @group(1) @binding(5) var<uniform> camera_current: ${CAMERA_UNIFORM_STRUCT.wgsl_ref};
28
30
  @group(1) @binding(6) var<uniform> camera_previous: ${CAMERA_UNIFORM_STRUCT.wgsl_ref};
@@ -44,7 +46,7 @@ fn main(
44
46
 
45
47
  let previous_coord = current_coord_f - velocity.xy;
46
48
 
47
- let normal = decode_g_buffer_normal( textureLoad(NormalBuffer, current_coord, 0).zw );
49
+ let normal = decode_g_buffer_face_normal( textureLoad(PBRBuffer, current_coord, 0) );
48
50
 
49
51
  let texel = compute_reprojection_weight(
50
52
  current_coord_f,
@@ -62,7 +64,7 @@ fn main(
62
64
  `,[
63
65
  chunk_compute_reprojection_weight,
64
66
  CAMERA_UNIFORM_STRUCT.declaration_chunk,
65
- chunk_decode_g_buffer_normal,
67
+ chunk_decode_g_buffer_face_normal,
66
68
  ]).compile().text;
67
69
 
68
70
  const pipeline_descriptor = ComputePipelineDescriptor.simplified({
@@ -80,7 +82,7 @@ const pipeline_descriptor = ComputePipelineDescriptor.simplified({
80
82
  TextureBindingLayout.unfilterableFloat,
81
83
  TextureBindingLayout.unfilterableFloat,
82
84
  TextureBindingLayout.unfilterableFloat,
83
- TextureBindingLayout.uint,
85
+ TextureBindingLayout.unfilterableFloat,
84
86
  BufferBindingLayout.uniform,
85
87
  BufferBindingLayout.uniform,
86
88
  BufferBindingLayout.uniform,
@@ -94,7 +96,7 @@ const pipeline_descriptor = ComputePipelineDescriptor.simplified({
94
96
  * @param {FrameGraph} options.graph
95
97
  * @param {number} options.input_current_depth
96
98
  * @param {number} options.input_previous_depth
97
- * @param {number} options.input_current_normal
99
+ * @param {number} options.input_current_pbr the G-buffer's PBR target, for its face normal
98
100
  * @param {number} options.input_velocity
99
101
  * @param {GPUCameraContext} options.camera_current
100
102
  * @param {GPUCameraContext} options.camera_previous
@@ -105,7 +107,7 @@ export function graph_pass_debug_reprojection({
105
107
  graph,
106
108
  input_current_depth,
107
109
  input_previous_depth,
108
- input_current_normal,
110
+ input_current_pbr,
109
111
  input_velocity,
110
112
  camera_current,
111
113
  camera_previous,
@@ -129,7 +131,7 @@ export function graph_pass_debug_reprojection({
129
131
  const velocity = resources.get(data.velocity);
130
132
  const depth_current = resources.get(data.depth_current);
131
133
  const depth_previous = resources.get(data.depth_previous);
132
- const normal = resources.get(data.normal);
134
+ const pbr = resources.get(data.pbr);
133
135
 
134
136
  const out = resources.get(data.output);
135
137
 
@@ -145,7 +147,7 @@ export function graph_pass_debug_reprojection({
145
147
  velocity.obtainView(),
146
148
  depth_current.obtainView(),
147
149
  depth_previous.obtainView(),
148
- normal.obtainView(),
150
+ pbr.obtainView(),
149
151
  { buffer: jitter_buffer },
150
152
  { buffer: camera_current.gpu_buffer },
151
153
  { buffer: camera_previous.gpu_buffer },
@@ -168,7 +170,7 @@ export function graph_pass_debug_reprojection({
168
170
  reprojection_data.depth_current = reprojection_builder.read(input_current_depth);
169
171
  reprojection_data.velocity = reprojection_builder.read(input_velocity);
170
172
  reprojection_data.depth_previous = reprojection_builder.read(input_previous_depth);
171
- reprojection_data.normal = reprojection_builder.read(input_current_normal);
173
+ reprojection_data.pbr = reprojection_builder.read(input_current_pbr);
172
174
  reprojection_data.history = reprojection_builder.create("fake history", TextureResourceDescriptor.from({
173
175
  resolution,
174
176
  format: "rgba8unorm",
@@ -59,7 +59,7 @@ fn main(
59
59
  var sum_visibility = center_visibility;
60
60
 
61
61
 
62
- let current_normal = decode_g_buffer_normal(textureLoad(tNormal, ipos, 0).xy);
62
+ let current_normal = decode_g_buffer_normal(textureLoad(tNormal, ipos, 0).x);
63
63
  let center_depth = textureLoad(tDepth, ipos, 0).r;
64
64
 
65
65
  const offsets = array< vec2<i32>,8>(
@@ -92,7 +92,7 @@ fn main(
92
92
 
93
93
  let sample_visibility = textureLoad(tInput, p, 0).rg;
94
94
 
95
- let sample_normal = decode_g_buffer_normal(textureLoad(tNormal, p, 0).xy);
95
+ let sample_normal = decode_g_buffer_normal(textureLoad(tNormal, p, 0).x);
96
96
  let sample_depth = textureLoad(tDepth, p, 0).r;
97
97
 
98
98
  // compute the edge-stopping functions
@@ -1 +1 @@
1
- {"version":3,"file":"shader_temporal_reprojection_luma.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/denoise/shader_temporal_reprojection_luma.js"],"names":[],"mappings":"AAkSA;;;GAGG;AACH,8DAII;8BA3R0B,+BAA+B"}
1
+ {"version":3,"file":"shader_temporal_reprojection_luma.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/denoise/shader_temporal_reprojection_luma.js"],"names":[],"mappings":"AAoSA;;;GAGG;AACH,8DAII;8BA3R0B,+BAA+B"}
@@ -1,6 +1,8 @@
1
1
  import { CAMERA_UNIFORM_STRUCT } from "../../camera/CAMERA_UNIFORM_STRUCT.js";
2
2
  import { chunk_project_position_from_depth } from "../../shader/chunk/camera/chunk_project_position_from_depth.js";
3
- import { chunk_decode_g_buffer_normal } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.js";
3
+ import {
4
+ chunk_decode_g_buffer_face_normal
5
+ } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_face_normal.js";
4
6
  import { chunk_get_std_dev } from "../../shader/chunk/math/statistics/chunk_get_std_dev.js";
5
7
  import {
6
8
  chunk_texture_sample_bilinear_exact
@@ -33,7 +35,7 @@ resources.createGroup()
33
35
  .addTexture("VelocityBuffer")
34
36
  .addTexture("DepthBuffer")
35
37
  .addTexture("PrevDepthBuffer")
36
- .addTexture("NormalBuffer", "uint")
38
+ .addTexture("PBRBuffer")
37
39
  .addTexture("tOcclusion")
38
40
  .addUniform("Jitter","vec2<f32>")
39
41
  .addUniform("camera_current",CAMERA_UNIFORM_STRUCT)
@@ -184,7 +186,7 @@ fn main(
184
186
  // 0.5 to account for texel center offset
185
187
  let previous_coord = current_coord_f - velocity.xy - Jitter;
186
188
 
187
- let normal = decode_g_buffer_normal( textureLoad(NormalBuffer, current_coord, 0).zw );
189
+ let normal = decode_g_buffer_face_normal( textureLoad(PBRBuffer, current_coord, 0) );
188
190
 
189
191
  let reprojection_confidence = textureLoad(tOcclusion, current_coord, 0).r;
190
192
 
@@ -276,7 +278,7 @@ fn main(
276
278
 
277
279
  `, [
278
280
 
279
- chunk_decode_g_buffer_normal,
281
+ chunk_decode_g_buffer_face_normal,
280
282
  chunk_clip_history_colour_YCoCg,
281
283
  chunk_texture_sample_red_min_st,
282
284
  chunk_taa_get_velocity,
@@ -26,9 +26,10 @@ export class GTAO {
26
26
  * @param {number} options.camera this frame's camera uniform
27
27
  * @param {number} options.input_depth this frame's depth
28
28
  * @param {number} options.input_hzb hierarchical depth built from it
29
- * @param {number} options.input_normal G-buffer normals
30
- * @param {number} options.input_normal_previous last frame's G-buffer normals, at the size last frame was
31
- * drawn at: which surface each history texel was written on
29
+ * @param {number} options.input_normal the G-buffer's shading normal
30
+ * @param {number} options.input_pbr the G-buffer's PBR target, for the face normal it holds
31
+ * @param {number} options.input_pbr_previous last frame's PBR target, at the size last frame was drawn
32
+ * at: its face normal says which surface each history texel was written on
32
33
  * @param {number} options.input_velocity per-pixel velocity, in this frame's pixels
33
34
  * @param {number} options.input_occlusion depth-clip pass output: history confidence in r
34
35
  * @param {number} options.frame_index the renderer's frame counter: drives the noise, the history
@@ -36,16 +37,17 @@ export class GTAO {
36
37
  * @param {number} options.output G-buffer albedo; AO is blended into its alpha
37
38
  * @param {number[]} options.resolution this frame's render size
38
39
  * @returns {{visibility:number, occlusion:number, bent_normals:number}} the accumulated visibility and
39
- * bend (`rgba16float`), `output` after the composite, and the accumulated bent normals, octahedral in
40
- * `rg16uint` as `input_normal` is
40
+ * bend (`rgba16float`), `output` after the composite, and the accumulated bent normals, packed
41
+ * into an `r32uint` as `input_normal` is
41
42
  */
42
- graph_pass({ graph, camera, input_depth, input_hzb, input_normal, input_normal_previous, input_velocity, input_occlusion, frame_index, output, resolution }: {
43
+ graph_pass({ graph, camera, input_depth, input_hzb, input_normal, input_pbr, input_pbr_previous, input_velocity, input_occlusion, frame_index, output, resolution }: {
43
44
  graph: FrameGraph;
44
45
  camera: number;
45
46
  input_depth: number;
46
47
  input_hzb: number;
47
48
  input_normal: number;
48
- input_normal_previous: number;
49
+ input_pbr: number;
50
+ input_pbr_previous: number;
49
51
  input_velocity: number;
50
52
  input_occlusion: number;
51
53
  frame_index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"GTAO.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;IAqBI;;;OAGG;IACH,uCAWC;IA7BD;;;;OAIG;IACH,eAFU,OAAO,CAEI;IA0BrB;;;;OAIG;IACH,0BAFW,eAAe,QAOzB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH;QAjB+B,KAAK;QACT,MAAM,EAAtB,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,qBAAqB,EAArC,MAAM;QAEU,cAAc,EAA9B,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,WAAW,EAA3B,MAAM;QAEU,MAAM,EAAtB,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACN;QAAC,UAAU,EAAC,MAAM,CAAC;QAAC,SAAS,EAAC,MAAM,CAAC;QAAC,YAAY,EAAC,MAAM,CAAA;KAAC,CAqHtE;;CACJ;8BA3LY,OAAO,6CAA6C,EAAE,eAAe"}
1
+ {"version":3,"file":"GTAO.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;IAqBI;;;OAGG;IACH,uCAWC;IA7BD;;;;OAIG;IACH,eAFU,OAAO,CAEI;IA0BrB;;;;OAIG;IACH,0BAFW,eAAe,QAOzB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAlB+B,KAAK;QACT,MAAM,EAAtB,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,kBAAkB,EAAlC,MAAM;QAEU,cAAc,EAA9B,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,WAAW,EAA3B,MAAM;QAEU,MAAM,EAAtB,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACN;QAAC,UAAU,EAAC,MAAM,CAAC;QAAC,SAAS,EAAC,MAAM,CAAC;QAAC,YAAY,EAAC,MAAM,CAAA;KAAC,CAuHtE;;CACJ;8BA9LY,OAAO,6CAA6C,EAAE,eAAe"}
@@ -68,9 +68,10 @@ export class GTAO {
68
68
  * @param {number} options.camera this frame's camera uniform
69
69
  * @param {number} options.input_depth this frame's depth
70
70
  * @param {number} options.input_hzb hierarchical depth built from it
71
- * @param {number} options.input_normal G-buffer normals
72
- * @param {number} options.input_normal_previous last frame's G-buffer normals, at the size last frame was
73
- * drawn at: which surface each history texel was written on
71
+ * @param {number} options.input_normal the G-buffer's shading normal
72
+ * @param {number} options.input_pbr the G-buffer's PBR target, for the face normal it holds
73
+ * @param {number} options.input_pbr_previous last frame's PBR target, at the size last frame was drawn
74
+ * at: its face normal says which surface each history texel was written on
74
75
  * @param {number} options.input_velocity per-pixel velocity, in this frame's pixels
75
76
  * @param {number} options.input_occlusion depth-clip pass output: history confidence in r
76
77
  * @param {number} options.frame_index the renderer's frame counter: drives the noise, the history
@@ -78,8 +79,8 @@ export class GTAO {
78
79
  * @param {number} options.output G-buffer albedo; AO is blended into its alpha
79
80
  * @param {number[]} options.resolution this frame's render size
80
81
  * @returns {{visibility:number, occlusion:number, bent_normals:number}} the accumulated visibility and
81
- * bend (`rgba16float`), `output` after the composite, and the accumulated bent normals, octahedral in
82
- * `rg16uint` as `input_normal` is
82
+ * bend (`rgba16float`), `output` after the composite, and the accumulated bent normals, packed
83
+ * into an `r32uint` as `input_normal` is
83
84
  */
84
85
  graph_pass({
85
86
  graph,
@@ -87,7 +88,8 @@ export class GTAO {
87
88
  input_depth,
88
89
  input_hzb,
89
90
  input_normal,
90
- input_normal_previous,
91
+ input_pbr,
92
+ input_pbr_previous,
91
93
  input_velocity,
92
94
  input_occlusion,
93
95
  frame_index,
@@ -112,7 +114,7 @@ export class GTAO {
112
114
  let bent_normals = graph.create_resource("bent normals", TextureResourceDescriptor.from({
113
115
  resolution,
114
116
  dimension: "2d",
115
- format: "rg16uint",
117
+ format: "r32uint",
116
118
  usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT
117
119
  }));
118
120
 
@@ -166,7 +168,8 @@ export class GTAO {
166
168
  tVelocity: input_velocity,
167
169
  tOcclusion: input_occlusion,
168
170
  tNormal: input_normal,
169
- tNormalPrevious: input_normal_previous,
171
+ tPBR: input_pbr,
172
+ tPBRPrevious: input_pbr_previous,
170
173
  settings: {
171
174
  history_validity: history_valid ? 1 : 0,
172
175
  frame_index,
@@ -2,13 +2,13 @@
2
2
  * Accumulates GTAO over time: visibility, and the bend that makes the bent normal.
3
3
  *
4
4
  * The bend takes the history only where the history was written on this texel's surface, by the face normals of
5
- * `tNormalPrevious` — last frame's G-buffer normal — against this frame's.
5
+ * `tPBRPrevious` — last frame's G-buffer PBR target — against this frame's.
6
6
  *
7
7
  * `tInput`, `tHistory` and the first target are `rgba16float`: visibility in `x`, and in `yzw` the world-space
8
8
  * bend — the bent normal minus the shading normal. Each is clamped to this frame's 3x3 neighbourhood before it
9
9
  * blends, visibility to a box and the bend to a ball. The second target is the bent normal itself,
10
- * `normalize(shading normal + bend)`, octahedral in `rg16uint` as the G-buffer normal is, which is what lighting
11
- * reads.
10
+ * `normalize(shading normal + bend)`, packed into an `r32uint` as the G-buffer's shading normal is, which is what
11
+ * lighting reads.
12
12
  *
13
13
  * @type {ImageShader}
14
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ao_reproject_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/ao_reproject_shader.js"],"names":[],"mappings":"AAwRA;;;;;;;;;;;;;GAaG;AACH,kCAFU,WAAW,CAqBnB;4BA9S0B,6BAA6B"}
1
+ {"version":3,"file":"ao_reproject_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/ao_reproject_shader.js"],"names":[],"mappings":"AA6RA;;;;;;;;;;;;;GAaG;AACH,kCAFU,WAAW,CAqBnB;4BAhT0B,6BAA6B"}
@@ -1,5 +1,8 @@
1
1
  import { DEPTH_STENCIL_FOREGROUND_ONLY } from "../../depth/DEPTH_STENCIL_FOREGROUND_ONLY.js";
2
2
  import { chunk_decode_g_buffer_normal } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.js";
3
+ import {
4
+ chunk_decode_g_buffer_face_normal
5
+ } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_face_normal.js";
3
6
  import { chunk_encode_g_buffer_normal } from "../../shader/chunk/geometry/normal/chunk_encode_g_buffer_normal.js";
4
7
  import { chunk_f16_round_stochastic } from "../../shader/chunk/math/chunk_f16_round_stochastic.js";
5
8
  import { chunk_get_std_dev } from "../../shader/chunk/math/statistics/chunk_get_std_dev.js";
@@ -39,8 +42,10 @@ resources.createGroup()
39
42
  .addTexture("tVelocity")
40
43
  .addTexture("tOcclusion")
41
44
  .addTexture("tNormal", "uint")
42
- // last frame's G-buffer normal, at the size last frame was drawn at
43
- .addTexture("tNormalPrevious", "uint")
45
+ // the G-buffer's PBR target, for its face normal: this frame's, and last frame's at the size it was
46
+ // drawn at
47
+ .addTexture("tPBR")
48
+ .addTexture("tPBRPrevious")
44
49
  .addTexture("tHistory","float")
45
50
  .addSampler("sLinear", "filtering", SAMPLER_LINEAR_UPSCALE)
46
51
 
@@ -102,7 +107,7 @@ const SAME_SURFACE_COS = 0.70710678;
102
107
 
103
108
  // 1 where the history texel at tap was written on this texel's surface, by its face normal: last frame's
104
109
  fn history_texel_on_surface(tap: vec2<i32>, size: vec2<i32>, face_normal: vec3<f32>) -> f32 {
105
- let history_face_normal = decode_g_buffer_normal(textureLoad(tNormalPrevious, clamp(tap, vec2(0), size - 1), 0).zw);
110
+ let history_face_normal = decode_g_buffer_face_normal(textureLoad(tPBRPrevious, clamp(tap, vec2(0), size - 1), 0));
106
111
 
107
112
  return select(0.0, 1.0, dot(history_face_normal, face_normal) >= SAME_SURFACE_COS);
108
113
  }
@@ -110,7 +115,7 @@ fn history_texel_on_surface(tap: vec2<i32>, size: vec2<i32>, face_normal: vec3<f
110
115
  // The share of the history's bilinear footprint written on this texel's surface, read where the history is, in
111
116
  // the previous normal's own grid.
112
117
  fn history_surface_agreement(prev_uv: vec2<f32>, face_normal: vec3<f32>) -> f32 {
113
- let size = vec2<i32>(textureDimensions(tNormalPrevious));
118
+ let size = vec2<i32>(textureDimensions(tPBRPrevious));
114
119
 
115
120
  let st = prev_uv * vec2<f32>(size) - 0.5;
116
121
  let origin = vec2<i32>(floor(st));
@@ -137,7 +142,7 @@ struct Output {
137
142
  // visibility and the bend, accumulated: next frame's history
138
143
  @location(0) history: vec4<f32>,
139
144
  // the bent normal, octahedral as the G-buffer's normals are
140
- @location(1) bent_normal: vec2<u32>,
145
+ @location(1) bent_normal: u32,
141
146
  }
142
147
 
143
148
  @fragment
@@ -151,8 +156,7 @@ fn main(
151
156
 
152
157
  let occlusion_confidence = textureLoad(tOcclusion, screenST, 0).r;
153
158
  let current = textureLoad(tInput, screenST, 0);
154
- let encoded_normal = textureLoad(tNormal, screenST, 0);
155
- let shading_normal = decode_g_buffer_normal(encoded_normal.xy);
159
+ let shading_normal = decode_g_buffer_normal(textureLoad(tNormal, screenST, 0).x);
156
160
 
157
161
  // get velocity
158
162
  let velocity = taa_get_velocity( tVelocity, screenST );
@@ -233,7 +237,7 @@ fn main(
233
237
  // bend, which added to this surface's normal tilts the bent normal towards that surface: a line along
234
238
  // every crease. The bend takes the history only for the share written on this texel's own surface.
235
239
  // Visibility is not measured against the normal, and keeps all of it.
236
- let surface_agreement = history_surface_agreement(prev_uv, decode_g_buffer_normal(encoded_normal.zw));
240
+ let surface_agreement = history_surface_agreement(prev_uv, decode_g_buffer_face_normal(textureLoad(tPBR, screenST, 0)));
237
241
 
238
242
  resolved = vec4(
239
243
  mix(current.x, clamped_visibility, history_weight),
@@ -271,6 +275,7 @@ fn main(
271
275
  chunk_texture_sample_catmullrom_hardware_5tap_uv,
272
276
  chunk_get_std_dev,
273
277
  chunk_decode_g_buffer_normal,
278
+ chunk_decode_g_buffer_face_normal,
274
279
  chunk_encode_g_buffer_normal,
275
280
  chunk_f16_round_stochastic,
276
281
  chunk_pcg3d,
@@ -282,13 +287,13 @@ fn main(
282
287
  * Accumulates GTAO over time: visibility, and the bend that makes the bent normal.
283
288
  *
284
289
  * The bend takes the history only where the history was written on this texel's surface, by the face normals of
285
- * `tNormalPrevious` — last frame's G-buffer normal — against this frame's.
290
+ * `tPBRPrevious` — last frame's G-buffer PBR target — against this frame's.
286
291
  *
287
292
  * `tInput`, `tHistory` and the first target are `rgba16float`: visibility in `x`, and in `yzw` the world-space
288
293
  * bend — the bent normal minus the shading normal. Each is clamped to this frame's 3x3 neighbourhood before it
289
294
  * blends, visibility to a box and the bend to a ball. The second target is the bent normal itself,
290
- * `normalize(shading normal + bend)`, octahedral in `rg16uint` as the G-buffer normal is, which is what lighting
291
- * reads.
295
+ * `normalize(shading normal + bend)`, packed into an `r32uint` as the G-buffer's shading normal is, which is what
296
+ * lighting reads.
292
297
  *
293
298
  * @type {ImageShader}
294
299
  */
@@ -308,7 +313,7 @@ export const ao_reproject_shader = new ImageShader({
308
313
  },
309
314
  {
310
315
  label: "Bent Normals",
311
- format: "rg16uint",
316
+ format: "r32uint",
312
317
  },
313
318
  ]
314
319
  })
@@ -24,7 +24,7 @@ fn horizon_integrate_lighting_sample(
24
24
  let tex_coord = uv_to_texel_coordinate(uv, textureDimensions(tNormal).xy);
25
25
  let tex_coord_i = vec2<i32>(tex_coord);
26
26
 
27
- let sample_normal_ws = decode_g_buffer_normal(textureLoad(tNormal, tex_coord_i, 0).xy);
27
+ let sample_normal_ws = decode_g_buffer_normal(textureLoad(tNormal, tex_coord_i, 0).x);
28
28
 
29
29
  let cos_vis = dot(ref_normal, sample_normal_ws);
30
30
 
@@ -131,7 +131,7 @@ fn main(
131
131
  let position_vs = project_view_position_from_depth(uv, device_depth, camera.projection_matrix_inverse);
132
132
  let view_direction_vs = normalize(-position_vs);
133
133
 
134
- let view_normal_ws = decode_g_buffer_normal(textureLoad(tNormal, texel_position_u32, 0).xy); // shading normal
134
+ let view_normal_ws = decode_g_buffer_normal(textureLoad(tNormal, texel_position_u32, 0).x); // shading normal
135
135
 
136
136
  let noiseTexel = spatio_temporal_noise_r2_64(texel_position_u32, settings.frame_index, tNoise);
137
137
 
@@ -76,7 +76,7 @@ const STEPS = ${QUALITY_SETTINGS.steps};
76
76
 
77
77
  struct Output{
78
78
  @location(0) visibility: vec2<f32>, // first 2 moment
79
- @location(1) bent_normal: vec2<u32>, // octahedral encoding
79
+ @location(1) bent_normal: u32, // octahedral, packed (encode_g_buffer_normal)
80
80
  @location(2) irradiance: u32, // rgbe9995
81
81
  }
82
82
 
@@ -111,7 +111,7 @@ fn main(
111
111
  let view_position_ws = mat4_extract_position(camera.view_matrix_inverse);
112
112
  let view_direction_ws = normalize(view_position_ws - position_ws);
113
113
 
114
- let view_normal_ws = decode_g_buffer_normal(textureLoad(tNormal, texel_position_u32, 0).xy); // shading normal
114
+ let view_normal_ws = decode_g_buffer_normal(textureLoad(tNormal, texel_position_u32, 0).x); // shading normal
115
115
 
116
116
  let noiseTexel = spatio_temporal_noise_r2_64(texel_position_u32, settings.frame_index, tNoise);
117
117
 
@@ -418,8 +418,8 @@ export const fragment_shader_gtao_with_irradiance = new ImageShader({
418
418
  },
419
419
  {
420
420
  label: "Bent Normals",
421
- // Direction is encoded with octahedral
422
- format: "rg16uint",
421
+ // Direction is encoded with octahedral, packed (encode_g_buffer_normal)
422
+ format: "r32uint",
423
423
  },
424
424
  {
425
425
  label: "Irradiance",