@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,6 +1,8 @@
1
1
  import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
2
2
  import { chunk_index_to_grid2d } from "../../../shader/chunk/grid/chunk_index_to_grid2d.js";
3
- import { chunk_texture_octahedral_wrap_texel_coordinates } from "../../../shader/chunk/texture/octahedral/chunk_texture_octahedral_wrap_texel_coordinates.js";
3
+ import {
4
+ chunk_texture_octahedral_wrap_texel_coordinates
5
+ } from "../../../shader/chunk/texture/octahedral/chunk_texture_octahedral_wrap_texel_coordinates.js";
4
6
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
5
7
  import { ComputeShader } from "../../../shader/ComputeShader.js";
6
8
  import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
@@ -27,6 +29,8 @@ export const PROBE_PUBLISH_SETTINGS = WebGPUStruct.from({
27
29
  depth_resolution: u32,
28
30
  /** tiles a row of the radiance atlas */
29
31
  radiance_tiles_per_row: u32,
32
+ /** texels of skirt around a radiance tile's map on each side: 1, or 0 for a clipmap whose radiance is never sampled */
33
+ radiance_skirt: u32,
30
34
  /** tiles a row of the depth atlas */
31
35
  depth_tiles_per_row: u32,
32
36
  }, "ProbePublishSettings");
@@ -43,11 +47,13 @@ resources.createGroup()
43
47
 
44
48
  /**
45
49
  * Publish (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.8): a thread a texel of each listed probe's two
46
- * tiles, the radiance tile's (n_r + 2)² then the depth tile's (n_d + 2)², dispatched through
47
- * `PROBE_DISPATCH_PUBLISH`. A tile is its map with a one-texel skirt, each skirt texel the interior texel
48
- * the octahedral fold puts next to it, so a reader's bilinear tap across the edge reads what a wrap would
49
- * (`texture_octahedral_skirt_uv`). Every texel is written from the probe's maps, which accumulation
50
- * wrote whole: the atlases are only ever stored into here.
50
+ * tiles, the radiance tile's (n_r + 2s)² then the depth tile's (n_d + 2)², dispatched through
51
+ * `PROBE_DISPATCH_PUBLISH`. A tile is its map with a skirt of s texels, one for the depth and
52
+ * `radiance_skirt` for the radiance, each skirt texel the interior texel the octahedral fold puts next to it,
53
+ * so a reader's bilinear tap across the edge reads what a wrap would (`texture_octahedral_skirt_uv`). A
54
+ * clipmap whose radiance is never sampled, only loaded texel by texel, has none there
55
+ * (WORLD_PROBE_CACHE_SCOPE_2026_11_01.md §1.8). Every texel is written from the probe's maps, which
56
+ * accumulation wrote whole: the atlases are only ever stored into here.
51
57
  *
52
58
  * @type {ComputeShader}
53
59
  */
