@woosh/meep-engine 3.60.5 → 3.60.7

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 (376) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/package.json +1 -1
  4. package/src/core/binary/BitSet.d.ts.map +1 -1
  5. package/src/core/binary/BitSet.js +2 -1
  6. package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.d.ts +2 -2
  7. package/src/core/binary/operations/ceil_log2.d.ts.map +1 -0
  8. package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.js +18 -18
  9. package/src/core/binary/zstd/ZstdReverseBitReader.d.ts.map +1 -1
  10. package/src/core/binary/zstd/ZstdReverseBitReader.js +225 -223
  11. package/src/core/binary/zstd/zstd_fse.d.ts.map +1 -1
  12. package/src/core/binary/zstd/zstd_fse.js +267 -265
  13. package/src/core/binary/zstd/zstd_huffman.d.ts.map +1 -1
  14. package/src/core/binary/zstd/zstd_huffman.js +246 -244
  15. package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
  16. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +8 -2
  17. package/src/core/bvh2/bvh3/ebvh_optimize_treelet.d.ts.map +1 -1
  18. package/src/core/bvh2/bvh3/ebvh_optimize_treelet.js +8 -7
  19. package/src/core/collection/PairUint32Map.d.ts.map +1 -1
  20. package/src/core/collection/PairUint32Map.js +2 -2
  21. package/src/core/collection/Uint32Map.d.ts.map +1 -1
  22. package/src/core/collection/Uint32Map.js +2 -4
  23. package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -1
  24. package/src/core/collection/heap/FibonacciHeap.js +2 -1
  25. package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
  26. package/src/core/geom/2d/r-tree/StaticR2Tree.js +8 -2
  27. package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.d.ts.map +1 -1
  28. package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.js +2 -3
  29. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  30. package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -14
  31. package/src/engine/graphics/texture/atlas/sprite_atlas_border.d.ts.map +1 -1
  32. package/src/engine/graphics/texture/atlas/sprite_atlas_border.js +70 -69
  33. package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.d.ts.map +1 -1
  34. package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.js +2 -1
  35. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  36. package/src/engine/graphics3/GPUParticleEmitterSystem.js +2 -1
  37. package/src/engine/graphics3/decal/GPUDecalRenderer.d.ts.map +1 -1
  38. package/src/engine/graphics3/decal/GPUDecalRenderer.js +2 -1
  39. package/src/engine/graphics3/decal/chunk_decal_record.d.ts +14 -0
  40. package/src/engine/graphics3/decal/chunk_decal_record.d.ts.map +1 -0
  41. package/src/engine/graphics3/decal/chunk_decal_record.js +44 -0
  42. package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts.map +1 -1
  43. package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +2 -15
  44. package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts.map +1 -1
  45. package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +3 -16
  46. package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
  47. package/src/engine/graphics3/decal/shader_decal_composite.js +3 -23
  48. package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.d.ts.map +1 -1
  49. package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.js +2 -1
  50. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  51. package/src/engine/physics/queries/shape_cast.js +2 -2
  52. package/src/format/image/avif/av1/decode/decode_palette.js +442 -442
  53. package/src/format/image/avif/av1/entropy/SymbolWriter.d.ts.map +1 -1
  54. package/src/format/image/avif/av1/entropy/SymbolWriter.js +2 -1
  55. package/src/generation/foliage/material/foliage_tile.d.ts.map +1 -1
  56. package/src/generation/foliage/material/foliage_tile.js +2 -1
  57. package/src/shade/device/mock/SoftwareGPUDevice.d.ts.map +1 -1
  58. package/src/shade/device/mock/SoftwareGPUDevice.js +6 -13
  59. package/src/shade/playground/caldera/main.js +3 -2
  60. package/src/shade/playground/probe_clipmap/README.md +2 -1
  61. package/src/shade/playground/probe_clipmap/index.html +7 -2
  62. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  63. package/src/shade/playground/probe_clipmap/main.js +17 -7
  64. package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.d.ts.map +1 -1
  65. package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.js +7 -13
  66. package/src/shade/playground/vgeo_scene/main.js +2 -1
  67. package/src/shade/playground/vsm/VSMDebugOverlay.d.ts.map +1 -1
  68. package/src/shade/playground/vsm/VSMDebugOverlay.js +3 -1
  69. package/src/shade/renderer/Renderer.d.ts +11 -0
  70. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  71. package/src/shade/renderer/Renderer.js +43 -1
  72. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  73. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  74. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  75. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  76. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.d.ts.map +1 -1
  77. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.js +5 -4
  78. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.d.ts.map +1 -1
  79. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.js +168 -166
  80. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.d.ts.map +1 -1
  81. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.js +221 -219
  82. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  83. package/src/shade/renderer/fow/shader_fog_of_war.d.ts.map +1 -1
  84. package/src/shade/renderer/fow/shader_fog_of_war.js +8 -19
  85. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +26 -43
  86. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  87. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +115 -123
  88. package/src/shade/renderer/geometry/sdf/MeshSDFLayout.d.ts.map +1 -1
  89. package/src/shade/renderer/geometry/sdf/MeshSDFLayout.js +2 -1
  90. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +20 -2
  91. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
  92. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +66 -2
  93. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts +19 -0
  94. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts.map +1 -0
  95. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.js +25 -0
  96. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
  97. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +2 -1
  98. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
  99. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +2 -1
  100. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts +15 -0
  101. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts.map +1 -1
  102. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.js +38 -0
  103. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +28 -59
  104. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -1
  105. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +84 -789
  106. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.d.ts.map +1 -1
  107. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.js +10 -31
  108. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.d.ts.map +1 -1
  109. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.js +9 -15
  110. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts +2 -1
  111. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts.map +1 -1
  112. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.js +6 -5
  113. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.d.ts.map +1 -1
  114. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.js +2 -1
  115. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +15 -3
  116. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  117. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +168 -18
  118. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +2 -1
  119. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
  120. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +2 -1
  121. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +98 -57
  122. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  123. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +168 -77
  124. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +4 -2
  125. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  126. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +27 -12
  127. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
  128. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +12 -7
  129. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  130. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +8 -2
  131. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -2
  132. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -2
  133. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -1
  134. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +5 -2
  135. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +1 -1
  136. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
  137. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +5 -3
  138. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +1 -1
  139. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +1 -1
  141. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.d.ts.map +1 -1
  142. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.js +4 -2
  143. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.d.ts.map +1 -1
  144. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.js +1 -1
  145. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.d.ts.map +1 -1
  146. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.js +1 -1
  147. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.d.ts.map +1 -1
  148. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.js +3 -1
  149. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_cards.js +2 -2
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +114 -41
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +424 -207
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +34 -25
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +41 -31
  156. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts +7 -5
  157. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.js +7 -5
  159. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts +47 -0
  160. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts.map +1 -0
  161. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.js +84 -0
  162. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +48 -0
  163. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -0
  164. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +101 -0
  165. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +58 -4
  166. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  167. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +127 -30
  168. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts +18 -7
  169. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts.map +1 -1
  170. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.js +39 -13
  171. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts +29 -8
  172. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts.map +1 -1
  173. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +112 -56
  174. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts +19 -0
  175. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts.map +1 -0
  176. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.js +35 -0
  177. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  178. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +9 -3
  179. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +3 -3
  180. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +5 -5
  181. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +8 -12
  182. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
  183. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +23 -56
  184. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +0 -3
  185. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
  186. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +11 -15
  187. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts +26 -0
  188. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts.map +1 -0
  189. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.js +173 -0
  190. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts +32 -0
  191. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts.map +1 -0
  192. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.js +166 -0
  193. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +3 -4
  194. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  195. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +3 -4
  196. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -1
  197. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +3 -1
  198. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +6 -12
  199. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  200. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +15 -65
  201. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -1
  202. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +7 -2
  203. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +4 -4
  204. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
  205. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +24 -17
  206. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts +7 -5
  207. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts.map +1 -1
  208. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.js +18 -10
  209. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +2 -2
  210. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -1
  211. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +9 -5
  212. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts +3 -0
  213. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
  214. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +9 -6
  215. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts +1 -1
  216. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts.map +1 -1
  217. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.js +16 -16
  218. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts +36 -0
  219. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts.map +1 -0
  220. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.js +233 -0
  221. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  222. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +7 -5
  223. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
  224. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +5 -3
  225. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  226. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +10 -4
  227. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +2 -1
  228. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
  229. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +12 -6
  230. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +1 -2
  231. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
  232. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +5 -6
  233. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +14 -18
  234. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
  235. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +25 -35
  236. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts +13 -0
  237. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts.map +1 -0
  238. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.js +12 -0
  239. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts +27 -2
  240. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts.map +1 -1
  241. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.js +62 -6
  242. package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.d.ts.map +1 -1
  243. package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.js +10 -19
  244. package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.d.ts.map +1 -1
  245. package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.js +6 -3
  246. package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts.map +1 -1
  247. package/src/shade/renderer/hiz/hzb_pick_alignment.js +149 -148
  248. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.d.ts.map +1 -1
  249. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.js +4 -2
  250. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.d.ts.map +1 -1
  251. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.js +6 -5
  252. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.d.ts.map +1 -1
  253. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.js +3 -1
  254. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.d.ts.map +1 -1
  255. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.js +3 -1
  256. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.d.ts.map +1 -1
  257. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.js +3 -1
  258. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts +0 -5
  259. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts.map +1 -1
  260. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.js +0 -7
  261. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts +15 -2
  262. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts.map +1 -1
  263. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js +51 -16
  264. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts.map +1 -1
  265. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js +3 -2
  266. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  267. package/src/shade/renderer/material/GPUMaterialManager.d.ts +4 -1
  268. package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
  269. package/src/shade/renderer/material/GPUMaterialManager.js +5 -8
  270. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts +17 -0
  271. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts.map +1 -0
  272. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.js +81 -0
  273. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.d.ts.map +1 -1
  274. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js +5 -48
  275. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.d.ts.map +1 -1
  276. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js +4 -44
  277. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +7 -3
  278. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
  279. package/src/shade/renderer/postprocess/gtao/GTAO.js +26 -13
  280. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts +14 -0
  281. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  282. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +196 -68
  283. package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.d.ts.map +1 -1
  284. package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js +4 -1
  285. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
  286. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +42 -28
  287. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
  288. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +430 -414
  289. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts +16 -0
  290. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts.map +1 -0
  291. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.js +156 -0
  292. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  293. package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.d.ts.map +1 -1
  294. package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.js +5 -7
  295. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts +17 -0
  296. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts.map +1 -0
  297. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.js +56 -0
  298. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.d.ts.map +1 -1
  299. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.js +2 -22
  300. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.d.ts.map +1 -1
  301. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.js +2 -13
  302. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  303. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +10 -13
  304. package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.d.ts.map +1 -1
  305. package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.js +39 -38
  306. package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.d.ts.map +1 -1
  307. package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.js +7 -12
  308. package/src/shade/renderer/scene/GPUSceneContext.d.ts +2 -2
  309. package/src/shade/renderer/scene/GPUSceneContext.js +5 -5
  310. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts +8 -6
  311. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts.map +1 -1
  312. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js +10 -7
  313. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts +16 -0
  314. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts.map +1 -0
  315. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.js +35 -0
  316. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts +5 -2
  317. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts.map +1 -1
  318. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.js +27 -18
  319. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.d.ts.map +1 -1
  320. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.js +5 -15
  321. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.d.ts.map +1 -1
  322. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.js +5 -19
  323. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.d.ts.map +1 -1
  324. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.js +3 -22
  325. package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.d.ts.map +1 -1
  326. package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.js +2 -1
  327. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.d.ts.map +1 -1
  328. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.js +154 -152
  329. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
  330. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +2 -1
  331. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts +3 -1
  332. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts.map +1 -1
  333. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js +4 -3
  334. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts +7 -1
  335. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts.map +1 -1
  336. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.js +54 -47
  337. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts.map +1 -1
  338. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.js +371 -370
  339. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  340. package/src/shade/renderer/water/GPUWaterRenderer.js +2 -1
  341. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  342. package/src/shade/renderer/water/surface/lod/shader_water_lod.d.ts.map +1 -1
  343. package/src/shade/renderer/water/surface/lod/shader_water_lod.js +12 -14
  344. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  345. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +2 -9
  346. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  347. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +2 -1
  348. package/src/shade/renderer/wind/WIND_FIELD.d.ts +3 -1
  349. package/src/shade/renderer/wind/WIND_FIELD.d.ts.map +1 -1
  350. package/src/shade/renderer/wind/WIND_FIELD.js +4 -3
  351. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +8 -2
  352. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
  353. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +11 -4
  354. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -2
  355. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  356. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +13 -4
  357. package/src/shade/util/texture_mip_extent.d.ts.map +1 -1
  358. package/src/shade/util/texture_mip_extent.js +88 -87
  359. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  360. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +9 -7
  361. package/src/format/image/avif/av1/util/ceil_log2.d.ts.map +0 -1
  362. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +0 -47
  363. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +0 -1
  364. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +0 -80
  365. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +0 -16
  366. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +0 -1
  367. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +0 -67
  368. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +0 -17
  369. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +0 -1
  370. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +0 -145
  371. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +0 -12
  372. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +0 -1
  373. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +0 -105
  374. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts +0 -1
  375. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts.map +0 -1
  376. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.js +0 -0
