@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,16 +1,17 @@
1
+ import { chunk_rgbe9995_decode } from "../../../shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.js";
1
2
  import { chunk_multiscale_mean } from "../../../shader/chunk/filter/chunk_multiscale_mean.js";
2
3
  import { MULTISCALE_MEAN_STRUCT } from "../../../shader/chunk/filter/MULTISCALE_MEAN_STRUCT.js";
3
4
  import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
4
5
  import { chunk_index_to_grid2d } from "../../../shader/chunk/grid/chunk_index_to_grid2d.js";
6
+ import { chunk_divide_round_up_u32 } from "../../../shader/chunk/math/chunk_divide_round_up_u32.js";
5
7
  import { chunk_f16_round_stochastic } from "../../../shader/chunk/math/chunk_f16_round_stochastic.js";
6
- import { chunk_rgbe9995_decode } from "../../../shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.js";
7
8
  import { F16_MAX_DEFINITION } from "../../../shader/chunk/math/F16_MAX_DEFINITION.js";
8
9
  import { chunk_hash_to_float01 } from "../../../shader/chunk/random/chunk_hash_to_float01.js";
9
10
  import { chunk_pcg3d } from "../../../shader/chunk/random/pcg/chunk_pcg3d.js";
10
11
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
11
12
  import { ComputeShader } from "../../../shader/ComputeShader.js";
12
13
  import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
13
- import { f32, u32 } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
14
+ import { u32 } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
14
15
  import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
15
16
  import { BRICK_TRACE_MISS, BRICK_TRACE_UNRESOLVED } from "../brick/BRICK_CLIPMAP.js";
16
17
  import {
@@ -27,7 +28,6 @@ import {
27
28
  PROBE_RAY_STRUCT,
28
29
  PROBE_RAY_SUMS_READ_RESOURCE,
29
30
  PROBE_RAYS_READ_RESOURCE,
30
- PROBE_RECORDS_READ_RESOURCE,
31
31
  PROBE_RESAMPLES_READ_RESOURCE,
32
32
  PROBE_STATES_READ_RESOURCE,
33
33
  PROBE_TRACE_READ_RESOURCE
@@ -39,7 +39,9 @@ import {
39
39
  PROBE_DEPTH_LIMIT,
40
40
  PROBE_DEPTH_TEXEL_RAYS,
41
41
  PROBE_RADIANCE_SAMPLES_LIMIT,
42
- PROBE_THREAD_WORKGROUP_SIZE
42
+ PROBE_SHORT_BLEND,
43
+ PROBE_THREAD_WORKGROUP_SIZE,
44
+ PROBE_VARIANCE_BLEND
43
45
  } from "./PROBE_CLIPMAP.js";
44
46
 
45
47
  /**
@@ -56,12 +58,10 @@ export const PROBE_ACCUMULATE_SETTINGS = WebGPUStruct.from({
56
58
  depth_resolution: u32,
57
59
  /** tiles a row of the radiance atlas */
58
60
  radiance_tiles_per_row: u32,
61
+ /** texels of skirt around a radiance tile's map on each side: 1, or 0 for a clipmap whose radiance is never sampled */
62
+ radiance_skirt: u32,
59
63
  /** tiles a row of the depth atlas */
60
64
  depth_tiles_per_row: u32,
61
- /** the frame, of the frames the clipmap has recorded */
62
- frame: u32,
63
- /** the short mean's response, τ, in frames; the depth's blend's */
64
- response_frames: f32,
65
65
  /** updates between a probe's uniform ones, `PROBE_UNIFORM_PERIOD` */
66
66
  uniform_period: u32,
67
67
  }, "ProbeAccumulateSettings");
@@ -76,7 +76,6 @@ resources.createGroup()
76
76
  .add(PROBE_RAYS_READ_RESOURCE)
77
77
  .add(PROBE_RAY_SUMS_READ_RESOURCE)
78
78
  .add(PROBE_STATES_READ_RESOURCE)
79
- .add(PROBE_RECORDS_READ_RESOURCE)
80
79
  .add(PROBE_GUIDE_READ_RESOURCE)
81
80
  .add(PROBE_MAPS_WRITE_RESOURCE)
82
81
  .add(PROBE_RADIANCE_HISTORY_RESOURCE)
@@ -103,13 +102,12 @@ resources.createGroup()
103
102
  * - **Radiance**: the mean of the texel's resolved rays, a back face's being zero, is a sample of the
104
103
  * texel's multi-scale mean (`chunk_multiscale_mean`), its estimator in `probe_estimators` and its mean
105
104
  * in the atlas.