@@ -66,7 +72,9 @@ fn main(
66
72
 
67
73
  let n = settings.radiance_resolution;
68
74
  let m = settings.depth_resolution;
69
- let radiance_tile = (n + 2u) * (n + 2u);
75
+ let skirt = settings.radiance_skirt;
76
+ let side = n + 2u * skirt;
77
+ let radiance_tile = side * side;
70
78
  let per_probe = radiance_tile + (m + 2u) * (m + 2u);
71
79
 
72
80
  if (thread >= min(probe_trace.count, settings.trace_capacity) * per_probe) {
@@ -79,12 +87,12 @@ fn main(
79
87
  let maps = k * probe_clipmap_maps_words(n, m);
80
88
 
81
89
  if (i < radiance_tile) {
82
- let at = vec2<u32>(i % (n + 2u), i / (n + 2u));
83
- let source = texture_octahedral_wrap_texel_coordinates(vec2<i32>(at) - 1, i32(n));
90
+ let at = vec2<u32>(i % side, i / side);
91
+ let source = texture_octahedral_wrap_texel_coordinates(vec2<i32>(at) - i32(skirt), i32(n));
84
92
  let texel = source.y * n + source.x;
85
93
  let value = vec4<f32>(unpack2x16float(probe_maps[maps + 2u * texel]), unpack2x16float(probe_maps[maps + 2u * texel + 1u]));
86
94
 
87
- textureStore(probe_radiance, index_to_grid2d(slot, settings.radiance_tiles_per_row) * (n + 2u) + at, value);
95
+ textureStore(probe_radiance, index_to_grid2d(slot, settings.radiance_tiles_per_row) * side + at, value);
88
96
 
89
97
  return;
90
98
  }
@@ -7,8 +7,8 @@ export const PROBE_RAY_COUNTS_SETTINGS: WebGPUStruct;
7
7
  * `PROBE_DISPATCH_TRACED`, writes the rays its update casts, as two parts whose counts the trace command
8
8
  * wrote:
9
9
  * - `probe_ray_counts`, what the budget does not scale: a uniform update's R, a NEW probe's among them,
10
- * and a DEAD probe's fewest, whose updates are all uniform. A uniform update's map of rays to texels
11
- * takes a power of two, and U = ⌊budget / R⌋ makes room for a frame of them.
10
+ * and a DEAD probe's `PROBE_DEAD_RAYS`, whose updates are all uniform. A uniform update's map of rays
11
+ * to texels takes a power of two, and U = ⌊budget / R⌋ makes room for a frame of them.
12
12
  * - `probe_ray_requests`, what it does: a guided update's request, the rays the probe asked for after its
13
13
  * last update (`probe_requests`), at least the fewest.
14
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_ray_layout.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH,wCAFU,YAAY,CAaO;AAa7B;;;;;;;;;;;;;GAaG;AACH,8CAFU,aAAa,CAyCpB;AAEH;;GAEG;AACH,wCAFU,YAAY,CAOO;AAW7B;;;;;;;;;GASG;AACH,8CAFU,aAAa,CA+BpB;AAQH;;;;;;GAMG;AACH,+CAFU,aAAa,CA4BpB;6BAtM0B,sCAAsC;8BAHrC,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_ray_layout.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js"],"names":[],"mappings":"AAwBA;;GAEG;AACH,wCAFU,YAAY,CAeO;AAa7B;;;;;;;;;;;;;GAaG;AACH,8CAFU,aAAa,CAyCpB;AAEH;;GAEG;AACH,wCAFU,YAAY,CAOO;AAW7B;;;;;;;;;GASG;AACH,8CAFU,aAAa,CA+BpB;AAQH;;;;;;GAMG;AACH,+CAFU,aAAa,CA6BpB;6BAzM0B,sCAAsC;8BAHrC,kCAAkC"}
@@ -1,4 +1,5 @@
1
1
  import { chunk_folded_dispatch } from "../../../gpu_primitive/indirect/chunk_folded_dispatch.js";
2
+ import { chunk_divide_round_up_u32 } from "../../../shader/chunk/math/chunk_divide_round_up_u32.js";
2
3
  import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
3
4
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
4
5
  import { ComputeShader } from "../../../shader/ComputeShader.js";
@@ -29,8 +30,10 @@ export const PROBE_RAY_COUNTS_SETTINGS = WebGPUStruct.from({
29
30
  trace_capacity: u32,
30
31
  /** rays a uniform update casts, R */
31
32
  rays_per_probe: u32,
32
- /** the fewest rays an update casts, a DEAD probe's, `PROBE_RAYS_PER_TEXEL_MIN` of the texels */
33
+ /** the fewest rays a guided update casts, `PROBE_RAYS_PER_TEXEL_MIN` of the texels */
33
34
  rays_min: u32,
35
+ /** rays a DEAD probe's update casts, `PROBE_DEAD_RAYS` or R where R is fewer */
36
+ rays_dead: u32,
34
37
  /** octahedral radiance texels a side, n_r */
35
38
  radiance_resolution: u32,
36
39
  /** updates between a probe's uniform ones, `PROBE_UNIFORM_PERIOD` */
@@ -53,8 +56,8 @@ counts_resources.createGroup()
53
56
  * `PROBE_DISPATCH_TRACED`, writes the rays its update casts, as two parts whose counts the trace command
54
57
  * wrote:
55
58
  * - `probe_ray_counts`, what the budget does not scale: a uniform update's R, a NEW probe's among them,
56
- * and a DEAD probe's fewest, whose updates are all uniform. A uniform update's map of rays to texels
57
- * takes a power of two, and U = ⌊budget / R⌋ makes room for a frame of them.
59
+ * and a DEAD probe's `PROBE_DEAD_RAYS`, whose updates are all uniform. A uniform update's map of rays
60
+ * to texels takes a power of two, and U = ⌊budget / R⌋ makes room for a frame of them.
58
61
  * - `probe_ray_requests`, what it does: a guided update's request, the rays the probe asked for after its
59
62
  * last update (`probe_requests`), at least the fewest.
60
63
  *
@@ -87,7 +90,7 @@ fn main(
87
90
  var request = 0u;
88
91
 
89
92
  if (probe_state_kind(state) == PROBE_STATE_DEAD) {
90
- fixed = settings.rays_min;
93
+ fixed = settings.rays_dead;
91
94
  } else if (probe_clipmap_guided(state, settings.uniform_period, settings.rays_per_probe, n * n)) {
92
95
  fixed = 0u;
93
96
  request = max(probe_requests[slot].rays, settings.rays_min);
@@ -192,7 +195,7 @@ fn main() {
192
195
  total = probe_ray_sums.elements[listed - 1u];
193
196
  }
194
197
 
195
- let rays = folded_dispatch((total + PROBE_THREAD_WORKGROUP_SIZE - 1u) / PROBE_THREAD_WORKGROUP_SIZE);
198
+ let rays = folded_dispatch(divide_round_up_u32(total, PROBE_THREAD_WORKGROUP_SIZE));
196
199
 
197
200
  probe_dispatch[PROBE_DISPATCH_RAYS] = rays.x;
198
201
  probe_dispatch[PROBE_DISPATCH_RAYS + 1u] = rays.y;
@@ -200,6 +203,7 @@ fn main() {
200
203
  }
201
204
  `, [
202
205
  chunk_probe_clipmap,
206
+ chunk_divide_round_up_u32,
203
207
  chunk_folded_dispatch,
204
208
  ]),
205
209
  });
@@ -17,6 +17,9 @@ export const PROBE_RELOCATE_SETTINGS: WebGPUStruct;
17
17
  * the probe's origin at that offset, as the encoding holds it, to `probe_origins` at its place in the
18
18
  * list, where the update's passes after it find it.
19
19
  *
20
+ * Its place in the list goes to `probe_listed` at its slot, where a probe updated in the same frame finds it as a
21
+ * neighbour (`probe_clipmap_listed`).
22
+ *
20
23
  * @type {ComputeShader}
21
24
  */
22
25
  export const shader_probe_clipmap_relocate: ComputeShader;
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_relocate.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js"],"names":[],"mappings":"AA6BA;;GAEG;AACH,sCAFU,YAAY,CAOM;AAiB5B;;;;;;;;;;;;;;;;GAgBG;AACH,4CAFU,aAAa,CAsDpB;6BAtH0B,sCAAsC;8BAHrC,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_relocate.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js"],"names":[],"mappings":"AAyBA;;GAEG;AACH,sCAFU,YAAY,CAOM;AAkB5B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4CAFU,aAAa,CAyDpB;6BAzH0B,sCAAsC;8BAHrC,kCAAkC"}
@@ -15,17 +15,13 @@ import {
15
15
  import {
16
16
  chunk_probe_clipmap,
17
17
  PROBE_LEVELS_RESOURCE,
18
+ PROBE_LISTED_WRITE_RESOURCE,
18
19
  PROBE_ORIGINS_WRITE_RESOURCE,
19
20
  PROBE_RECORDS_READ_RESOURCE,
20
21
  PROBE_STATES_STORE_RESOURCE,
21
22
  PROBE_TRACE_READ_RESOURCE
22
23
  } from "./chunk_probe_clipmap.js";
23
- import {
24
- PROBE_RELOCATION_CLEARANCE,
25
- PROBE_RELOCATION_LIMIT,
26
- PROBE_RELOCATION_STEPS,
27
- PROBE_THREAD_WORKGROUP_SIZE
28
- } from "./PROBE_CLIPMAP.js";
24
+ import { PROBE_RELOCATION_CLEARANCE, PROBE_RELOCATION_STEPS, PROBE_THREAD_WORKGROUP_SIZE } from "./PROBE_CLIPMAP.js";
29
25
 
30
26
  /**
31
27
  * @type {WebGPUStruct}
@@ -47,6 +43,7 @@ resources.createGroup()
47
43
  .add(PROBE_RECORDS_READ_RESOURCE)
48
44
  .add(PROBE_TRACE_READ_RESOURCE)
49
45
  .add(PROBE_ORIGINS_WRITE_RESOURCE)
46
+ .add(PROBE_LISTED_WRITE_RESOURCE)
50
47
  .add(BRICK_LEVELS_RESOURCE)
51
48
  .add(BRICK_MAP_TEXTURE_RESOURCE)
52
49
  .add(BRICK_ATLAS_TEXTURE_RESOURCE)
@@ -67,6 +64,9 @@ resources.createGroup()
67
64
  * the probe's origin at that offset, as the encoding holds it, to `probe_origins` at its place in the
68
65
  * list, where the update's passes after it find it.
69
66
  *
67
+ * Its place in the list goes to `probe_listed` at its slot, where a probe updated in the same frame finds it as a
68
+ * neighbour (`probe_clipmap_listed`).
69
+ *
70
70
  * @type {ComputeShader}
71
71
  */
72
72
  export const shader_probe_clipmap_relocate = ComputeShader.from({
@@ -87,6 +87,9 @@ fn main(
87
87
  }
88
88
 
89
89
  let slot = probe_trace.elements[index];
90
+
91
+ probe_listed[slot] = index;
92
+
90
93
  let spacing = probe_levels[probe_record_cascade(probe_records[slot].flags)].cell_size;
91
94
  let lattice = vec3<f32>(probe_records[slot].cell) * spacing;
92
95
  let clearance = ${PROBE_RELOCATION_CLEARANCE} * spacing;
@@ -36,7 +36,7 @@ export const PROBE_RESAMPLE_SETTINGS: WebGPUStruct;
36
36
  * B's own samples of its texel. Both are absolute, each held to the estimator's own floor of 10⁻⁵, so a
37
37
  * dark neighbour is not taken less for being dark;
38
38
  * - its freshness, `e^(−age / τ)`: age the frames since the neighbour's last update, τ
39
- * `response_frames`, the time over which a probe's own history follows a change.
39
+ * `response_frames`, the time over which a neighbour's history goes stale.
40
40
  * - A neighbour's texel no ray has reached, its count zero, is not taken.
41
41
  * - A probe whose first update this is, or a DEAD one, takes nothing: its depth is not yet its own, or
42
42
  * it is inside a solid.
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_resample.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.js"],"names":[],"mappings":"AA+BA;;GAEG;AACH,sCAFU,YAAY,CAaM;AAsB5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,4CAFU,aAAa,CA4IpB;6BAhP0B,sCAAsC;8BAHrC,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_resample.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.js"],"names":[],"mappings":"AAwCA;;GAEG;AACH,sCAFU,YAAY,CAaM;AAsB5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,4CAFU,aAAa,CAmIpB;6BA5O0B,sCAAsC;8BAHrC,kCAAkC"}
@@ -1,6 +1,10 @@
1
1
  import { chunk_rgb_to_luminance } from "../../../shader/chunk/color/chunk_rgb_to_luminance.js";
2
- import { chunk_uv_octahedral_unit_decode } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
3
- import { chunk_uv_octahedral_unit_encode } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
2
+ import {
3
+ chunk_uv_octahedral_unit_decode
4
+ } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
5
+ import {
6
+ chunk_uv_octahedral_unit_encode
7
+ } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
4
8
  import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
5
9
  import { chunk_pcg3d } from "../../../shader/chunk/random/pcg/chunk_pcg3d.js";
6
10
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
@@ -26,8 +30,13 @@ import {
26
30
  PROBE_INDIRECTION_READ_RESOURCE,
27
31
  PROBE_SAMPLING_RESOURCE
28
32
  } from "./chunk_probe_clipmap_pick.js";
33
+ import { chunk_probe_clipmap_resample } from "./chunk_probe_clipmap_resample.js";
29
34
  import { chunk_probe_clipmap_sample_radiance } from "./chunk_probe_clipmap_sample_radiance.js";
30
- import { PROBE_DEPTH_LIMIT, PROBE_RECEIVER_BIAS, PROBE_RESAMPLE_NEIGHBOURS, PROBE_THREAD_WORKGROUP_SIZE } from "./PROBE_CLIPMAP.js";
35
+ import {
36
+ PROBE_DEPTH_LIMIT,
37
+ PROBE_RESAMPLE_NEIGHBOURS,
38
+ PROBE_THREAD_WORKGROUP_SIZE
39
+ } from "./PROBE_CLIPMAP.js";
31
40
 
32
41
  /**
33
42
  * @type {WebGPUStruct}
@@ -41,7 +50,7 @@ export const PROBE_RESAMPLE_SETTINGS = WebGPUStruct.from({
41
50
  depth_resolution: u32,
42
51
  /** the frame, of the frames the clipmap has recorded */
43
52
  frame: u32,
44
- /** the short mean's response, τ, in frames: how fast a neighbour's history goes stale */
53
+ /** τ, in frames: how fast a neighbour's history goes stale */
45
54
  response_frames: f32,
46
55
  }, "ProbeResampleSettings");
47
56
 
@@ -99,7 +108,7 @@ resources.createGroup()
99
108
  * B's own samples of its texel. Both are absolute, each held to the estimator's own floor of 10⁻⁵, so a
100
109
  * dark neighbour is not taken less for being dark;
101
110
  * - its freshness, `e^(−age / τ)`: age the frames since the neighbour's last update, τ
102
- * `response_frames`, the time over which a probe's own history follows a change.
111
+ * `response_frames`, the time over which a neighbour's history goes stale.
103
112
  * - A neighbour's texel no ray has reached, its count zero, is not taken.
104
113
  * - A probe whose first update this is, or a DEAD one, takes nothing: its depth is not yet its own, or
105
114
  * it is inside a solid.
@@ -115,13 +124,6 @@ export const shader_probe_clipmap_resample = ComputeShader.from({
115
124
  body: CodeChunk.from(
116
125
  //language=WGSL
117
126
  `
118
- // the j-th of the 26 neighbours: the 3×3×3 around the point, its centre skipped
119
- fn probe_resample_offset(j: u32) -> vec3<i32> {
120
- let index = j + select(0u, 1u, j >= 13u);
121
-
122
- return vec3<i32>(vec3<u32>(index % 3u, (index / 3u) % 3u, index / 9u)) - vec3<i32>(1);
123
- }
124
-
125
127
  // the variance of a texel's samples, luminance, from its estimator's words: the deviation's r in the second word's
126
128
  // high half, its g and b in the third; held to the estimator's own floor
127
129
  fn probe_resample_variance(words: vec4<u32>) -> f32 {
@@ -215,10 +217,7 @@ fn main(
215
217
  continue;
216
218
  }
217
219
 
218
- let moments = probe_clipmap_depth_moments(neighbour, toward);
219
- let spread = max(moments.y - moments.x * moments.x, 0.0) + ${PROBE_RECEIVER_BIAS} * ${PROBE_RECEIVER_BIAS};
220
- let gap = distance - moments.x;
221
- let visibility = spread / (spread + gap * gap);
220
+ let visibility = probe_resample_visibility(probe_clipmap_depth_moments(neighbour, toward), distance);
222
221
 
223
222
  // the neighbour's texel the point is in: the variance of the mean read, its samples' over their count
224
223
  let uv = min(vec2<u32>(uv_octahedral_unit_encode(toward) * f32(n)), vec2<u32>(n - 1u));
@@ -239,6 +238,7 @@ fn main(
239
238
  }
240
239
  `, [
241
240
  chunk_probe_clipmap,
241
+ chunk_probe_clipmap_resample,
242
242
  chunk_probe_clipmap_pick,
243
243
  chunk_probe_clipmap_sample_radiance,
244
244
  chunk_folded_workgroup_index,
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @type {WebGPUStruct}
3
+ */
4
+ export const PROBE_RESAMPLE_RAYS_SETTINGS: WebGPUStruct;
5
+ /**
6
+ * Re-sample rays (Enshrouded's "share rays"): each listed probe B takes every ray its candidate A traced this
7
+ * frame (`shader_probe_clipmap_candidate`), each in the radiance texel of B's its hit is in, and traces nothing.
8
+ * Hits are diffuse only, so what a ray brings back is the same seen from B. A thread a radiance texel of each
9
+ * listed probe, through accumulate's launch, `PROBE_DISPATCH_TEXELS`; thread `i` of B takes A's rays
10
+ * `i, i + n_r², …`, so each is read once; the depth texels' threads do nothing. It adds each taken ray's radiance
11
+ * times its weight, and the weight, to B's texel's `probe_resamples` (`atomic_add_f32_storage`), over what the
12
+ * history re-sample pass wrote there, or over nothing, the buffer cleared. Accumulate pools them with the texel's
13
+ * own rays (`chunk_probe_clipmap_resampled`).
14
+ *
15
+ * - **A ray**: a front-face hit, or a miss. An unresolved ray and a back face are not taken.
16
+ * - A hit at `p`, from A's ray origin along its direction: B sees it along `p − o_B`, and only if the surface
17
+ * faces B, by the hit's normal.
18
+ * - A miss sees the sky along its own direction from anywhere, at the depth limit.
19
+ * - **Its weight**:
20
+ * - The weight A was drawn at, the draw's density divided out.
21
+ * - B's visibility of it, `probe_resample_visibility` over B's depth moments that way, its distance in B's
22
+ * spacings held to the depth limit, as the moments are: the hit at the distance B's own rays found there is
23
+ * taken, an occluder between or a gap past it weighs it down. A sky ray or a far hit is at the limit, taken where
24
+ * B's own rays went past it too.
25
+ * - Where A's update was guided, its rays' density: `(R_A / n_r²) / expected`, `expected` the rays A's guide gave
26
+ * the texel the ray left from (`probe_clipmap_guide_expected`), so that the brighter texels the guide favours
27
+ * are not over-represented in B's. A uniform update's rays weigh one.
28
+ *
29
+ * Reads the depth atlas as the last publish left it, and the frame's rays after light has added to them.
30
+ *
31
+ * @type {ComputeShader}
32
+ */
33
+ export const shader_probe_clipmap_resample_rays: ComputeShader;
34
+ import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
35
+ import { ComputeShader } from "../../../shader/ComputeShader.js";
36
+ //# sourceMappingURL=shader_probe_clipmap_resample_rays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_probe_clipmap_resample_rays.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.js"],"names":[],"mappings":"AA0CA;;GAEG;AACH,2CAFU,YAAY,CAaU;AAwBhC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,iDAFU,aAAa,CA8HpB;6BA3N0B,sCAAsC;8BAHrC,kCAAkC"}
@@ -0,0 +1,233 @@
1
+ import { chunk_atomic_add_f32_storage } from "../../../shader/chunk/atomic/chunk_atomic_add_f32_storage.js";
2
+ import { chunk_rgbe9995_decode } from "../../../shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.js";
3
+ import {
4
+ chunk_uv_octahedral_unit_decode
5
+ } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
6
+ import {
7
+ chunk_uv_octahedral_unit_encode
8
+ } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
9
+ import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
10
+ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
11
+ import { ComputeShader } from "../../../shader/ComputeShader.js";
12
+ import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
13
+ import { u32 } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
14
+ import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
15
+ import { BRICK_TRACE_HIT, BRICK_TRACE_MISS } from "../brick/BRICK_CLIPMAP.js";
16
+ import {
17
+ chunk_probe_clipmap,
18
+ chunk_probe_clipmap_guide,
19
+ chunk_probe_clipmap_guide_expected,
20
+ chunk_probe_clipmap_ray_layout,
21
+ chunk_probe_clipmap_ray_origin,
22
+ PROBE_CANDIDATES_READ_RESOURCE,
23
+ PROBE_DEPTH_HISTORY_RESOURCE,
24
+ PROBE_GUIDE_READ_RESOURCE,
25
+ PROBE_LEVELS_RESOURCE,
26
+ PROBE_ORIGINS_READ_RESOURCE,
27
+ PROBE_RAY_SUMS_READ_RESOURCE,
28
+ PROBE_RAYS_READ_RESOURCE,
29
+ PROBE_RECORDS_READ_RESOURCE,
30
+ PROBE_RESAMPLES_ADD_RESOURCE,
31
+ PROBE_STATES_READ_RESOURCE,
32
+ PROBE_TRACE_READ_RESOURCE
33
+ } from "./chunk_probe_clipmap.js";
34
+ import {
35
+ chunk_probe_clipmap_pick,
36
+ PROBE_DEPTH_SAMPLER_RESOURCE,
37
+ PROBE_INDIRECTION_READ_RESOURCE,
38
+ PROBE_SAMPLING_RESOURCE
39
+ } from "./chunk_probe_clipmap_pick.js";
40
+ import { chunk_probe_clipmap_resample } from "./chunk_probe_clipmap_resample.js";
41
+ import { PROBE_DEPTH_LIMIT, PROBE_THREAD_WORKGROUP_SIZE } from "./PROBE_CLIPMAP.js";
42
+
43
+ /**
44
+ * @type {WebGPUStruct}
45
+ */
46
+ export const PROBE_RESAMPLE_RAYS_SETTINGS = WebGPUStruct.from({
47
+ /** probes a frame updates at most: the trace list's bound */
48
+ trace_capacity: u32,
49
+ /** octahedral radiance texels a side, n_r */
50
+ radiance_resolution: u32,
51
+ /** octahedral depth texels a side, n_d: the texels' launch is accumulate's, n_r² + n_d² a probe */
52
+ depth_resolution: u32,
53
+ /** rays a uniform update casts, R, which decides whether an update is guided */
54
+ rays_per_probe: u32,
55
+ /** updates between a probe's uniform ones, `PROBE_UNIFORM_PERIOD` */
56
+ uniform_period: u32,
57
+ }, "ProbeResampleRaysSettings");
58
+
59
+ const resources = new ShaderResourceSetDescriptor();
60
+
61
+ resources.setImmediate("settings", PROBE_RESAMPLE_RAYS_SETTINGS);
62
+
63
+ resources.createGroup()
64
+ .add(PROBE_TRACE_READ_RESOURCE)
65
+ .add(PROBE_ORIGINS_READ_RESOURCE)
66
+ .add(PROBE_CANDIDATES_READ_RESOURCE)
67
+ .add(PROBE_RAYS_READ_RESOURCE)
68
+ .add(PROBE_RAY_SUMS_READ_RESOURCE)
69
+ .add(PROBE_GUIDE_READ_RESOURCE)
70
+ .add(PROBE_RESAMPLES_ADD_RESOURCE);
71
+
72
+ resources.createGroup()
73
+ .add(PROBE_LEVELS_RESOURCE)
74
+ .add(PROBE_SAMPLING_RESOURCE)
75
+ .add(PROBE_INDIRECTION_READ_RESOURCE)
76
+ .add(PROBE_STATES_READ_RESOURCE)
77
+ .add(PROBE_RECORDS_READ_RESOURCE)
78
+ .add(PROBE_DEPTH_HISTORY_RESOURCE)
79
+ .add(PROBE_DEPTH_SAMPLER_RESOURCE);
80
+
81
+ /**
82
+ * Re-sample rays (Enshrouded's "share rays"): each listed probe B takes every ray its candidate A traced this
83
+ * frame (`shader_probe_clipmap_candidate`), each in the radiance texel of B's its hit is in, and traces nothing.
84
+ * Hits are diffuse only, so what a ray brings back is the same seen from B. A thread a radiance texel of each
85
+ * listed probe, through accumulate's launch, `PROBE_DISPATCH_TEXELS`; thread `i` of B takes A's rays
86
+ * `i, i + n_r², …`, so each is read once; the depth texels' threads do nothing. It adds each taken ray's radiance
87
+ * times its weight, and the weight, to B's texel's `probe_resamples` (`atomic_add_f32_storage`), over what the
88
+ * history re-sample pass wrote there, or over nothing, the buffer cleared. Accumulate pools them with the texel's
89
+ * own rays (`chunk_probe_clipmap_resampled`).
90
+ *
91
+ * - **A ray**: a front-face hit, or a miss. An unresolved ray and a back face are not taken.
92
+ * - A hit at `p`, from A's ray origin along its direction: B sees it along `p − o_B`, and only if the surface
93
+ * faces B, by the hit's normal.
94
+ * - A miss sees the sky along its own direction from anywhere, at the depth limit.
95
+ * - **Its weight**:
96
+ * - The weight A was drawn at, the draw's density divided out.
97
+ * - B's visibility of it, `probe_resample_visibility` over B's depth moments that way, its distance in B's
98
+ * spacings held to the depth limit, as the moments are: the hit at the distance B's own rays found there is
99
+ * taken, an occluder between or a gap past it weighs it down. A sky ray or a far hit is at the limit, taken where
100
+ * B's own rays went past it too.
101
+ * - Where A's update was guided, its rays' density: `(R_A / n_r²) / expected`, `expected` the rays A's guide gave
102
+ * the texel the ray left from (`probe_clipmap_guide_expected`), so that the brighter texels the guide favours
103
+ * are not over-represented in B's. A uniform update's rays weigh one.
104
+ *
105
+ * Reads the depth atlas as the last publish left it, and the frame's rays after light has added to them.
106
+ *
107
+ * @type {ComputeShader}
108
+ */
109
+ export const shader_probe_clipmap_resample_rays = ComputeShader.from({
110
+ label: "Probe Clipmap Resample Rays",
111
+ resources,
112
+ body: CodeChunk.from(
113
+ //language=WGSL
114
+ `
115
+ @compute @workgroup_size(${PROBE_THREAD_WORKGROUP_SIZE})
116
+ fn main(
117
+ @builtin(workgroup_id) workgroup_id: vec3<u32>,
118
+ @builtin(local_invocation_index) lane: u32,
119
+ ) {
120
+ let thread = folded_workgroup_index(workgroup_id) * PROBE_THREAD_WORKGROUP_SIZE + lane;
121
+
122
+ let n = settings.radiance_resolution;
123
+ let texels = n * n;
124
+ let per_probe = texels + settings.depth_resolution * settings.depth_resolution;
125
+
126
+ if (thread >= min(probe_trace.count, settings.trace_capacity) * per_probe) {
127
+ return;
128
+ }
129
+
130
+ let k = thread / per_probe;
131
+ let i = thread % per_probe;
132
+
133
+ if (i >= texels) {
134
+ return;
135
+ }
136
+
137
+ let drawn = probe_candidates[k];
138
+ let candidate = drawn.listed;
139
+
140
+ if (candidate == PROBE_CLIPMAP_NONE) {
141
+ return;
142
+ }
143
+
144
+ let slot = probe_trace.elements[k];
145
+ let origin = probe_origins[k];
146
+ let spacing = origin.w;
147
+
148
+ let source = probe_trace.elements[candidate];
149
+ let source_origin = probe_origins[candidate];
150
+ let span = probe_clipmap_probe_rays(candidate);
151
+ let guided = probe_clipmap_guided(probe_states[source].x, settings.uniform_period, settings.rays_per_probe, texels);
152
+ let base = candidate * probe_clipmap_guide_words(n);
153
+
154
+ // every ray of the candidate once, n_r² threads apart
155
+ let rounds = (span.y + texels - 1u) / texels;
156
+
157
+ for (var round = 0u; round < rounds; round++) {
158
+ let r = i + round * texels;
159
+
160
+ if (r >= span.y) {
161
+ break;
162
+ }
163
+
164
+ let ray = probe_rays[span.x + r];
165
+ let kind = ray.flags & PROBE_RAY_KIND_MASK;
166
+
167
+ if ((kind != ${BRICK_TRACE_HIT}u && kind != ${BRICK_TRACE_MISS}u) || (ray.flags & PROBE_RAY_BACK_FACE) != 0u) {
168
+ continue;
169
+ }
170
+
171
+ let direction = uv_octahedral_unit_decode(unpack2x16unorm(ray.direction));
172
+
173
+ var seen = direction;
174
+ var distance = ${PROBE_DEPTH_LIMIT};
175
+
176
+ if (kind == ${BRICK_TRACE_HIT}u) {
177
+ let hit = probe_clipmap_ray_origin(source_origin, source, ray.direction) + ray.t * direction;
178
+ let to_hit = hit - origin.xyz;
179
+ let length_to_hit = length(to_hit);
180
+ let normal = uv_octahedral_unit_decode(unpack2x16unorm(ray.normal));
181
+
182
+ // B sees the surface's back, or stands on it
183
+ if (dot(normal, to_hit) >= 0.0 || length_to_hit <= 0.0) {
184
+ continue;
185
+ }
186
+
187
+ seen = to_hit / length_to_hit;
188
+ distance = min(length_to_hit / spacing, ${PROBE_DEPTH_LIMIT});
189
+ }
190
+
191
+ var weight = drawn.weight * probe_resample_visibility(probe_clipmap_depth_moments(slot, seen), distance);
192
+
193
+ if (guided) {
194
+ // the texel of A's the ray left from: its jitter keeps it inside
195
+ let left = min(vec2<u32>(uv_octahedral_unit_encode(direction) * f32(n)), vec2<u32>(n - 1u));
196
+ let expected = probe_clipmap_guide_expected(base, left.y * n + left.x, span.y, n);
197
+
198
+ if (expected <= 0.0) {
199
+ continue;
200
+ }
201
+
202
+ weight *= f32(span.y) / (f32(texels) * expected);
203
+ }
204
+
205
+ if (weight <= 0.0) {
206
+ continue;
207
+ }
208
+
209
+ let at = min(vec2<u32>(uv_octahedral_unit_encode(seen) * f32(n)), vec2<u32>(n - 1u));
210
+ let cell = 4u * (k * texels + at.y * n + at.x);
211
+ let radiance = rgbe9995_decode(ray.light) * weight;
212
+
213
+ atomic_add_f32_storage(&probe_resamples[cell], radiance.r);
214
+ atomic_add_f32_storage(&probe_resamples[cell + 1u], radiance.g);
215
+ atomic_add_f32_storage(&probe_resamples[cell + 2u], radiance.b);
216
+ atomic_add_f32_storage(&probe_resamples[cell + 3u], weight);
217
+ }
218
+ }
219
+ `, [
220
+ chunk_probe_clipmap,
221
+ chunk_probe_clipmap_ray_layout,
222
+ chunk_probe_clipmap_ray_origin,
223
+ chunk_probe_clipmap_guide,
224
+ chunk_probe_clipmap_guide_expected,
225
+ chunk_probe_clipmap_pick,
226
+ chunk_probe_clipmap_resample,
227
+ chunk_folded_workgroup_index,
228
+ chunk_uv_octahedral_unit_decode,
229
+ chunk_uv_octahedral_unit_encode,
230
+ chunk_rgbe9995_decode,
231
+ chunk_atomic_add_f32_storage,
232
+ ]),
233
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_schedule.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js"],"names":[],"mappings":"AAeA;;GAEG;AACH,sCAFU,YAAY,CAWM;AAa5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,4CAFU,aAAa,CA6DpB;6BAxH0B,sCAAsC;8BAHrC,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_schedule.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js"],"names":[],"mappings":"AAgBA;;GAEG;AACH,sCAFU,YAAY,CAWM;AAa5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,4CAFU,aAAa,CA8DpB;6BAzH0B,sCAAsC;8BAHrC,kCAAkC"}
@@ -1,4 +1,5 @@
1
1
  import { chunk_folded_dispatch } from "../../../gpu_primitive/indirect/chunk_folded_dispatch.js";
2
+ import { chunk_divide_round_up_u32 } from "../../../shader/chunk/math/chunk_divide_round_up_u32.js";
2
3
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
3
4
  import { ComputeShader } from "../../../shader/ComputeShader.js";
4
5
  import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
@@ -19,8 +20,8 @@ import {
19
20
  export const PROBE_SCHEDULE_SETTINGS = WebGPUStruct.from({
20
21
  /** slots, which no active list outgrows */
21
22
  capacity: u32,
22
- /** keys over every cascade: what the wanted list holds at most */
23
- key_count: u32,
23
+ /** what the wanted list holds at most: every key, or fewer where the wants cannot want more */
24
+ wanted_capacity: u32,
24
25
  /** probes a frame updates at most, U = ⌊ray_budget / rays_per_probe⌋ */
25
26
  trace_capacity: u32,
26
27
  /** slots kept free beyond the frame's wanted points, ⌈capacity · PROBE_FREE_SLACK⌉ */
@@ -76,10 +77,10 @@ fn main() {
76
77
  let traced = max(settings.trace_capacity, 1u);
77
78
 
78
79
  atomicStore(&probe_counters[PROBE_COUNTER_WAITING], 0u);
79
- atomicStore(&probe_counters[PROBE_COUNTER_PERIOD], max((waiting + traced - 1u) / traced, 1u));
80
+ atomicStore(&probe_counters[PROBE_COUNTER_PERIOD], max(divide_round_up_u32(waiting, traced), 1u));
80
81
 
81
82
  // the slots short of the frame's wanted points and the slack
82
- let wanted = min(probe_wanted.count, settings.key_count);
83
+ let wanted = min(probe_wanted.count, settings.wanted_capacity);
83
84
  let room = wanted + settings.slack;
84
85
  let free = atomicLoad(&probe_counters[PROBE_COUNTER_FREE]);
85
86
 
@@ -113,7 +114,7 @@ fn main() {
113
114
  atomicStore(&probe_counters[PROBE_COUNTER_EVICTED], 0u);
114
115
 
115
116
  let live = min(probe_active_write.count, settings.capacity);
116
- let folded = folded_dispatch((live + PROBE_THREAD_WORKGROUP_SIZE - 1u) / PROBE_THREAD_WORKGROUP_SIZE);
117
+ let folded = folded_dispatch(divide_round_up_u32(live, PROBE_THREAD_WORKGROUP_SIZE));
117
118
 
118
119
  probe_dispatch[PROBE_DISPATCH_ACTIVE] = folded.x;
119
120
  probe_dispatch[PROBE_DISPATCH_ACTIVE + 1u] = folded.y;
@@ -121,6 +122,7 @@ fn main() {
121
122
  }
122
123
  `, [
123
124
  chunk_probe_clipmap,
125
+ chunk_divide_round_up_u32,
124
126
  chunk_folded_dispatch,
125
127
  ]),
126
128
  });
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_shade.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js"],"names":[],"mappings":"AAqDA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yCAFU,aAAa,CAyDpB;8BAlH2B,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_shade.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js"],"names":[],"mappings":"AAuDA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yCAFU,aAAa,CAyDpB;8BAlH2B,kCAAkC"}