@@ -1,10 +1,11 @@
1
+ import { TextureResourceDescriptor } from "../../../device/graph/TextureResourceDescriptor.js";
1
2
  import { graph_image_pass } from "../../shader/graph/graph_image_pass.js";
2
3
  import { graph_import_texture } from "../../shader/graph/graph_import_texture.js";
3
4
  import { GPUTextureContext } from "../../texture/GPUTextureContext.js";
4
- import { shader_denoise_luminance_spatial } from "../denoise/fragment_shader_denoise_ao.js";
5
5
  import { ao_reproject_shader } from "./ao_reproject_shader.js";
6
6
  import { fragment_shader_gtao } from "./fragment_shader_gtao.js";
7
7
  import { shader_ao_composit } from "./graph_composit_ao_to_gBuffer.js";
8
+ import { shader_gtao_spatial_denoise } from "./shader_gtao_spatial_denoise.js";
8
9
 
9
10
  /**
10
11
  * @typedef {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} PipelineEnquiry
@@ -40,7 +41,8 @@ export class GTAO {
40
41
  for (let i = 0; i < 2; i++) {
41
42
  const texture = new GPUTextureContext(graphics.device);
42
43
 
43
- texture.descriptor.format = "rg16float";
44
+ // visibility, and the bend: the bent normal minus the shading normal
45
+ texture.descriptor.format = "rgba16float";
44
46
  texture.descriptor.usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT;
45
47
 
46
48
  this.#history[i] = texture;
@@ -54,7 +56,7 @@ export class GTAO {
54
56
  */