106
- * - Δt and τ are frames: Δt since the probe's last update, τ `response_frames`.
107
- * - The short mean blends by β = max(1/(a+1), 1 − e^(−Δt·p/τ)), its variance by the same with 2τ. a is
108
- * the texel's own count of the updates that reached it, held in its alpha; p the updates between a
109
- * texel's rays: one over the share of updates that reach it, averaged over the uniform period
110
- * (`probe_clipmap_guide_rate`), n_r²/R below one ray a texel when every update is uniform. A texel
111
- * the guide passes over thus blends what it takes as fully as its rarity asks. Counting a texel
112
- * rather than the probe keeps β right where an update covers a subset.
105
+ * - The short mean blends by β = max(1/(a+1), `PROBE_SHORT_BLEND`), its variance by max(1/(a+1),
106
+ * `PROBE_VARIANCE_BLEND`), a the texel's own count of the updates that reached it, held in its alpha.
107
+ * A sample's blend is a sample's however long since the last one: a probe nobody wanted, or a texel the
108
+ * guide passes over, takes no more of its next sample for the wait. A change in the light is the
109
+ * estimator's to find. Counting a texel rather than the probe keeps β right where an update covers a
110
+ * subset.
113
111
  * - The mean blends by at least 1/(a+1) until the count reaches its limit: a young texel is its running
114
112
  * mean, which the estimator's blend reduction, nothing at its seed, would otherwise hold back. Past it
115
113
  * the estimator alone, down to 1/8192 an update on a noisy texel.
@@ -118,20 +116,17 @@ resources.createGroup()
118
116
  * - A texel's first sample seeds both means. A texel no ray reached keeps its history.
119
117
  * - Where the frame re-samples (`PROBE_CLIPMAP_RESAMPLING`), the sample pools the rays with the texel's
120
118
  * re-samples of the probe's neighbours (`shader_probe_clipmap_resample`), each a ray's worth at a
121
- * visibility of one (`chunk_probe_clipmap_resampled`). Only a texel some ray reached takes them: its
122
- * time terms are a sampled texel's.
119
+ * visibility of one (`chunk_probe_clipmap_resampled`). Only a texel some ray reached takes them.
123
120
  * - **Depth**: the moments (d, d²) of the rays landing in the texel, in spacings: a miss the limit, a
124
121
  * back face 0.2·t (DDGI 2021's shortening), a hit t, every sample held to the limit, the farthest a
125
122
  * cage tests a relocated probe, (1 + 0.45)·√3 (`PROBE_DEPTH_LIMIT`, D9). On a uniform update the
126
- * sample is the plain mean, blended by the probe's α = max(1/(n+1), 1 − e^(−Δt/τ)), n its updates. At
123
+ * sample is the plain mean, blended by the probe's α = max(1/(n+1), `PROBE_SHORT_BLEND`), n its updates. At
127
124
  * most 64 rays a texel, which the settings hold R to (R ≤ 64·n_d²).
128
125
  * - On a guided update the sample is a mean of means: each radiance texel inside the depth texel gives
129
126
  * its own mean, since the guide gives the brighter ones more rays, at most 64/f² of its rays,
130
127
  * evenly strided. It is taken only when every one of them took rays. The guide gives a dark one,
131
128
  * a back face's or a shadowed wall's, none, and the lit ones' depths are not the whole texel's: its
132
129
  * depth comes from the uniform updates.
133
- * - The time term's period is one over the share of updates that reach the depth texel, a uniform
134
- * update counting as reaching every one, a guided one as often as its least reached radiance texel.
135
130
  * - **A new probe's history is another probe's**, its slot's last owner: on its first update a texel
136
131
  * no ray reached is cleared, radiance to nothing seen, depth to the moments of a miss.
137
132
  * - **Stored rounded stochastically** onto halves (`f16_round_stochastic`), with noise fresh for each
@@ -210,16 +205,6 @@ fn probe_accumulate_guided_rays(base: u32, texel: u32, updates: u32, rays: u32,
210
205
  return vec2<u32>(first, min(select(0u, end - first, end > first), PROBE_TEXEL_RAYS));
211
206
  }
212
207
 
213
- // the rays a guided update gives a radiance texel, R·(w + e)/W
214
- fn probe_accumulate_expected_rays(base: u32, texel: u32, rays: u32, n: u32) -> f32 {
215
- let texels = n * n;
216
- let total = probe_guide[base + 2u * texels + 2u * n];
217
- let share = probe_guide[base + 2u * texels + 2u * n + 1u];
218
-
219
- // the guide passes always leave a total; a guide they never wrote gives nothing
220
- return select(0.0, f32(rays) * f32(probe_guide[base + texels + texel] + share) / f32(total), total > 0u);
221
- }
222
-
223
208
  @compute @workgroup_size(${PROBE_THREAD_WORKGROUP_SIZE})
224
209
  fn main(
225
210
  @builtin(workgroup_id) workgroup_id: vec3<u32>,
@@ -245,7 +230,6 @@ fn main(
245
230
  let rays = span.y;
246
231
  let first_ray = span.x;
247
232
  let updates = probe_state_updates(probe_states[slot].x);
248
- let elapsed = f32(settings.frame - probe_records[slot].traced_frame);
249
233
  let rounds = max(rays / texels, 1u);
250
234
 
251
235
  let maps = k * probe_clipmap_maps_words(n, m);
@@ -278,7 +262,7 @@ fn main(
278
262
  back_faces += select(0u, 1u, (record.flags & PROBE_RAY_BACK_FACE) != 0u);
279
263
  }
280
264
 
281
- let tile = index_to_grid2d(slot, settings.radiance_tiles_per_row) * (n + 2u) + 1u;
265
+ let tile = index_to_grid2d(slot, settings.radiance_tiles_per_row) * (n + 2u * settings.radiance_skirt) + settings.radiance_skirt;
282
266
  let history = select(textureLoad(probe_radiance, tile + vec2<u32>(i % n, i / n), 0), vec4<f32>(0.0), updates == 0u);
283
267
 
284
268
  var texel = history;
@@ -292,15 +276,11 @@ fn main(
292
276
  let pooled = probe_clipmap_resampled(k * texels + i, sum, count);
293
277
  let sample = pooled.rgb / pooled.w;
294
278
  let estimator = slot * texels + i;
295
- let rate = probe_clipmap_guide_rate(probe_accumulate_expected_rays(base, i, rays, n), settings.rays_per_probe, texels, settings.uniform_period);
296
279
 
297
280
  var e = multiscale_mean_seed(sample);
298
281
 
299
282
  if (history.a > 0.0) {
300
- // the gap in response times, a texel's own: its period is one over its share of updates
301
- let gap = elapsed / (rate * settings.response_frames);
302
283
  let ramp = 1.0 / (history.a + 1.0);
303
- let variance_time = 1.0 - exp(-0.5 * gap);
304
284
  let before = probe_accumulate_estimator(history.rgb, probe_estimators[estimator]);
305
285
  // the estimator's own floor on the variance
306
286
  let deviation = rgb_to_luminance(sqrt(max(vec3<f32>(1e-5), before.variance)));
@@ -310,10 +290,10 @@ fn main(
310
290
  e = multiscale_mean_add(
311
291
  before,
312
292
  sample,
313
- max(ramp, 1.0 - exp(-gap)),
314
- max(ramp, variance_time),
293
+ max(ramp, ${PROBE_SHORT_BLEND}),
294
+ max(ramp, ${PROBE_VARIANCE_BLEND}),
315
295
  select(0.0, ramp, history.a < ${PROBE_RADIANCE_SAMPLES_LIMIT}.0),
316
- ramp <= variance_time,
296
+ ramp <= ${PROBE_VARIANCE_BLEND},
317
297
  );
318
298
  }
319
299
 
@@ -339,8 +319,6 @@ fn main(
339
319
 
340
320
  var sum = vec2<f32>(0.0);
341
321
  var count = 0u;
342
- // the share of guided updates that reach this texel: its least reached radiance texel's
343
- var reach = 1.0;
344
322
 
345
323
  if (n >= m && guided) {
346
324
  // the radiance texels inside this one, each a mean of its own
@@ -351,9 +329,7 @@ fn main(
351
329
  for (var u = 0u; u < f; u++) {
352
330
  let texel = (at.y * f + v) * n + at.x * f + u;
353
331
  let run = probe_accumulate_guided_rays(base, texel, updates, rays, n);
354
- let stride = max((run.y + budget - 1u) / budget, 1u);
355
-
356
- reach = min(reach, min(probe_accumulate_expected_rays(base, texel, rays, n), 1.0));
332
+ let stride = max(divide_round_up_u32(run.y, budget), 1u);
357
333
 
358
334
  var texel_sum = vec2<f32>(0.0);
359
335
  var texel_count = 0u;
@@ -390,8 +366,6 @@ fn main(
390
366
  for (var u = 0u; u < f; u++) {
391
367
  let texel = (at.y * f + v) * n + at.x * f + u;
392
368
 
393
- reach = min(reach, min(probe_accumulate_expected_rays(base, texel, rays, n), 1.0));
394
-
395
369
  for (var round = 0u; round < rounds; round++) {
396
370
  let ray = probe_clipmap_texel_ray(texel, round, updates, rays, texels);
397
371
 
@@ -419,9 +393,6 @@ fn main(
419
393
  let run = probe_accumulate_guided_rays(base, texel, updates, rays, n);
420
394
  let gathered = select(rounds, run.y, guided);
421
395
 
422
- // of the radiance texel's rays, the share whose direction lands here
423
- reach = min(probe_accumulate_expected_rays(base, texel, rays, n) / f32(f * f), 1.0);
424
-
425
396
  for (var round = 0u; round < gathered; round++) {
426
397
  let ray = select(probe_clipmap_texel_ray(texel, round, updates, rays, texels), run.x + round, guided);
427
398
 
@@ -449,12 +420,7 @@ fn main(
449
420
  var moments = textureLoad(probe_depth, tile + at, 0).rg;
450
421
 
451
422
  if (count > 0u) {
452
- // a uniform update reaches every depth texel, a guided one those its rays land in
453
- let period = f32(settings.uniform_period);
454
- let rate = (1.0 + (period - 1.0) * reach) / period;
455
- let alpha = max(1.0 / f32(updates + 1u), 1.0 - exp(-elapsed / (rate * settings.response_frames)));
456
-
457
- moments = mix(moments, sum / f32(count), alpha);
423
+ moments = mix(moments, sum / f32(count), max(1.0 / f32(updates + 1u), ${PROBE_SHORT_BLEND}));
458
424
  } else if (updates == 0u) {
459
425
  moments = vec2<f32>(${PROBE_DEPTH_LIMIT}, ${PROBE_DEPTH_LIMIT} * ${PROBE_DEPTH_LIMIT});
460
426
  }
@@ -472,6 +438,7 @@ fn main(
472
438
  chunk_probe_clipmap_resampled,
473
439
  chunk_folded_workgroup_index,
474
440
  chunk_index_to_grid2d,
441
+ chunk_divide_round_up_u32,
475
442
  chunk_f16_round_stochastic,
476
443
  chunk_pcg3d,
477
444
  chunk_hash_to_float01,
@@ -23,9 +23,6 @@ export const PROBE_ADMIT_SETTINGS: WebGPUStruct;
23
23
  * free list cannot serve is counted, and the host grows the capacity on it (§7.10's pattern); the
24
24
  * point is wanted again the next frame.
25
25
  *
26
- * Either way the probe is marked the screen's when its entry carries `PROBE_WANTED_SCREEN`, and the
27
- * hits' when it does not, which decides whether its hits want in turn.
28
- *
29
26
  * A probe this frame's want leaves waiting for an update, that was not before, is counted into
30
27
  * `PROBE_COUNTER_WAITING` beside retire's: one an update served since it was last wanted, and a NEW one.
31
28
  * A probe that already waited, NEW or wanted since its last update, retire counted.
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_admit.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js"],"names":[],"mappings":"AAwBA;;GAEG;AACH,2CAFU,YAAY,CAKU;AAUhC;;;;;GAKG;AACH,iDAFU,aAAa,CAqBpB;AAEH;;GAEG;AACH,mCAFU,YAAY,CAWG;AAgBzB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,yCAFU,aAAa,CAsEpB;6BAhL0B,sCAAsC;8BAHrC,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_admit.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js"],"names":[],"mappings":"AAyBA;;GAEG;AACH,2CAFU,YAAY,CAKU;AAUhC;;;;;GAKG;AACH,iDAFU,aAAa,CAsBpB;AAEH;;GAEG;AACH,mCAFU,YAAY,CAWG;AAgBzB;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAFU,aAAa,CAmEpB;6BA3K0B,sCAAsC;8BAHrC,kCAAkC"}
@@ -1,5 +1,6 @@
1
1
  import { chunk_collection_u32_append } from "../../../gpu_primitive/chunk_collection_u32_append.js";
2
2
  import { chunk_folded_dispatch } from "../../../gpu_primitive/indirect/chunk_folded_dispatch.js";
3
+ import { chunk_divide_round_up_u32 } from "../../../shader/chunk/math/chunk_divide_round_up_u32.js";
3
4
  import { chunk_slot_stack } from "../../../gpu_primitive/slot_stack/chunk_slot_stack.js";
4
5
  import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
5
6
  import { chunk_subgroup_atomic_add } from "../../../shader/chunk/subgroup/chunk_subgroup_atomic_add.js";
@@ -26,8 +27,8 @@ import { PROBE_THREAD_WORKGROUP_SIZE } from "./PROBE_CLIPMAP.js";
26
27
  * @type {WebGPUStruct}
27
28
  */
28
29
  export const PROBE_ADMIT_COMMAND_SETTINGS = WebGPUStruct.from({
29
- /** keys over every cascade: what the wanted list holds at most */
30
- key_count: u32,
30
+ /** what the wanted list holds at most: every key, or fewer where the wants cannot want more */
31
+ wanted_capacity: u32,
31
32
  }, "ProbeAdmitCommandSettings");
32
33
 
33
34
  const command_resources = new ShaderResourceSetDescriptor();
@@ -52,8 +53,8 @@ export const shader_probe_clipmap_admit_command = ComputeShader.from({
52
53
  `
53
54
  @compute @workgroup_size(1)
54
55
  fn main() {
55
- let wanted = min(probe_wanted.count, settings.key_count);
56
- let folded = folded_dispatch((wanted + PROBE_THREAD_WORKGROUP_SIZE - 1u) / PROBE_THREAD_WORKGROUP_SIZE);
56
+ let wanted = min(probe_wanted.count, settings.wanted_capacity);
57
+ let folded = folded_dispatch(divide_round_up_u32(wanted, PROBE_THREAD_WORKGROUP_SIZE));
57
58
 
58
59
  probe_dispatch[PROBE_DISPATCH_ADMIT] = folded.x;
59
60
  probe_dispatch[PROBE_DISPATCH_ADMIT + 1u] = folded.y;
@@ -61,6 +62,7 @@ fn main() {
61
62
  }
62
63
  `, [
63
64
  chunk_probe_clipmap,
65
+ chunk_divide_round_up_u32,
64
66
  chunk_folded_dispatch,
65
67
  ]),
66
68
  });
@@ -73,8 +75,8 @@ export const PROBE_ADMIT_SETTINGS = WebGPUStruct.from({
73
75
  capacity: u32,
74
76
  /** lattice points a cascade's window has a side */
75
77
  resolution: u32,
76
- /** keys over every cascade: what the wanted list holds at most */
77
- key_count: u32,
78
+ /** what the wanted list holds at most: every key, or fewer where the wants cannot want more */
79
+ wanted_capacity: u32,
78
80
  /** the frame, of the frames the clipmap has recorded */
79
81
  frame: u32,
80
82
  }, "ProbeAdmitSettings");
@@ -103,9 +105,6 @@ resources.createGroup()
103
105
  * free list cannot serve is counted, and the host grows the capacity on it (§7.10's pattern); the
104
106
  * point is wanted again the next frame.
105
107
  *
106
- * Either way the probe is marked the screen's when its entry carries `PROBE_WANTED_SCREEN`, and the
107
- * hits' when it does not, which decides whether its hits want in turn.
108
- *
109
108
  * A probe this frame's want leaves waiting for an update, that was not before, is counted into
110
109
  * `PROBE_COUNTER_WAITING` beside retire's: one an update served since it was last wanted, and a NEW one.
111
110
  * A probe that already waited, NEW or wanted since its last update, retire counted.
@@ -132,11 +131,9 @@ fn main(
132
131
  var admitted = false;
133
132
  var waits = false;
134
133
 
135
- if (index < min(probe_wanted.count, settings.key_count)) {
134
+ if (index < min(probe_wanted.count, settings.wanted_capacity)) {
136
135
  let resolution = settings.resolution;
137
- let wanted = probe_wanted.elements[index];
138
- let key = wanted & ~PROBE_WANTED_SCREEN;
139
- let screen = (wanted & PROBE_WANTED_SCREEN) != 0u;
136
+ let key = probe_wanted.elements[index];
140
137
  let cascade = probe_clipmap_key_cascade(key, resolution);
141
138
  let storage = probe_clipmap_key_storage(key, resolution);
142
139
  let texel = probe_clipmap_indirection_texel(cascade, storage, resolution);
@@ -146,7 +143,6 @@ fn main(
146
143
  let waited = probe_state_kind(probe_states[entry].x) == PROBE_STATE_NEW || probe_records[entry].wanted_frame > probe_records[entry].traced_frame;
147
144
 
148
145
  probe_records[entry].wanted_frame = settings.frame;
149
- probe_records[entry].flags = (probe_records[entry].flags & ~PROBE_RECORD_SCREEN) | select(0u, PROBE_RECORD_SCREEN, screen);
150
146
 
151
147
  waits = !waited;
152
148
  } else {
@@ -157,7 +153,7 @@ fn main(
157
153
  } else {
158
154
  // field by field: nothing of the slot's last probe stays
159
155
  probe_records[slot].cell = probe_clipmap_window_point(storage, probe_levels[cascade].corner, resolution);
160
- probe_records[slot].flags = probe_record_flags(0.0, screen, cascade);
156
+ probe_records[slot].flags = probe_record_flags(0.0, cascade);
161
157
  probe_records[slot].wanted_frame = settings.frame;
162
158
  probe_records[slot].traced_frame = settings.frame;
163
159
  probe_records[slot].sh = vec3<u32>(0u);
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The next bounce a front-face hit takes, E_ind (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.7;
3
+ * WORLD_PROBE_CACHE_SCOPE_2026_11_01.md §1.4): a thread a ray, after the light pass through the same launch,
4
+ * `PROBE_DISPATCH_RAYS`. It adds ρ_d·E_ind/π to the ray's light, ρ_d the albedo shade left in its `row`.
5
+ *
6
+ * - **The first clipmap**: the frustum's probes, picked at the hit along its normal, the view back along
7
+ * the ray, with the ray's own jitter as the noise (`probe_clipmap_pick_in`).
8
+ * - **Where it has probes**, their SH is the bounce, and the ray's `row` is cleared: a hit the first clipmap
9
+ * serves wants nothing of the fallback (`shader_probe_clipmap_want_hits`).
10
+ * - **Where it has none**, the fallback's, the world cache's: the same pick there, at its own spacing.
11
+ * - **Where neither has**, the bounce is **zero**, not the environment: a hit behind the camera in a cave
12
+ * must not bring daylight in. The next frame's hits' wants ask the fallback for the probes it read, so the
13
+ * bounce has them a frame or two later.
14
+ *
15
+ * "Has probes" is the pick's own answer, some corner weighing anything: NEW, DEAD and occluded probes count as
16
+ * none. The records hold the SH their projection last wrote, at most a frame old, so each frame takes one more
17
+ * bounce. LPV's 0.97 a bounce is dropped: an albedo under one bounds the series already.
18
+ *
19
+ * Every probe ray takes it, of either clipmap; only the frustum's rays' rows are read after, by the world
20
+ * cache's wants.
21
+ *
22
+ * @type {ComputeShader}
23
+ */
24
+ export const shader_probe_clipmap_bounce: ComputeShader;
25
+ import { ComputeShader } from "../../../shader/ComputeShader.js";
26
+ //# sourceMappingURL=shader_probe_clipmap_bounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_probe_clipmap_bounce.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.js"],"names":[],"mappings":"AAuEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,0CAFU,aAAa,CAgFpB;8BAjK2B,kCAAkC"}
@@ -0,0 +1,173 @@
1
+ import { chunk_rgbe9995_decode } from "../../../shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.js";
2
+ import { chunk_rgbe9995_encode } from "../../../shader/chunk/color/rgbe9995/chunk_rgbe9995_encode.js";
3
+ import { CLIPMAP_LEVEL_ARRAY } from "../../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
4
+ import {
5
+ chunk_uv_octahedral_unit_decode
6
+ } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
7
+ import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
8
+ import {
9
+ chunk_resolve_irradiance_sh_to_diffuse
10
+ } from "../../../shader/chunk/spherical_harmonics/l1i/chunk_resolve_irradiance_sh_to_diffuse.js";
11
+ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
12
+ import { ComputeShader } from "../../../shader/ComputeShader.js";
13
+ import { ShaderResourceDescriptor } from "../../../shader/resource/ShaderResourceDescriptor.js";
14
+ import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
15
+ import { vec2u } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
16
+ import { WebGPUArray } from "../../../shader/type/WebGPUArray.js";
17
+ import { STBN_VEC2_RESOURCE } from "../../../STATIC_GRAPHICS_ENGINE_ASSET_RESOURCES.js";
18
+ import { BRICK_TRACE_HIT } from "../brick/BRICK_CLIPMAP.js";
19
+ import {
20
+ chunk_probe_clipmap,
21
+ chunk_probe_clipmap_ray_jitter,
22
+ chunk_probe_clipmap_ray_layout,
23
+ chunk_probe_clipmap_ray_origin,
24
+ chunk_probe_clipmap_ray_texel,
25
+ PROBE_ORIGINS_READ_RESOURCE,
26
+ PROBE_RAY_SUMS_READ_RESOURCE,
27
+ PROBE_RAYS_WRITE_RESOURCE,
28
+ PROBE_RECORD_STRUCT,
29
+ PROBE_STATES_READ_RESOURCE,
30
+ PROBE_TRACE_READ_RESOURCE
31
+ } from "./chunk_probe_clipmap.js";
32
+ import {
33
+ chunk_probe_clipmap_pick_in,
34
+ PROBE_DEPTH_SAMPLER_RESOURCE,
35
+ PROBE_SAMPLING_STRUCT
36
+ } from "./chunk_probe_clipmap_pick.js";
37
+ import { PROBE_THREAD_WORKGROUP_SIZE } from "./PROBE_CLIPMAP.js";
38
+ import { PROBE_TRACE_SETTINGS } from "./shader_probe_clipmap_trace.js";
39
+
40
+ const resources = new ShaderResourceSetDescriptor();
41
+
42
+ resources.setImmediate("settings", PROBE_TRACE_SETTINGS);
43
+
44
+ // the rays and their probes, of the clipmap whose update this is
45
+ resources.createGroup()
46
+ .add(PROBE_TRACE_READ_RESOURCE)
47
+ .add(PROBE_ORIGINS_READ_RESOURCE)
48
+ .add(PROBE_RAYS_WRITE_RESOURCE)
49
+ .add(PROBE_RAY_SUMS_READ_RESOURCE)
50
+ .add(PROBE_STATES_READ_RESOURCE)
51
+ .add(STBN_VEC2_RESOURCE)
52
+ .add(PROBE_DEPTH_SAMPLER_RESOURCE);
53
+
54
+ // the clipmap a hit takes its bounce from first: the frustum's probes
55
+ resources.createGroup()
56
+ .add(ShaderResourceDescriptor.uniform("bounce_first_levels", CLIPMAP_LEVEL_ARRAY))
57
+ .add(ShaderResourceDescriptor.uniform("bounce_first_sampling", PROBE_SAMPLING_STRUCT))
58
+ .add(ShaderResourceDescriptor.texture("bounce_first_indirection", "uint", "3d"))
59
+ .add(ShaderResourceDescriptor.storageBuffer("bounce_first_states", WebGPUArray.from(vec2u)))
60
+ .add(ShaderResourceDescriptor.storageBuffer("bounce_first_records", WebGPUArray.from(PROBE_RECORD_STRUCT)))
61
+ .add(ShaderResourceDescriptor.texture("bounce_first_depth", "float", "2d"));
62
+
63
+ // the clipmap it falls back to where the first has no probe: the world cache
64
+ resources.createGroup()
65
+ .add(ShaderResourceDescriptor.uniform("bounce_fallback_levels", CLIPMAP_LEVEL_ARRAY))
66
+ .add(ShaderResourceDescriptor.uniform("bounce_fallback_sampling", PROBE_SAMPLING_STRUCT))
67
+ .add(ShaderResourceDescriptor.texture("bounce_fallback_indirection", "uint", "3d"))
68
+ .add(ShaderResourceDescriptor.storageBuffer("bounce_fallback_states", WebGPUArray.from(vec2u)))
69
+ .add(ShaderResourceDescriptor.storageBuffer("bounce_fallback_records", WebGPUArray.from(PROBE_RECORD_STRUCT)))
70
+ .add(ShaderResourceDescriptor.texture("bounce_fallback_depth", "float", "2d"));
71
+
72
+ /**
73
+ * The next bounce a front-face hit takes, E_ind (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.7;
74
+ * WORLD_PROBE_CACHE_SCOPE_2026_11_01.md §1.4): a thread a ray, after the light pass through the same launch,
75
+ * `PROBE_DISPATCH_RAYS`. It adds ρ_d·E_ind/π to the ray's light, ρ_d the albedo shade left in its `row`.
76
+ *
77
+ * - **The first clipmap**: the frustum's probes, picked at the hit along its normal, the view back along
78
+ * the ray, with the ray's own jitter as the noise (`probe_clipmap_pick_in`).
79
+ * - **Where it has probes**, their SH is the bounce, and the ray's `row` is cleared: a hit the first clipmap
80
+ * serves wants nothing of the fallback (`shader_probe_clipmap_want_hits`).
81
+ * - **Where it has none**, the fallback's, the world cache's: the same pick there, at its own spacing.
82
+ * - **Where neither has**, the bounce is **zero**, not the environment: a hit behind the camera in a cave
83
+ * must not bring daylight in. The next frame's hits' wants ask the fallback for the probes it read, so the
84
+ * bounce has them a frame or two later.
85
+ *
86
+ * "Has probes" is the pick's own answer, some corner weighing anything: NEW, DEAD and occluded probes count as
87
+ * none. The records hold the SH their projection last wrote, at most a frame old, so each frame takes one more
88
+ * bounce. LPV's 0.97 a bounce is dropped: an albedo under one bounds the series already.
89
+ *
90
+ * Every probe ray takes it, of either clipmap; only the frustum's rays' rows are read after, by the world
91
+ * cache's wants.
92
+ *
93
+ * @type {ComputeShader}
94
+ */
95
+ export const shader_probe_clipmap_bounce = ComputeShader.from({
96
+ label: "Probe Clipmap Bounce",
97
+ resources,
98
+ body: CodeChunk.from(
99
+ //language=WGSL
100
+ `
101
+ @compute @workgroup_size(${PROBE_THREAD_WORKGROUP_SIZE})
102
+ fn main(
103
+ @builtin(workgroup_id) workgroup_id: vec3<u32>,
104
+ @builtin(local_invocation_index) lane: u32,
105
+ ) {
106
+ let ray = folded_workgroup_index(workgroup_id) * PROBE_THREAD_WORKGROUP_SIZE + lane;
107
+ let record = probe_rays[ray];
108
+ let albedo = unpack4x8unorm(record.row).rgb;
109
+ let front_hit = (record.flags & PROBE_RAY_KIND_MASK) == ${BRICK_TRACE_HIT}u && (record.flags & PROBE_RAY_BACK_FACE) == 0u;
110
+
111
+ // only a front-face hit that bounces anything takes more light
112
+ if (!front_hit || all(albedo == vec3<f32>(0.0))) {
113
+ return;
114
+ }
115
+
116
+ // the probe's update's rays, and this one's place among them
117
+ let k = record.flags >> PROBE_RAY_PROBE_SHIFT;
118
+ let span = probe_clipmap_probe_rays(k);
119
+ let rays = span.y;
120
+ let i = ray - span.x;
121
+
122
+ let slot = probe_trace.elements[k];
123
+ let n = settings.radiance_resolution;
124
+ let updates = probe_state_updates(probe_states[slot].x);
125
+ let texel = probe_clipmap_ray_texel(i, updates, rays, n * n);
126
+
127
+ let direction = uv_octahedral_unit_decode(unpack2x16unorm(record.direction));
128
+ let position = probe_clipmap_ray_origin(probe_origins[k], slot, record.direction) + record.t * direction;
129
+ let normal = uv_octahedral_unit_decode(unpack2x16unorm(record.normal));
130
+ let noise = probe_clipmap_ray_jitter(slot, texel, i, updates, rays, n);
131
+
132
+ var probes = probe_clipmap_sh_in(
133
+ &bounce_first_records,
134
+ probe_clipmap_pick_in(&bounce_first_levels, &bounce_first_sampling, bounce_first_indirection, &bounce_first_states, bounce_first_depth, position, normal, -direction, noise),
135
+ );
136
+
137
+ if (probes.found) {
138
+ // served: nothing of the fallback is wanted here
139
+ probe_rays[ray].row = 0u;
140
+ } else {
141
+ probes = probe_clipmap_sh_in(
142
+ &bounce_fallback_records,
143
+ probe_clipmap_pick_in(&bounce_fallback_levels, &bounce_fallback_sampling, bounce_fallback_indirection, &bounce_fallback_states, bounce_fallback_depth, position, normal, -direction, noise),
144
+ );
145
+ }
146
+
147
+ if (!probes.found) {
148
+ return;
149
+ }
150
+
151
+ // E/π, as the resolve gives it
152
+ let e = resolve_irradiance_sh_to_diffuse(probes.sh.Y, probes.sh.CoCg, normal);
153
+
154
+ if (all(e == vec3<f32>(0.0))) {
155
+ return;
156
+ }
157
+
158
+ probe_rays[ray].light = rgbe9995_encode(rgbe9995_decode(record.light) + albedo * e);
159
+ }
160
+ `, [
161
+ chunk_probe_clipmap,
162
+ chunk_probe_clipmap_ray_layout,
163
+ chunk_probe_clipmap_ray_texel,
164
+ chunk_probe_clipmap_ray_jitter,
165
+ chunk_probe_clipmap_ray_origin,
166
+ chunk_folded_workgroup_index,
167
+ chunk_uv_octahedral_unit_decode,
168
+ chunk_probe_clipmap_pick_in,
169
+ chunk_resolve_irradiance_sh_to_diffuse,
170
+ chunk_rgbe9995_decode,
171
+ chunk_rgbe9995_encode,
172
+ ]),
173
+ });
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @type {WebGPUStruct}
3
+ */
4
+ export const PROBE_CANDIDATE_SETTINGS: WebGPUStruct;
5
+ /**
6
+ * The candidate (Enshrouded's "pick neighbor candidates"): a thread a listed probe B, dispatched through
7
+ * `PROBE_DISPATCH_TRACED` after relocation, draws the one neighbour whose rays of this frame it re-samples
8
+ * (`shader_probe_clipmap_resample_rays`), and writes it to `probe_candidates`: its place in the list, or
9
+ * `PROBE_CLIPMAP_NONE`, and the weight its rays take.
10
+ *
11
+ * - **The neighbours**: the 26 around B's lattice point in its cascade. One is a candidate if it is ALIVE, its
12
+ * record holds that point (the storage wraps), and it is listed this frame (`probe_clipmap_listed`), so that its
13
+ * rays are in `probe_rays`. A NEW one is not. M counts them.
14
+ * - **The importance**: the neighbour's radiance, its irradiance's L0 luma, times B's visibility of it: Chebyshev
15
+ * over B's depth moments toward it (`probe_visibility_chebyshev`), its distance in B's spacings held to the depth
16
+ * limit, as the moments are. A dark neighbour, or one behind a wall, weighs about nothing.
17
+ * - **The draw**: one by its importance, a reservoir of one through the 26 with a hash of the slot, the update count
18
+ * and the neighbour.
19
+ * - **The weight**: the draw's density divided out, `(1 / M) / p`, p the drawn one's importance over the sum: the
20
+ * rays B takes are then, in expectation, every candidate's alike.
21
+ * - A probe whose first update this is, or a DEAD one, draws nothing: its depth is not yet its own, or it is
22
+ * inside a solid.
23
+ *
24
+ * Reads the depth atlas as the last publish left it, and the frame's origins, records and states, which no pass
25
+ * after relocation writes before accumulate.
26
+ *
27
+ * @type {ComputeShader}
28
+ */
29
+ export const shader_probe_clipmap_candidate: ComputeShader;
30
+ import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
31
+ import { ComputeShader } from "../../../shader/ComputeShader.js";
32
+ //# sourceMappingURL=shader_probe_clipmap_candidate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_probe_clipmap_candidate.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.js"],"names":[],"mappings":"AA6BA;;GAEG;AACH,uCAFU,YAAY,CAKO;AAqB7B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,6CAFU,aAAa,CAuFpB;6BA9J0B,sCAAsC;8BAHrC,kCAAkC"}