55
57
  enquirePipelines(enquiry) {
56
58
  enquiry.render.push(fragment_shader_gtao.pipeline);
57
- enquiry.render.push(shader_denoise_luminance_spatial.pipeline);
59
+ enquiry.render.push(shader_gtao_spatial_denoise.pipeline);
58
60
  enquiry.render.push(ao_reproject_shader.pipeline);
59
61
  enquiry.render.push(shader_ao_composit.pipeline);
60
62
  }
@@ -67,14 +69,17 @@ export class GTAO {
67
69
  * @param {number} options.input_depth this frame's depth
68
70
  * @param {number} options.input_hzb hierarchical depth built from it
69
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
70
74
  * @param {number} options.input_velocity per-pixel velocity, in this frame's pixels
71
75
  * @param {number} options.input_occlusion depth-clip pass output: history confidence in r
72
76
  * @param {number} options.frame_index the renderer's frame counter: drives the noise, the history
73
77
  * ping-pong, and whether the history follows on from the last frame drawn
74
78
  * @param {number} options.output G-buffer albedo; AO is blended into its alpha
75
79
  * @param {number[]} options.resolution this frame's render size
76
- * @returns {{visibility:number, occlusion:number, bent_normals:number}} the accumulated visibility
77
- * moments, `output` after the composite, and the raw bent normals
80
+ * @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
78
83
  */
79
84
  graph_pass({
80
85
  graph,
@@ -82,6 +87,7 @@ export class GTAO {
82
87
  input_depth,
83
88
  input_hzb,
84
89
  input_normal,
90
+ input_normal_previous,
85
91
  input_velocity,
86
92
  input_occlusion,
87
93
  frame_index,
@@ -102,8 +108,15 @@ export class GTAO {
102
108
  const moments_history = graph_import_texture(graph, h0, "ao_history");
103
109
  const moments_output = graph_import_texture(graph, h1, "ao_output");
104
110
 
111
+ // written by the reprojection beside the history, so it is asked of the graph rather than of a pass
112
+ let bent_normals = graph.create_resource("bent normals", TextureResourceDescriptor.from({
113
+ resolution,
114
+ dimension: "2d",
115
+ format: "rg16uint",
116
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT
117
+ }));
105
118
 
106
- const [raw_occlusion, raw_bent_normals] = graph_image_pass({
119
+ const [raw_occlusion] = graph_image_pass({
107
120
  graph,
108
121
  shader: fragment_shader_gtao,
109
122
  output_resolution: resolution,
@@ -126,16 +139,13 @@ export class GTAO {
126
139
  // apply small spatial denoise
127
140
  [moments] = graph_image_pass({
128
141
  graph,
129
- shader: shader_denoise_luminance_spatial,
142
+ shader: shader_gtao_spatial_denoise,
130
143
  output_resolution: resolution,
131
144
  input_depth,
132
145
  inputs: {
133
146
  tInput: moments,
134
147
  tDepth: input_depth,
135
148
  tNormal: input_normal,
136
- settings: {
137
- step_size: 1,
138
- }
139
149
  }
140
150
  });
141
151
 
@@ -145,18 +155,21 @@ export class GTAO {
145
155
  this.reset_history = false;
146
156
  this.#history_frame_index = frame_index;
147
157
 
148
- [moments] = graph_image_pass({
158
+ [moments, bent_normals] = graph_image_pass({
149
159
  graph,
150
160
  shader: ao_reproject_shader,
151
- output: [moments_output],
161
+ output: [moments_output, bent_normals],
152
162
  input_depth,
153
163
  inputs: {
154
164
  tInput: moments,
155
165
  tHistory: moments_history,
156
166
  tVelocity: input_velocity,
157
167
  tOcclusion: input_occlusion,
168
+ tNormal: input_normal,
169
+ tNormalPrevious: input_normal_previous,
158
170
  settings: {
159
171
  history_validity: history_valid ? 1 : 0,
172
+ frame_index,
160
173
  },
161
174
  }
162
175
  });
@@ -179,7 +192,7 @@ export class GTAO {
179
192
  return {
180
193
  visibility: moments,
181
194
  occlusion: filtered_occlusion,
182
- bent_normals: raw_bent_normals,
195
+ bent_normals: bent_normals,
183
196
  };
184
197
  }
185
198
  }
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Accumulates GTAO over time: visibility, and the bend that makes the bent normal.
3
+ *
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.
6
+ *
7
+ * `tInput`, `tHistory` and the first target are `rgba16float`: visibility in `x`, and in `yzw` the world-space
8
+ * bend — the bent normal minus the shading normal. Each is clamped to this frame's 3x3 neighbourhood before it
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.
12
+ *
13
+ * @type {ImageShader}
14
+ */
1
15
  export const ao_reproject_shader: ImageShader;
2
16
  import { ImageShader } from "../../shader/ImageShader.js";
3
17
  //# sourceMappingURL=ao_reproject_shader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ao_reproject_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/ao_reproject_shader.js"],"names":[],"mappings":"AA4KA,8CAaE;4BAnL0B,6BAA6B"}
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,5 +1,10 @@
1
1
  import { DEPTH_STENCIL_FOREGROUND_ONLY } from "../../depth/DEPTH_STENCIL_FOREGROUND_ONLY.js";
2
+ import { chunk_decode_g_buffer_normal } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.js";
3
+ import { chunk_encode_g_buffer_normal } from "../../shader/chunk/geometry/normal/chunk_encode_g_buffer_normal.js";
4
+ import { chunk_f16_round_stochastic } from "../../shader/chunk/math/chunk_f16_round_stochastic.js";
2
5
  import { chunk_get_std_dev } from "../../shader/chunk/math/statistics/chunk_get_std_dev.js";
6
+ import { chunk_hash_to_float01 } from "../../shader/chunk/random/chunk_hash_to_float01.js";
7
+ import { chunk_pcg3d } from "../../shader/chunk/random/pcg/chunk_pcg3d.js";
3
8
  import {
4
9
  chunk_texture_sample_catmullrom_hardware_5tap_uv
5
10
  } from "../../shader/chunk/texture/sample/chunk_texture_sample_catmullrom_hardware_5tap_uv.js";
@@ -8,107 +13,174 @@ import { ImageShader } from "../../shader/ImageShader.js";
8
13
  import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
9
14
  import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
10
15
  import { SAMPLER_LINEAR_UPSCALE } from "../../texture/SAMPLER_LINEAR_UPSCALE.js";
11
- import { f32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
16
+ import { f32, u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
12
17
  import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
13
18
  import { chunk_taa_velocity_confidence } from "../taa/shader_taa.js";
14
19
  import { chunk_taa_get_velocity } from "../velocity/chunk_taa_get_velocity.js";
15
20
 
16
21
  const AO_REPROJECT_SETTINGS_STRUCT = WebGPUStruct.from({
17
22
  /**
18
- * 1 to blend against the history, 0 to take this frame's moments alone: the first frame, a reset,
19
- * or a frame that does not follow the one the history was written on.
23
+ * 1 to blend against the history, 0 to take this frame's alone: the first frame, a reset, or a frame that
24
+ * does not follow the one the history was written on.
20
25
  */
21
26
  history_validity: f32,
27
+ /**
28
+ * Seeds the stochastic rounding of the history's store, fresh each frame.
29
+ */
30
+ frame_index: u32,
22
31
  });
23
32
 
24
33
  const resources = new ShaderResourceSetDescriptor();
25
34
 
26
- // per-pass, 4 bytes, read-only: immediate data rather than a uniform buffer.
35
+ // per-pass, 8 bytes, read-only: immediate data rather than a uniform buffer.
27
36
  resources.setImmediate("settings", AO_REPROJECT_SETTINGS_STRUCT);
28
37
  resources.createGroup()
29
38
  .addTexture("tInput")
30
39
  .addTexture("tVelocity")
31
40
  .addTexture("tOcclusion")
41
+ .addTexture("tNormal", "uint")
42
+ // last frame's G-buffer normal, at the size last frame was drawn at
43
+ .addTexture("tNormalPrevious", "uint")
32
44
  .addTexture("tHistory","float")
33
45
  .addSampler("sLinear", "filtering", SAMPLER_LINEAR_UPSCALE)
34
46
 
35
47
  const body = CodeChunk.from(
36
48
  //language=WGSL
37
49
  `
38
- fn compute_center_moments(
39
- input_center: vec2<f32>,
50
+ struct NeighbourhoodStatistics {
51
+ // visibility's first two moments
52
+ moments: vec2<f32>,
53
+ // the bend's mean, and the mean of its squared length
54
+ bend: vec3<f32>,
55
+ bend_square: f32,
56
+ }
57
+
58
+ fn compute_center_statistics(
59
+ input_center: vec4<f32>,
40
60
  input_coord: vec2<i32>,
41
61
  input_texture: texture_2d<f32>,
42
- ) -> vec2<f32>{
43
-
62
+ ) -> NeighbourhoodStatistics {
63
+
44
64
  const offsets = array< vec2<i32>, 8 >(
45
65
  vec2( -1, -1 ),
46
66
  vec2( 0, -1 ),
47
- vec2( 1, -1 ),
48
-
49
- vec2( -1, 0 ),
50
- vec2( 1, 0 ),
51
-
67
+ vec2( 1, -1 ),
68
+
69
+ vec2( -1, 0 ),
70
+ vec2( 1, 0 ),
71
+
52
72
  vec2( -1, 1 ),
53
- vec2( 0, 1 ),
54
- vec2( 1, 1 ),
73
+ vec2( 0, 1 ),
74
+ vec2( 1, 1 ),
55
75
  );
56
-
76
+
57
77
  const iteratorMax = 8;
58
78
  const rcp_divider = 1.f / 9.f;
59
79
 
60
80
  var moments = vec2(input_center.x, input_center.x * input_center.x);
61
-
81
+
82
+ var bend = input_center.yzw;
83
+ var bend_square = dot(input_center.yzw, input_center.yzw);
84
+
62
85
  for (var i = 0; i < iteratorMax; i++ ) {
63
86
  let new_st = input_coord + offsets[ i ];
64
87
 
65
- let texel = textureLoad(input_texture, new_st, 0 ).rg;
66
-
88
+ let texel = textureLoad(input_texture, new_st, 0 );
89
+
67
90
  moments += vec2(texel.x, texel.x * texel.x);
91
+ bend += texel.yzw;
92
+ bend_square += dot(texel.yzw, texel.yzw);
68
93
  }
69
-
70
- return moments * rcp_divider;
94
+
95
+ return NeighbourhoodStatistics(moments * rcp_divider, bend * rcp_divider, bend_square * rcp_divider);
96
+ }
97
+
98
+ // A face this far from another is another surface: half a right angle, as UE's Lumen takes it
99
+ // (r.Lumen.ScreenProbeGather.Temporal.NormalThreshold). A tessellated curve's faces sit well inside it, a
100
+ // crease's well outside.
101
+ const SAME_SURFACE_COS = 0.70710678;
102
+
103
+ // 1 where the history texel at tap was written on this texel's surface, by its face normal: last frame's
104
+ 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);
106
+
107
+ return select(0.0, 1.0, dot(history_face_normal, face_normal) >= SAME_SURFACE_COS);
108
+ }
109
+
110
+ // The share of the history's bilinear footprint written on this texel's surface, read where the history is, in
111
+ // the previous normal's own grid.
112
+ fn history_surface_agreement(prev_uv: vec2<f32>, face_normal: vec3<f32>) -> f32 {
113
+ let size = vec2<i32>(textureDimensions(tNormalPrevious));
114
+
115
+ let st = prev_uv * vec2<f32>(size) - 0.5;
116
+ let origin = vec2<i32>(floor(st));
117
+ let f = st - floor(st);
118
+
119
+ let weights = vec4(
120
+ (1.0 - f.x) * (1.0 - f.y),
121
+ f.x * (1.0 - f.y),
122
+ (1.0 - f.x) * f.y,
123
+ f.x * f.y,
124
+ );
125
+
126
+ let on_surface = vec4(
127
+ history_texel_on_surface(origin, size, face_normal),
128
+ history_texel_on_surface(origin + vec2(1, 0), size, face_normal),
129
+ history_texel_on_surface(origin + vec2(0, 1), size, face_normal),
130
+ history_texel_on_surface(origin + vec2(1, 1), size, face_normal),
131
+ );
132
+
133
+ return dot(weights, on_surface);
134
+ }
135
+
136
+ struct Output {
137
+ // visibility and the bend, accumulated: next frame's history
138
+ @location(0) history: vec4<f32>,
139
+ // the bent normal, octahedral as the G-buffer's normals are
140
+ @location(1) bent_normal: vec2<u32>,
71
141
  }
72
142
 
73
143
  @fragment
74
144
  fn main(
75
145
  @builtin(position) coord: vec4<f32>,
76
146
  @location(0) uv: vec2<f32>,
77
- ) -> @location(0) vec2<f32> {
147
+ ) -> Output {
78
148
  let screenST = vec2<i32>( coord.xy );
79
-
149
+
80
150
  let resolution = textureDimensions(tInput);
81
-
151
+
82
152
  let occlusion_confidence = textureLoad(tOcclusion, screenST, 0).r;
83
- let current_moments = textureLoad(tInput, screenST, 0).rg;
84
-
153
+ 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);
156
+
85
157
  // get velocity
86
158
  let velocity = taa_get_velocity( tVelocity, screenST );
87
-
159
+
88
160
  let velocity_confidence = taa_velocity_confidence(velocity);
89
-
90
-
161
+
162
+
91
163
  // prev frame ST
92
164
  let prevFrameScreenST = coord.xy - velocity.xy;
93
-
165
+
94
166
  const MIN_VARIANCE = 0.5f; // under motion
95
167
  const MAX_VARIANCE = 1.2f; // no motion
96
168
 
97
169
  let variance_scale = mix( MIN_VARIANCE, MAX_VARIANCE, velocity_confidence * velocity_confidence ) ;
98
-
99
-
170
+
171
+
100
172
  let history_within_screen = all( prevFrameScreenST >= vec2(0.0) ) && all( prevFrameScreenST < vec2f(resolution )) ;
101
-
102
-
173
+
174
+
103
175
  let confidence = velocity_confidence * occlusion_confidence * select(0.0, 1.0,history_within_screen) * settings.history_validity;
104
176
 
105
-
106
- var output: vec2<f32>;
107
-
177
+
178
+ var resolved: vec4<f32>;
179
+
108
180
  if(
109
181
  confidence <= 0.001
110
182
  ) {
111
- output = current_moments;
183
+ resolved = current;
112
184
  }else{
113
185
 
114
186
  // a uv over this frame's size: the history keeps the size it was written at across a
@@ -116,51 +188,81 @@ fn main(
116
188
  let prev_uv = prevFrameScreenST / vec2<f32>(resolution);
117
189
 
118
190
  let history = texture_sample_catmullrom_hardware_5tap_uv(tHistory, sLinear, prev_uv);
119
- let history_moments = history.rg;
120
191
 
121
192
  // AABB sigma is calibrated against the spatially pre-filtered input.
122
193
  // The small spatial denoise upstream is what makes this clamp meaningful:
123
194
  // it stabilises the neighbourhood so the AABB is a tight, non-jittery
124
195
  // ghosting bound rather than chasing per-frame noise. (Standard
125
196
  // pre-blur-then-clamp pattern from SVGF-style and TAA literature.)
126
- let filtered_center_moments = compute_center_moments( current_moments, screenST, tInput);
197
+ let statistics = compute_center_statistics( current, screenST, tInput);
127
198
 
128
- let sigma = get_std_dev(filtered_center_moments.x, filtered_center_moments.y) * variance_scale;
199
+ let sigma = get_std_dev(statistics.moments.x, statistics.moments.y) * variance_scale;
129
200
 
130
201
  // clamp history mean to neighborhood AABB
131
- let input_min = filtered_center_moments.x - sigma ;
132
- let input_max = filtered_center_moments.x + sigma ;
202
+ let clamped_visibility = clamp(history.x, statistics.moments.x - sigma, statistics.moments.x + sigma);
203
+
204
+ // The bend is clamped to a ball about the neighbourhood's mean bend, its radius the same multiple of
205
+ // the bend's deviation as the visibility's box takes of its own. The bend is not a unit vector, so its
206
+ // variance has no cancellation to fight: a neighbourhood of one value has none, and clamps the history
207
+ // onto it.
208
+ let bend_variance = max(statistics.bend_square - dot(statistics.bend, statistics.bend), 0.0);
209
+ let bend_radius = sqrt(bend_variance) * variance_scale;
133
210
 
134
- let clamped_history_m1 = clamp(history_moments.x, input_min, input_max);
211
+ let bend_offset = history.yzw - statistics.bend;
212
+ let bend_offset_length = length(bend_offset);
135
213
 
136
- // Preserve history's variance under the mean clamp:
137
- // m2 = E[X²] = E[X]² + Var(X), so adjust m2 to track the clamped mean while
138
- // retaining the variance the temporal accumulator has built up.
139
- let history_variance = max(history_moments.y - history_moments.x * history_moments.x, 0.0);
140
- let clamped_history_m2 = clamped_history_m1 * clamped_history_m1 + history_variance;
214
+ // past the radius the offset's length is positive, so the division is safe where it is taken
215
+ let clamped_bend = select(
216
+ history.yzw,
217
+ statistics.bend + bend_offset * (bend_radius / bend_offset_length),
218
+ bend_offset_length > bend_radius
219
+ );
141
220
 
142
- // Note: deliberately do NOT gate history_weight on history_variance.
221
+ // Note: deliberately do NOT gate history_weight on the neighbourhood's variance.
143
222
  // Mixing a clamped history mean with a current mean injects cross-term
144
223
  // variance (w·(1-w)·(Δmean)²) that compounds through the EMA whenever
145
224
  // history hasn't converged. Letting that drive history_confidence down
146
- // collapses temporal accumulation. The AABB clamp already constrains
147
- // ghosting; rely on it instead and trust history at a fixed rate.
225
+ // collapses temporal accumulation. The clamps already constrain
226
+ // ghosting; rely on them instead and trust history at a fixed rate.
148
227
  const HISTORY_WEIGHT_MAX = 0.95;
149
228
 
150
229
  let history_weight = HISTORY_WEIGHT_MAX * occlusion_confidence;
151
230
 
152
- let resolved = mix(
153
- current_moments,
154
- vec2(clamped_history_m1, clamped_history_m2),
155
- history_weight
156
- );
231
+ // A bend means something only against the normal it was measured on. A texel on a crease lands on
232
+ // either side from frame to frame as the projection jitters, so its history holds the other surface's
233
+ // bend, which added to this surface's normal tilts the bent normal towards that surface: a line along
234
+ // every crease. The bend takes the history only for the share written on this texel's own surface.
235
+ // 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));
157
237
 
158
- output = resolved;
238
+ resolved = vec4(
239
+ mix(current.x, clamped_visibility, history_weight),
240
+ mix(current.yzw, clamped_bend, history_weight * surface_agreement),
241
+ );
159
242
 
160
243
  }
161
-
162
-
163
- return output;
244
+
245
+ // Halves round toward zero on the devices measured, so a blend stored as one stalls short of its target by
246
+ // up to a ULP over the history's 5% step. Rounded stochastically, it lands on its target in expectation.
247
+ let hash = pcg3d(vec3<u32>(vec2<u32>(screenST), settings.frame_index));
248
+ let noise = vec4<f32>(
249
+ hash_to_float01(hash.x),
250
+ hash_to_float01(hash.y),
251
+ hash_to_float01(hash.z),
252
+ hash_to_float01(pcg3d(hash).x),
253
+ );
254
+
255
+ // The bend rides on this frame's own shading normal, so the history adds nothing of the normal map's detail
256
+ // of the texels it was resampled from. An extreme bend can cancel the normal; the normal stands in then.
257
+ let bent = shading_normal + resolved.yzw;
258
+ let bent_length = length(bent);
259
+
260
+ var out: Output;
261
+
262
+ out.history = f16_round_stochastic(resolved, noise);
263
+ out.bent_normal = encode_g_buffer_normal(select(shading_normal, bent / bent_length, bent_length > 1e-4));
264
+
265
+ return out;
164
266
  }
165
267
  `,
166
268
  [
@@ -168,8 +270,28 @@ fn main(
168
270
  chunk_taa_velocity_confidence,
169
271
  chunk_texture_sample_catmullrom_hardware_5tap_uv,
170
272
  chunk_get_std_dev,
273
+ chunk_decode_g_buffer_normal,
274
+ chunk_encode_g_buffer_normal,
275
+ chunk_f16_round_stochastic,
276
+ chunk_pcg3d,
277
+ chunk_hash_to_float01,
171
278
  ]
172
279
  );
280
+
281
+ /**
282
+ * Accumulates GTAO over time: visibility, and the bend that makes the bent normal.
283
+ *
284
+ * 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.
286
+ *
287
+ * `tInput`, `tHistory` and the first target are `rgba16float`: visibility in `x`, and in `yzw` the world-space
288
+ * bend — the bent normal minus the shading normal. Each is clamped to this frame's 3x3 neighbourhood before it
289
+ * 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.
292
+ *
293
+ * @type {ImageShader}
294
+ */
173
295
  export const ao_reproject_shader = new ImageShader({
174
296
  descriptor: ShaderDescriptor.from({
175
297
  label: "AO Reproject",
@@ -177,10 +299,16 @@ export const ao_reproject_shader = new ImageShader({
177
299
  resources,
178
300
  }),
179
301
  depthStencil: DEPTH_STENCIL_FOREGROUND_ONLY,
180
- targets: [{
181
- format: "rg16float",
182
- // Background is skipped, so it keeps the clear: moments of visibility 1 (not occluded), zero variance.
183
- // This is also next frame's history, whose filtered fetch reaches across silhouettes.
184
- clearValue: [1, 1],
185
- }]
186
- })
302
+ targets: [
303
+ {
304
+ format: "rgba16float",
305
+ // Background is skipped, so it keeps the clear: not occluded, not bent.
306
+ // This is also next frame's history, whose filtered fetch reaches across silhouettes.
307
+ clearValue: [1, 0, 0, 0],
308
+ },
309
+ {
310
+ label: "Bent Normals",
311
+ format: "rg16uint",
312
+ },
313
+ ]
314
+ })
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_integrate_lighting_sample.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js"],"names":[],"mappings":"AAIA,gEA6CC;0BAhDyB,oCAAoC"}
1
+ {"version":3,"file":"chunk_integrate_lighting_sample.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js"],"names":[],"mappings":"AAIA,gEAgDC;0BAnDyB,oCAAoC"}
@@ -34,7 +34,10 @@ fn horizon_integrate_lighting_sample(
34
34
  }
35
35
 
36
36
  // see "Horizon-Based Indirect Lighting (HBIL)" equation 18
37
- let occlusion = integrate_solid_angle(_integrant, h0, h1);
37
+ // integrate_solid_angle integrates from its first angle to its second. The band this sample blocks runs from
38
+ // the new horizon, nearer the view ray, out to the previous one, so in that order it comes out positive; the
39
+ // other way round both terms flip, and a caller's choice of integrant can only undo that for the tangent's.
40
+ let occlusion = integrate_solid_angle(_integrant, h1, h0);
38
41
 
39
42
  let sample_color = textureLoad(tColor, tex_coord_i, 0).rgb ;
40
43
 
@@ -1 +1 @@
1
- {"version":3,"file":"fragment_shader_gtao.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js"],"names":[],"mappings":"AA2VA,+CA6BG;4BAzWyB,6BAA6B"}
1
+ {"version":3,"file":"fragment_shader_gtao.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js"],"names":[],"mappings":"AA6WA,+CAyBG;4BAxXyB,6BAA6B"}