@woosh/meep-engine 3.64.1 → 3.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/build/bundle-worker-terrain.js +1 -1
  4. package/package.json +1 -1
  5. package/src/core/binary/BinaryBuffer.d.ts +5 -0
  6. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  7. package/src/core/binary/BinaryBuffer.js +39 -5
  8. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts +65 -6
  9. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts.map +1 -1
  10. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.js +451 -101
  11. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +4 -2
  12. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -1
  13. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +4 -2
  14. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts +8 -1
  15. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts.map +1 -1
  16. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.js +45 -10
  17. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
  18. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +237 -119
  19. package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts +143 -0
  20. package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts.map +1 -0
  21. package/src/engine/graphics/ecs/grass/GrassSpecies.js +189 -0
  22. package/src/engine/graphics/ecs/grass/GrassSurface.d.ts +25 -0
  23. package/src/engine/graphics/ecs/grass/GrassSurface.d.ts.map +1 -0
  24. package/src/engine/graphics/ecs/grass/GrassSurface.js +32 -0
  25. package/src/engine/graphics/ecs/grass/GroundCover.d.ts +68 -0
  26. package/src/engine/graphics/ecs/grass/GroundCover.d.ts.map +1 -0
  27. package/src/engine/graphics/ecs/grass/GroundCover.js +85 -0
  28. package/src/engine/graphics3/GrassSurfaceSystem.d.ts +153 -0
  29. package/src/engine/graphics3/GrassSurfaceSystem.d.ts.map +1 -0
  30. package/src/engine/graphics3/GrassSurfaceSystem.js +1076 -0
  31. package/src/engine/graphics3/GroundCoverSystem.d.ts +33 -0
  32. package/src/engine/graphics3/GroundCoverSystem.d.ts.map +1 -0
  33. package/src/engine/graphics3/GroundCoverSystem.js +58 -0
  34. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  35. package/src/engine/network/NetworkSession.js +372 -110
  36. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  37. package/src/engine/network/orchestrator/NetworkPeer.js +6 -1
  38. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  39. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +9 -2
  40. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  41. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +325 -140
  42. package/src/engine/network/sim/SimActionExecutor.d.ts +4 -1
  43. package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
  44. package/src/engine/network/sim/SimActionExecutor.js +65 -9
  45. package/src/engine/network/state/PredictionHistory.d.ts.map +1 -1
  46. package/src/engine/network/state/PredictionHistory.js +6 -1
  47. package/src/engine/network/time/AdaptiveRenderDelay.d.ts +25 -14
  48. package/src/engine/network/time/AdaptiveRenderDelay.d.ts.map +1 -1
  49. package/src/engine/network/time/AdaptiveRenderDelay.js +38 -20
  50. package/src/engine/network/time/RenderPlayout.d.ts +23 -3
  51. package/src/engine/network/time/RenderPlayout.d.ts.map +1 -1
  52. package/src/engine/network/time/RenderPlayout.js +40 -4
  53. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  54. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts +5 -1
  55. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts.map +1 -1
  56. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.js +27 -1
  57. package/src/shade/device/shader/ShaderModuleCompiler.d.ts +2 -0
  58. package/src/shade/device/shader/ShaderModuleCompiler.d.ts.map +1 -1
  59. package/src/shade/device/shader/ShaderModuleCompiler.js +25 -2
  60. package/src/shade/playground/grass_surfaces/index.html +75 -0
  61. package/src/shade/playground/grass_surfaces/main.d.ts +2 -0
  62. package/src/shade/playground/grass_surfaces/main.d.ts.map +1 -0
  63. package/src/shade/playground/grass_surfaces/main.js +593 -0
  64. package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts +62 -0
  65. package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts.map +1 -0
  66. package/src/shade/playground/grass_surfaces/read_grass_surfaces.js +188 -0
  67. package/src/shade/playground/probe_clipmap_box/README.md +5 -1
  68. package/src/shade/playground/probe_clipmap_box/index.html +12 -0
  69. package/src/shade/playground/probe_clipmap_box/main.d.ts.map +1 -1
  70. package/src/shade/playground/probe_clipmap_box/main.js +15 -0
  71. package/src/shade/playground/probe_clipmap_box/scene.d.ts +8 -1
  72. package/src/shade/playground/probe_clipmap_box/scene.d.ts.map +1 -1
  73. package/src/shade/playground/probe_clipmap_box/scene.js +74 -6
  74. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  75. package/src/shade/renderer/Renderer.js +47 -43
  76. package/src/shade/renderer/extension/ViewTextures.d.ts +12 -5
  77. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  78. package/src/shade/renderer/extension/ViewTextures.js +19 -5
  79. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +3 -1
  80. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
  81. package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +6 -1
  82. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -0
  83. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
  84. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +10 -0
  85. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +7 -1
  86. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  87. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +46 -15
  88. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts +3 -2
  89. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts.map +1 -1
  90. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.js +3 -2
  91. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts +22 -0
  92. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts.map +1 -0
  93. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.js +247 -0
  94. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +50 -0
  95. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  96. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +101 -0
  97. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +2 -1
  98. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  99. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +2 -1
  100. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +8 -0
  101. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  102. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +12 -0
  103. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +12 -6
  104. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  105. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +35 -29
  106. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.d.ts.map +1 -1
  107. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js +4 -2
  108. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts.map +1 -1
  109. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js +6 -4
  110. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
  111. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +2 -1
  112. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts +6 -5
  113. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts.map +1 -1
  114. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js +15 -14
  115. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts.map +1 -1
  116. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.js +4 -2
  117. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +19 -2
  118. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  119. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +128 -10
  120. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +19 -1
  121. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  122. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +27 -2
  123. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +19 -11
  124. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
  125. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +35 -11
  126. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +3 -1
  128. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts +40 -0
  129. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts.map +1 -0
  130. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.js +174 -0
  131. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts +4 -4
  132. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.js +10 -10
  133. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts +31 -0
  134. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts.map +1 -0
  135. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.js +54 -0
  136. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts +8 -4
  137. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  138. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +10 -21
  139. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +7 -2
  140. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts.map +1 -1
  141. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +33 -29
  142. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +28 -0
  143. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -0
  144. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +138 -0
  145. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +13 -9
  146. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  147. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +18 -11
  148. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +1 -1
  149. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +4 -2
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +2 -3
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +5 -3
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +15 -30
  156. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +1 -1
  157. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +4 -2
  159. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +11 -0
  160. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
  161. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +29 -2
  162. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts +40 -0
  163. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts.map +1 -0
  164. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.js +126 -0
  165. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts +36 -0
  166. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts.map +1 -0
  167. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.js +221 -0
  168. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts +40 -0
  169. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts.map +1 -0
  170. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.js +86 -0
  171. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts +135 -0
  172. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -0
  173. package/src/shade/renderer/grass/blade/GPUGrassBlades.js +676 -0
  174. package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts +145 -0
  175. package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts.map +1 -0
  176. package/src/shade/renderer/grass/blade/GRASS_BLADE.js +179 -0
  177. package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts +63 -0
  178. package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts.map +1 -0
  179. package/src/shade/renderer/grass/blade/chunk_grass_blade.js +244 -0
  180. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts +58 -0
  181. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts.map +1 -0
  182. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.js +174 -0
  183. package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts +25 -0
  184. package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts.map +1 -0
  185. package/src/shade/renderer/grass/blade/grass_blade_id_draw.js +133 -0
  186. package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts +80 -0
  187. package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts.map +1 -0
  188. package/src/shade/renderer/grass/blade/grass_blade_mechanics.js +92 -0
  189. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +29 -0
  190. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -0
  191. package/src/shade/renderer/grass/blade/grass_blade_resolve.js +175 -0
  192. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts +14 -0
  193. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts.map +1 -0
  194. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.js +45 -0
  195. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts +61 -0
  196. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts.map +1 -0
  197. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.js +340 -0
  198. package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts +46 -0
  199. package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts.map +1 -0
  200. package/src/shade/renderer/grass/blade/shader_grass_cell_count.js +280 -0
  201. package/src/shade/renderer/grass/population/chunk_grass_population.d.ts +60 -0
  202. package/src/shade/renderer/grass/population/chunk_grass_population.d.ts.map +1 -0
  203. package/src/shade/renderer/grass/population/chunk_grass_population.js +171 -0
  204. package/src/shade/renderer/grass/press/GPUGrassPress.d.ts +99 -0
  205. package/src/shade/renderer/grass/press/GPUGrassPress.d.ts.map +1 -0
  206. package/src/shade/renderer/grass/press/GPUGrassPress.js +436 -0
  207. package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts +179 -0
  208. package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts.map +1 -0
  209. package/src/shade/renderer/grass/press/GRASS_PRESS.js +217 -0
  210. package/src/shade/renderer/grass/press/chunk_grass_press.d.ts +65 -0
  211. package/src/shade/renderer/grass/press/chunk_grass_press.d.ts.map +1 -0
  212. package/src/shade/renderer/grass/press/chunk_grass_press.js +296 -0
  213. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +31 -0
  214. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -0
  215. package/src/shade/renderer/grass/press/shader_grass_press_mark.js +169 -0
  216. package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts +27 -0
  217. package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts.map +1 -0
  218. package/src/shade/renderer/grass/press/shader_grass_press_stamp.js +183 -0
  219. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts +193 -0
  220. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts.map +1 -0
  221. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.js +1253 -0
  222. package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts +211 -0
  223. package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts.map +1 -0
  224. package/src/shade/renderer/grass/surface/GRASS_SURFACE.js +241 -0
  225. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts +82 -0
  226. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts.map +1 -0
  227. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.js +111 -0
  228. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts +39 -0
  229. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts.map +1 -0
  230. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.js +85 -0
  231. package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts +29 -0
  232. package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts.map +1 -0
  233. package/src/shade/renderer/grass/surface/chunk_grass_directory.js +112 -0
  234. package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts +27 -0
  235. package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts.map +1 -0
  236. package/src/shade/renderer/grass/surface/chunk_grass_slot.js +50 -0
  237. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts +21 -0
  238. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts.map +1 -0
  239. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.js +41 -0
  240. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts +32 -0
  241. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts.map +1 -0
  242. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.js +136 -0
  243. package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts +37 -0
  244. package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts.map +1 -0
  245. package/src/shade/renderer/grass/surface/chunk_grass_surfel.js +85 -0
  246. package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts +25 -0
  247. package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts.map +1 -0
  248. package/src/shade/renderer/grass/surface/chunk_grass_tile.js +52 -0
  249. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts +23 -0
  250. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts.map +1 -0
  251. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.js +87 -0
  252. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts +43 -0
  253. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -0
  254. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +265 -0
  255. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts +13 -0
  256. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts.map +1 -0
  257. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.js +49 -0
  258. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts +62 -0
  259. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts.map +1 -0
  260. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.js +162 -0
  261. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts +40 -0
  262. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts.map +1 -0
  263. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.js +155 -0
  264. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts +19 -0
  265. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts.map +1 -0
  266. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.js +58 -0
  267. package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts +30 -0
  268. package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts.map +1 -0
  269. package/src/shade/renderer/grass/surface/shader_grass_surface_want.js +251 -0
  270. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts +21 -0
  271. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts.map +1 -0
  272. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.js +75 -0
  273. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  274. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +4 -23
  275. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts +12 -0
  276. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts.map +1 -0
  277. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.js +29 -0
  278. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
  279. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +22 -0
  280. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  281. package/src/shade/renderer/scene/GPUSceneContext.js +3 -0
  282. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts +27 -0
  283. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts.map +1 -0
  284. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.js +38 -0
  285. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts +28 -0
  286. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts.map +1 -0
  287. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.js +58 -0
  288. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
  289. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +8 -0
  290. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +37 -0
  291. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -0
  292. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +148 -0
  293. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts +20 -0
  294. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts.map +1 -0
  295. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.js +169 -0
  296. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts +18 -0
  297. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts.map +1 -1
  298. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js +28 -0
  299. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts +13 -0
  300. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts.map +1 -0
  301. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.js +22 -0
  302. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  303. package/src/shade/renderer/water/GPUWaterRenderer.js +4 -0
  304. package/src/shade/renderer/wind/GPUSceneWind.d.ts +52 -5
  305. package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
  306. package/src/shade/renderer/wind/GPUSceneWind.js +164 -8
  307. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +3 -1
  308. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts.map +1 -1
  309. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +3 -1
  310. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -1
  311. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  312. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +18 -13
  313. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts +13 -0
  314. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts.map +1 -0
  315. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.js +23 -0
  316. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +1 -0
  317. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts.map +1 -1
  318. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +6 -1
  319. package/src/shade/renderer/wind/wind_field_add_resources.d.ts +11 -0
  320. package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
  321. package/src/shade/renderer/wind/wind_field_add_resources.js +15 -0
  322. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +1 -1
  323. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  324. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
@@ -21,6 +21,7 @@ import { ProbeClipmapDebugView } from "./debug/ProbeClipmapDebugView.js";
21
21
  import { PROBE_RECORD_STRUCT } from "./probe/chunk_probe_clipmap.js";
22
22
  import { PROBE_SAMPLING_STRUCT } from "./probe/chunk_probe_clipmap_pick.js";
23
23
  import { GPUProbeClipmap } from "./probe/GPUProbeClipmap.js";
24
+ import { graph_probe_clipmap_want_meshlets } from "./probe/graph_probe_clipmap_want_meshlets.js";
24
25
  import { PROBE_DEPTH_TEXEL_RAYS, PROBE_RAY_CASCADE_MASK, PROBE_TEXEL_RAYS } from "./probe/PROBE_CLIPMAP.js";
25
26
  import { ProbeClipmapHitWants } from "./probe/ProbeClipmapHitWants.js";
26
27
  import { ProbeClipmapIndirectLobe } from "./probe/ProbeClipmapIndirectLobe.js";
@@ -88,6 +89,17 @@ export class GPUProbeClipmapGI {
88
89
  /** The world cache's wants, the frustum's hits. @type {ProbeClipmapHitWants|undefined} */
89
90
  #hit_wants = undefined;
90
91
 
92
+ /**
93
+ * The frustum's wants from surfaces drawn apart from the G-buffer ({@link graph_want_surface}), each with what
94
+ * its pass keeps from frame to frame; the first {@link #surface_wants_used} are this frame's.
95
+ * @type {{wants: ProbeClipmapScreenWants, data: Object, bindings: Object, execute: function}[]}
96
+ */
97
+ #surface_wants = [];
98
+ #surface_wants_used = 0;
99
+
100
+ /** The frame's blue noise, which the surfaces' wants pick their pixels by. */
101
+ #stbn = null;
102
+
91
103
  /** The coarsest brick window's box, metres, which the world light clusters cull lights against. */
92
104
  #clusters_min = [0, 0, 0];
93
105
  #clusters_max = [0, 0, 0];
@@ -316,6 +328,9 @@ export class GPUProbeClipmapGI {
316
328
 
317
329
  this.#screen_wants.set({ depth, normal, camera: view.camera.buffer, stbn, resolution: view.resolution });
318
330
 
331
+ this.#stbn = stbn;
332
+ this.#surface_wants_used = 0;
333
+
319
334
  frustum.graph_update({
320
335
  graph,
321
336
  wants: this.#screen_wants,
@@ -394,6 +409,92 @@ export class GPUProbeClipmapGI {
394
409
  return this.#probe_clipmap !== undefined;
395
410
  }
396
411
 
412
+ /**
413
+ * Record the wants of a screen surface drawn apart from the G-buffer whose reader picks the frustum's probes a
414
+ * pixel (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.3): the water's interface. A pixel of each screen tile wants
415
+ * the cages its pick reads, as the G-buffer's pixels do (`ProbeClipmapScreenWants`).
416
+ *
417
+ * For a pass after this frame's {@link graph_update}, once the surface is drawn. Its wants are taken by the
418
+ * next frame's lifetime, so a probe the surface newly reads is there a frame after the surface is. Records
419
+ * nothing where there are no probes ({@link has_probes}): out of the mode it costs nothing.
420
+ *
421
+ * @param {Object} options
422
+ * @param {FrameGraph} options.graph
423
+ * @param {number} options.depth graph handle of the surface's reverse-Z depth, zero where it has none
424
+ * @param {number} options.normal graph handle of its normals, a `uint` texture: a channel holds a normal
425
+ * octahedral, as the G-buffer packs its own
426
+ * @param {number} [options.normal_channel] the channel that holds the normal, 0 to 3
427
+ * @param {boolean} [options.two_sided] whether the reader turns a normal that faces away from the eye to face it
428
+ * @param {GPUBuffer} options.camera the camera uniform the surface was drawn with
429
+ * @param {ArrayLike<number>} options.resolution the surface's pixels, x and y
430
+ */
431
+ graph_want_surface({ graph, depth, normal, normal_channel = 0, two_sided = false, camera, resolution }) {
432
+ assert.defined(graph, 'graph');
433
+
434
+ if (!this.has_probes) {
435
+ return;
436
+ }
437
+
438
+ const index = this.#surface_wants_used++;
439
+
440
+ if (index === this.#surface_wants.length) {
441
+ const entry = {
442
+ wants: new ProbeClipmapScreenWants(),
443
+ data: {},
444
+ bindings: {},
445
+ execute: (data, resources, context) => {
446
+ // as the frustum's clipmap holds its late set now
447
+ entry.wants.encode(context.encoder, data, resources, this.#probe_clipmap.write_want_bindings(entry.bindings));
448
+ },
449
+ };
450
+
451
+ this.#surface_wants.push(entry);
452
+ }
453
+
454
+ const entry = this.#surface_wants[index];
455
+
456
+ entry.wants.set({ depth, normal, normal_channel, two_sided, camera, stbn: this.#stbn, resolution });
457
+
458
+ const pass = graph.add("Probe Clipmap Want Surface", entry.data, entry.execute);
459
+
460
+ entry.wants.graph_declare(pass, entry.data);
461
+
462
+ // it writes the clipmap's own late set, which the graph does not hold
463
+ pass.make_side_effect();
464
+ }
465
+
466
+ /**
467
+ * Record the wants of a list of meshlets a forward pass draws, whose fragments pick the frustum's probes
468
+ * (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.3): each wants the cages a reader anywhere inside its box can
469
+ * read (`graph_probe_clipmap_want_meshlets`).
470
+ *
471
+ * For a pass after this frame's {@link graph_update}; taken by the next frame's lifetime, as
472
+ * {@link graph_want_surface}'s are. Records nothing where there are no probes ({@link has_probes}).
473
+ *
474
+ * @param {Object} options
475
+ * @param {FrameGraph} options.graph
476
+ * @param {import("../../scene/GPUSceneContext.js").GPUSceneContext} options.scene the meshlets' scene
477
+ * @param {number} options.camera graph handle of the view's camera uniform
478
+ * @param {number} options.meshlet_collection graph handle of the list, `MESHLET_COLLECTION_STRUCT`
479
+ * @param {number} options.meshlet_iterator_command graph handle of the indirect dispatch that walks the list
480
+ */
481
+ graph_want_meshlets({ graph, scene, camera, meshlet_collection, meshlet_iterator_command }) {
482
+ assert.defined(graph, 'graph');
483
+
484
+ if (!this.has_probes) {
485
+ return;
486
+ }
487
+
488
+ graph_probe_clipmap_want_meshlets({
489
+ graph,
490
+ clipmap: this.#probe_clipmap,
491
+ scene,
492
+ camera,
493
+ meshlet_collection,
494
+ meshlet_iterator_command,
495
+ });
496
+ }
497
+
397
498
  /**
398
499
  * Put what the probes' readers bind into `bindings`, `PROBE_CLIPMAP_SAMPLING_GROUP` but its sampler:
399
500
  * once {@link has_probes}, the probes as this frame's {@link graph_update} left them
@@ -210,7 +210,8 @@ export class ProbeClipmapSettings {
210
210
  /**
211
211
  * Rays the frustum's probes trace a frame at most, `FRUSTUM_RAY_BUDGET_FRACTION` of {@link ray_budget}
212
212
  * rounded down, so `floor(frustum_ray_budget / rays_per_probe)` of them update a frame and every wanted one
213
- * is traced again after as many frames as that takes.
213
+ * is traced again after as many frames as that takes, an idle one, live and wanted by nothing, once in
214
+ * `probe_clipmap_idle_periods` of those.
214
215
  * @returns {number}
215
216
  */
216
217
  get frustum_ray_budget(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"ProbeClipmapSettings.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH;IAaI;;;OAGG;IACH,mCAIC;IAjBD;;;;OAIG;IACH,kCAEC;IAsBD;;;OAGG;IACH,wCAKC;IAjBD;;;OAGG;IACH,uCAEC;IAyBD;;OAEG;IACH,gCAKC;IAlBD;;;;;OAKG;IACH,+BAEC;IAuBD;;OAEG;IACH,kCAIC;IAhBD;;;;OAIG;IACH,iCAEC;IAuBD;;OAEG;IACH,mCAKC;IAlBD;;;;;OAKG;IACH,kCAEC;IAyBD;;;OAGG;IACH,mCAMC;IArBD;;;;;;OAMG;IACH,kCAEC;IAsCD;;;OAGG;IACH,oCAKC;IA/BD;;;;;;;;;;;;;;;;;OAiBG;IACH,mCAEC;IAsCD;;;OAGG;IACH,mCAIC;IA/BD;;;;;;;;;;;;;;;;;;OAkBG;IACH,kCAEC;IAuBD;;;OAGG;IACH,mCAIC;IAjBD;;;;OAIG;IACH,kCAEC;IAsBD;;;OAGG;IACH,wCAKC;IAjBD;;;OAGG;IACH,uCAEC;IAyBD;;OAEG;IACH,6BAKC;IAlBD;;;;;OAKG;IACH,4BAEC;IAuBD;;;OAGG;IACH,mCAMC;IAnBD;;;;OAIG;IACH,kCAEC;IAyBD;;OAEG;IACH,gCAKC;IAjBD;;;;OAIG;IACH,+BAEC;IAuBD;;;;OAIG;IACH,8BAKC;IAnBD;;;;OAIG;IACH,6BAEC;IAyBD;;;OAGG;IACH,0BAIC;IAjBD;;;;OAIG;IACH,yBAEC;IAYD;;;;;OAKG;IACH,iCAEC;IAED;;;OAGG;IACH,+BAEC;IAeD;;;OAGG;IACH,yCAIC;IAnBD;;;;;;OAMG;IACH,wCAEC;IAuBD;;OAEG;IACH,+CAMC;IAlBD;;;;OAIG;IACH,8CAEC;IAwBD;;OAEG;IACH,4CAKC;IAjBD;;;;OAIG;IACH,2CAEC;IAuBD;;;OAGG;IACH,0CAKC;IAlBD;;;;OAIG;IACH,yCAEC;IA2BD;;OAEG;IACH,+BAKC;IApBD;;;;;;;OAOG;IACH,8BAEC;IAyBD;;OAEG;IACH,mCAIC;IAlBD;;;;;;OAMG;IACH,kCAEC;IAwBD;;OAEG;IACH,+BAIC;IAlBD;;;;;;OAMG;IACH,8BAEC;IAsBD;;OAEG;IACH,0BAIC;IAhBD;;;;OAIG;IACH,yBAEC;;CAUJ"}
1
+ {"version":3,"file":"ProbeClipmapSettings.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH;IAaI;;;OAGG;IACH,mCAIC;IAjBD;;;;OAIG;IACH,kCAEC;IAsBD;;;OAGG;IACH,wCAKC;IAjBD;;;OAGG;IACH,uCAEC;IAyBD;;OAEG;IACH,gCAKC;IAlBD;;;;;OAKG;IACH,+BAEC;IAuBD;;OAEG;IACH,kCAIC;IAhBD;;;;OAIG;IACH,iCAEC;IAuBD;;OAEG;IACH,mCAKC;IAlBD;;;;;OAKG;IACH,kCAEC;IAyBD;;;OAGG;IACH,mCAMC;IArBD;;;;;;OAMG;IACH,kCAEC;IAsCD;;;OAGG;IACH,oCAKC;IA/BD;;;;;;;;;;;;;;;;;OAiBG;IACH,mCAEC;IAsCD;;;OAGG;IACH,mCAIC;IA/BD;;;;;;;;;;;;;;;;;;OAkBG;IACH,kCAEC;IAuBD;;;OAGG;IACH,mCAIC;IAjBD;;;;OAIG;IACH,kCAEC;IAsBD;;;OAGG;IACH,wCAKC;IAjBD;;;OAGG;IACH,uCAEC;IAyBD;;OAEG;IACH,6BAKC;IAlBD;;;;;OAKG;IACH,4BAEC;IAuBD;;;OAGG;IACH,mCAMC;IAnBD;;;;OAIG;IACH,kCAEC;IAyBD;;OAEG;IACH,gCAKC;IAjBD;;;;OAIG;IACH,+BAEC;IAuBD;;;;OAIG;IACH,8BAKC;IAnBD;;;;OAIG;IACH,6BAEC;IAyBD;;;OAGG;IACH,0BAIC;IAjBD;;;;OAIG;IACH,yBAEC;IAYD;;;;;;OAMG;IACH,iCAEC;IAED;;;OAGG;IACH,+BAEC;IAeD;;;OAGG;IACH,yCAIC;IAnBD;;;;;;OAMG;IACH,wCAEC;IAuBD;;OAEG;IACH,+CAMC;IAlBD;;;;OAIG;IACH,8CAEC;IAwBD;;OAEG;IACH,4CAKC;IAjBD;;;;OAIG;IACH,2CAEC;IAuBD;;;OAGG;IACH,0CAKC;IAlBD;;;;OAIG;IACH,yCAEC;IA2BD;;OAEG;IACH,+BAKC;IApBD;;;;;;;OAOG;IACH,8BAEC;IAyBD;;OAEG;IACH,mCAIC;IAlBD;;;;;;OAMG;IACH,kCAEC;IAwBD;;OAEG;IACH,+BAIC;IAlBD;;;;;;OAMG;IACH,8BAEC;IAsBD;;OAEG;IACH,0BAIC;IAhBD;;;;OAIG;IACH,yBAEC;;CAUJ"}
@@ -379,7 +379,8 @@ export class ProbeClipmapSettings {
379
379
  /**
380
380
  * Rays the frustum's probes trace a frame at most, `FRUSTUM_RAY_BUDGET_FRACTION` of {@link ray_budget}
381
381
  * rounded down, so `floor(frustum_ray_budget / rays_per_probe)` of them update a frame and every wanted one
382
- * is traced again after as many frames as that takes.
382
+ * is traced again after as many frames as that takes, an idle one, live and wanted by nothing, once in
383
+ * `probe_clipmap_idle_periods` of those.
383
384
  * @returns {number}
384
385
  */
385
386
  get frustum_ray_budget() {
@@ -121,6 +121,14 @@ export class GPUBrickClipmap {
121
121
  * @returns {Object} bindings
122
122
  */
123
123
  write_bindings(bindings: any): any;
124
+ /**
125
+ * The atlas's footprint as `tile_atlas_slot_shift` packs it: what every reader of the bricks takes in
126
+ * its immediate data as `brick_atlas_shift` and passes to `chunk_brick_clipmap_sample`. It changes
127
+ * only when a grow widens the atlas, in {@link graph_update}: take it after that, each frame, as the
128
+ * atlas itself.
129
+ * @returns {number}
130
+ */
131
+ get atlas_shift(): number;
124
132
  /**
125
133
  * Slots of the atlas.
126
134
  * @returns {number}
@@ -1 +1 @@
1
- {"version":3,"file":"GPUBrickClipmap.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js"],"names":[],"mappings":"AA6FA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;GAGG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAkKI;;;;;;;;OAQG;IACH;QAN2B,aAAa,EAA7B,MAAM;QACU,UAAU,EAA1B,MAAM;QAGU,UAAU,EAA1B,MAAM;OAgGhB;IAxQD;;;OAGG;IACH,wBAHU,MAAM,CAGF;IAEd;;;;OAIG;IACH,qBAHU,MAAM,CAGL;IAEX;;;;OAIG;IACH,qBAHU,MAAM,CAGL;IAwPX;;OAEG;IACH,4BAEC;IAED;;OAEG;IACH,4BAEC;IAED;;OAEG;IACH,4BAEC;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;;;;OAOG;IACH,mCAQC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;OAIG;IACH,gBAJW,MAAM,QACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,sBAFW,UAAU,MAAM,CAAC,QAiB3B;IAED;;;OAGG;IACH,oBAHW,oBAAoB,GAClB,OAAO,CAMnB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH;QAb+B,KAAK,EAAzB,UAAU;QACM,CAAC,EAAjB,MAAM;QACU,CAAC,EAAjB,MAAM;QACU,CAAC,EAAjB,MAAM;QACU,MAAM,EAAtB,MAAM;QAC4B,SAAS,EAA3C,UAAU,aAAa,CAAC;QACiB,gBAAgB,GAAzD,UAAU,mBAAmB,CAAC;QACA,KAAK,EAAnC,eAAe,GAAC,IAAI;QACH,MAAM,GAAvB,MAAM;QAEJ,MAAM,CAiHlB;IAgWD,gBAcC;;CACJ;mCAr9BY,OAAO,4BAA4B,EAAE,oBAAoB;yBACzD,OAAO,iEAAiE,EAAE,UAAU;8BACpF,OAAO,mCAAmC,EAAE,eAAe;;;;;;;WA+C1D,UAAU;;;;WACV,MAAM;;;;;;UACN,MAAM;;;;;aAGN,MAAM;;;;sBAEN,MAAM;;;;;mBAEN,MAAM;;;;gBACN,MAAM;mBACN,MAAM;;;;;;;;;;WAGN,eAAe;;;;;;aAEf,eAAe;;;+BAON,UAAU,QAAE,oBAAoB,KAAG,IAAI;;;;;;;;;iCAUvC,UAAU,QAAE,oBAAoB,KAAG,IAAI;;+BA1G/B,0CAA0C"}
1
+ {"version":3,"file":"GPUBrickClipmap.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js"],"names":[],"mappings":"AA8FA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;GAGG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAkKI;;;;;;;;OAQG;IACH;QAN2B,aAAa,EAA7B,MAAM;QACU,UAAU,EAA1B,MAAM;QAGU,UAAU,EAA1B,MAAM;OAgGhB;IAxQD;;;OAGG;IACH,wBAHU,MAAM,CAGF;IAEd;;;;OAIG;IACH,qBAHU,MAAM,CAGL;IAEX;;;;OAIG;IACH,qBAHU,MAAM,CAGL;IAwPX;;OAEG;IACH,4BAEC;IAED;;OAEG;IACH,4BAEC;IAED;;OAEG;IACH,4BAEC;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;;;;OAOG;IACH,mCAQC;IAED;;;;;;OAMG;IACH,0BAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;OAIG;IACH,gBAJW,MAAM,QACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,sBAFW,UAAU,MAAM,CAAC,QAiB3B;IAED;;;OAGG;IACH,oBAHW,oBAAoB,GAClB,OAAO,CAMnB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH;QAb+B,KAAK,EAAzB,UAAU;QACM,CAAC,EAAjB,MAAM;QACU,CAAC,EAAjB,MAAM;QACU,CAAC,EAAjB,MAAM;QACU,MAAM,EAAtB,MAAM;QAC4B,SAAS,EAA3C,UAAU,aAAa,CAAC;QACiB,gBAAgB,GAAzD,UAAU,mBAAmB,CAAC;QACA,KAAK,EAAnC,eAAe,GAAC,IAAI;QACH,MAAM,GAAvB,MAAM;QAEJ,MAAM,CAiHlB;IAgWD,gBAcC;;CACJ;mCAh+BY,OAAO,4BAA4B,EAAE,oBAAoB;yBACzD,OAAO,iEAAiE,EAAE,UAAU;8BACpF,OAAO,mCAAmC,EAAE,eAAe;;;;;;;WA+C1D,UAAU;;;;WACV,MAAM;;;;;;UACN,MAAM;;;;;aAGN,MAAM;;;;sBAEN,MAAM;;;;;mBAEN,MAAM;;;;gBACN,MAAM;mBACN,MAAM;;;;;;;;;;WAGN,eAAe;;;;;;aAEf,eAAe;;;+BAON,UAAU,QAAE,oBAAoB,KAAG,IAAI;;;;;;;;;iCAUvC,UAAU,QAAE,oBAAoB,KAAG,IAAI;;+BA3G/B,0CAA0C"}
@@ -25,6 +25,7 @@ import {
25
25
  } from "../../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
26
26
  import { graph_import_buffer } from "../../../shader/graph/graph_import_buffer.js";
27
27
  import { GPUTileAtlas3D } from "../../../texture/atlas/GPUTileAtlas3D.js";
28
+ import { tile_atlas_slot_shift } from "../../../texture/atlas/tile_atlas_slot_shift.js";
28
29
  import {
29
30
  BRICK_OCCUPANCY_BLOCK,
30
31
  BRICK_STAGING_WORDS,
@@ -473,6 +474,17 @@ export class GPUBrickClipmap {
473
474
  return bindings;
474
475
  }
475
476
 
477
+ /**
478
+ * The atlas's footprint as `tile_atlas_slot_shift` packs it: what every reader of the bricks takes in
479
+ * its immediate data as `brick_atlas_shift` and passes to `chunk_brick_clipmap_sample`. It changes
480
+ * only when a grow widens the atlas, in {@link graph_update}: take it after that, each frame, as the
481
+ * atlas itself.
482
+ * @returns {number}
483
+ */
484
+ get atlas_shift() {
485
+ return tile_atlas_slot_shift(this.#atlas.slots_x, this.#atlas.slots_y);
486
+ }
487
+
476
488
  /**
477
489
  * Slots of the atlas.
478
490
  * @returns {number}
@@ -45,15 +45,19 @@ export const BRICK_LEVELS_RESOURCE: ShaderResourceDescriptor;
45
45
  * A brick's distance at a point of its cell, where its slot sits in the atlas, and the field's gradient.
46
46
  *
47
47
  * ```wgsl
48
- * fn brick_clipmap_sample(slot: u32, local: vec3<f32>, voxel: f32) -> f32 // local in voxels from the cell's corner
49
- * fn brick_clipmap_slot_texel(slot: u32) -> vec3<u32> // the slot's texel 0 in the atlas
50
- * fn brick_clipmap_normal(slot: u32, local: vec3<f32>) -> vec3<f32> // out of the solid, unit length
48
+ * fn brick_clipmap_sample(slot: u32, local: vec3<f32>, voxel: f32, atlas_shift: u32) -> f32 // local in voxels from the cell's corner
49
+ * fn brick_clipmap_slot_texel(slot: u32, atlas_shift: u32) -> vec3<u32> // the slot's texel 0 in the atlas
50
+ * fn brick_clipmap_normal(slot: u32, local: vec3<f32>, atlas_shift: u32) -> vec3<f32> // out of the solid, unit length
51
51
  * ```
52
52
  *
53
53
  * One hardware trilinear tap of the atlas at texel `slot_origin + 0.5 + local`, `local` clamped to the
54
54
  * brick's [0, 7]: it never reads a neighbouring slot (§7.2). The gradient is a tetrahedral one, four
55
55
  * taps half a voxel off, each clamped the same way.
56
56
  *
57
+ * `atlas_shift` is the atlas's footprint, `GPUBrickClipmap#atlas_shift`, which every reader takes in its
58
+ * immediate data and passes down: a slot is found with shifts (`tile_atlas_slot_origin_shift`), with no
59
+ * texture query and no divide in front of the tap.
60
+ *
57
61
  * @type {CodeChunk}
58
62
  */
59
63
  export const chunk_brick_clipmap_sample: CodeChunk;
@@ -98,9 +102,11 @@ export const chunk_brick_clipmap_march: CodeChunk;
98
102
  * The first surface along a ray through the brick clipmap (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §7.9).
99
103
  *
100
104
  * ```wgsl
101
- * fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_max: f32, cascade_count: u32) -> BrickClipmapHit
105
+ * fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_max: f32, cascade_count: u32, atlas_shift: u32) -> BrickClipmapHit
102
106
  * ```
103
107
  *
108
+ * `atlas_shift` is the atlas's footprint, as {@link chunk_brick_clipmap_sample} takes it.
109
+ *
104
110
  * The march (`brick_clipmap_march`) from `t_min`, at most {@link BRICK_TRACE_STEPS} steps, each
105
111
  * reading in a brick one atlas tap:
106
112
  * - EMPTY inside is a hit where the march stands: the ray is inside a solid, and its hit is a back
@@ -118,7 +124,7 @@ export const chunk_brick_clipmap_trace: CodeChunk;
118
124
  * The finest cascade's signed distance at a point (§7.9), for probe relocation.
119
125
  *
120
126
  * ```wgsl
121
- * fn brick_clipmap_distance(position: vec3<f32>, cascade_count: u32) -> f32
127
+ * fn brick_clipmap_distance(position: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> f32
122
128
  * ```
123
129
  *
124
130
  * The finest window holding the point answers, unless its cell is UNKNOWN, which defers to the
@@ -133,7 +139,7 @@ export const chunk_brick_clipmap_distance: CodeChunk;
133
139
  * no slope: for probe relocation (§8.4).
134
140
  *
135
141
  * ```wgsl
136
- * fn brick_clipmap_gradient(position: vec3<f32>, cascade_count: u32) -> vec3<f32>
142
+ * fn brick_clipmap_gradient(position: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> vec3<f32>
137
143
  * ```
138
144
  *
139
145
  * Four taps of {@link chunk_brick_clipmap_distance} at the corners of a tetrahedron a voxel of the finest
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_brick_clipmap_trace.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,gCAFU,MAAM,CAEoB;AAEpC;;;;GAIG;AACH,gCAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,qCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,yCAFU,wBAAwB,CAEoE;AAEtG;;;GAGG;AACH,+CAFU,wBAAwB,CAEgF;AAElH;;;GAGG;AACH,2CAFU,wBAAwB,CAEyE;AAE3G;;;GAGG;AACH,qCAFU,wBAAwB,CAEqF;AAEvH;;;GAGG;AACH,oCAFU,wBAAwB,CAEyE;AAE3G;;;;;;;;;;;;;;GAcG;AACH,yCAFU,SAAS,CAyCZ;AAKP;;;;;;;;;;;;GAYG;AACH,yCAFU,SAAS,CAyBZ;AAIP;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wCAFU,SAAS,CAgFZ;AAKP;;;;;;;;;;;;;;;;;;GAkBG;AACH,wCAFU,SAAS,CAoGZ;AAEP;;;;;;;;;;;;GAYG;AACH,2CAFU,SAAS,CAsCZ;AAIP;;;;;;;;;;;;;;GAcG;AACH,2CAFU,SAAS,CA0BZ;yCA7dkC,sDAAsD;0BADrE,uCAAuC"}
1
+ {"version":3,"file":"chunk_brick_clipmap_trace.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,gCAFU,MAAM,CAEoB;AAEpC;;;;GAIG;AACH,gCAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,qCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,yCAFU,wBAAwB,CAEoE;AAEtG;;;GAGG;AACH,+CAFU,wBAAwB,CAEgF;AAElH;;;GAGG;AACH,2CAFU,wBAAwB,CAEyE;AAE3G;;;GAGG;AACH,qCAFU,wBAAwB,CAEqF;AAEvH;;;GAGG;AACH,oCAFU,wBAAwB,CAEyE;AAE3G;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAFU,SAAS,CAyCZ;AAKP;;;;;;;;;;;;GAYG;AACH,yCAFU,SAAS,CAyBZ;AAIP;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wCAFU,SAAS,CAgFZ;AAKP;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wCAFU,SAAS,CAoGZ;AAEP;;;;;;;;;;;;GAYG;AACH,2CAFU,SAAS,CAsCZ;AAIP;;;;;;;;;;;;;;GAcG;AACH,2CAFU,SAAS,CA0BZ;yCAnekC,sDAAsD;0BADrE,uCAAuC"}
@@ -9,7 +9,7 @@ import { chunk_aabb3_distance_to_ray_v2 } from "../../../shader/chunk/geometry/a
9
9
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
10
10
  import { ShaderResourceDescriptor } from "../../../shader/resource/ShaderResourceDescriptor.js";
11
11
  import { WebGPUArray } from "../../../shader/type/WebGPUArray.js";
12
- import { chunk_tile_atlas_slot_origin } from "../../../texture/atlas/chunk_tile_atlas_slot_origin.js";
12
+ import { chunk_tile_atlas_slot_origin_shift } from "../../../texture/atlas/chunk_tile_atlas_slot_origin.js";
13
13
  import {
14
14
  BRICK_OCCUPANCY_BLOCK,
15
15
  BRICK_TRACE_HIT,
@@ -73,47 +73,51 @@ export const BRICK_LEVELS_RESOURCE = ShaderResourceDescriptor.uniform("brick_lev
73
73
  * A brick's distance at a point of its cell, where its slot sits in the atlas, and the field's gradient.
74
74
  *
75
75
  * ```wgsl
76
- * fn brick_clipmap_sample(slot: u32, local: vec3<f32>, voxel: f32) -> f32 // local in voxels from the cell's corner
77
- * fn brick_clipmap_slot_texel(slot: u32) -> vec3<u32> // the slot's texel 0 in the atlas
78
- * fn brick_clipmap_normal(slot: u32, local: vec3<f32>) -> vec3<f32> // out of the solid, unit length
76
+ * fn brick_clipmap_sample(slot: u32, local: vec3<f32>, voxel: f32, atlas_shift: u32) -> f32 // local in voxels from the cell's corner
77
+ * fn brick_clipmap_slot_texel(slot: u32, atlas_shift: u32) -> vec3<u32> // the slot's texel 0 in the atlas
78
+ * fn brick_clipmap_normal(slot: u32, local: vec3<f32>, atlas_shift: u32) -> vec3<f32> // out of the solid, unit length
79
79
  * ```
80
80
  *
81
81
  * One hardware trilinear tap of the atlas at texel `slot_origin + 0.5 + local`, `local` clamped to the
82
82
  * brick's [0, 7]: it never reads a neighbouring slot (§7.2). The gradient is a tetrahedral one, four
83
83
  * taps half a voxel off, each clamped the same way.
84
84
  *
85
+ * `atlas_shift` is the atlas's footprint, `GPUBrickClipmap#atlas_shift`, which every reader takes in its
86
+ * immediate data and passes down: a slot is found with shifts (`tile_atlas_slot_origin_shift`), with no
87
+ * texture query and no divide in front of the tap.
88
+ *
85
89
  * @type {CodeChunk}
86
90
  */
87
91
  export const chunk_brick_clipmap_sample = CodeChunk.from(
88
92
  //language=WGSL
89
93
  `
90
- fn brick_clipmap_slot_texel(slot: u32) -> vec3<u32> {
91
- return tile_atlas_slot_origin(slot, textureDimensions(brick_atlas, 0).xy / ${MESH_SDF_BRICK_TEXELS}u, vec3<u32>(${MESH_SDF_BRICK_TEXELS}u));
94
+ fn brick_clipmap_slot_texel(slot: u32, atlas_shift: u32) -> vec3<u32> {
95
+ return tile_atlas_slot_origin_shift(slot, atlas_shift, vec3<u32>(${MESH_SDF_BRICK_TEXELS}u));
92
96
  }
93
97
 
94
- fn brick_clipmap_tap(slot: u32, local: vec3<f32>) -> f32 {
98
+ fn brick_clipmap_tap(slot: u32, local: vec3<f32>, atlas_shift: u32) -> f32 {
95
99
  let atlas_size = textureDimensions(brick_atlas, 0);
96
- let uvw = (vec3<f32>(brick_clipmap_slot_texel(slot)) + 0.5 + clamp(local, vec3<f32>(0.0), vec3<f32>(${MESH_SDF_BRICK_VOXELS}.0))) / vec3<f32>(atlas_size);
100
+ let uvw = (vec3<f32>(brick_clipmap_slot_texel(slot, atlas_shift)) + 0.5 + clamp(local, vec3<f32>(0.0), vec3<f32>(${MESH_SDF_BRICK_VOXELS}.0))) / vec3<f32>(atlas_size);
97
101
 
98
102
  return textureSampleLevel(brick_atlas, brick_sampler, uvw, 0.0).r;
99
103
  }
100
104
 
101
- fn brick_clipmap_sample(slot: u32, local: vec3<f32>, voxel: f32) -> f32 {
105
+ fn brick_clipmap_sample(slot: u32, local: vec3<f32>, voxel: f32, atlas_shift: u32) -> f32 {
102
106
  let band = BRICK_CLIPMAP_BAND_VOXELS * voxel;
103
107
 
104
- return fma(brick_clipmap_tap(slot, local), 2.0 * band, -band);
108
+ return fma(brick_clipmap_tap(slot, local, atlas_shift), 2.0 * band, -band);
105
109
  }
106
110
 
107
- fn brick_clipmap_normal(slot: u32, local: vec3<f32>) -> vec3<f32> {
111
+ fn brick_clipmap_normal(slot: u32, local: vec3<f32>, atlas_shift: u32) -> vec3<f32> {
108
112
  let a = vec3<f32>(1.0, -1.0, -1.0);
109
113
  let b = vec3<f32>(-1.0, -1.0, 1.0);
110
114
  let c = vec3<f32>(-1.0, 1.0, -1.0);
111
115
  let d = vec3<f32>(1.0, 1.0, 1.0);
112
116
 
113
- let gradient = a * brick_clipmap_tap(slot, local + 0.5 * a)
114
- + b * brick_clipmap_tap(slot, local + 0.5 * b)
115
- + c * brick_clipmap_tap(slot, local + 0.5 * c)
116
- + d * brick_clipmap_tap(slot, local + 0.5 * d);
117
+ let gradient = a * brick_clipmap_tap(slot, local + 0.5 * a, atlas_shift)
118
+ + b * brick_clipmap_tap(slot, local + 0.5 * b, atlas_shift)
119
+ + c * brick_clipmap_tap(slot, local + 0.5 * c, atlas_shift)
120
+ + d * brick_clipmap_tap(slot, local + 0.5 * d, atlas_shift);
117
121
 
118
122
  let length_sqr = dot(gradient, gradient);
119
123
 
@@ -122,7 +126,7 @@ fn brick_clipmap_normal(slot: u32, local: vec3<f32>) -> vec3<f32> {
122
126
  }
123
127
  `, [
124
128
  chunk_brick_clipmap,
125
- chunk_tile_atlas_slot_origin,
129
+ chunk_tile_atlas_slot_origin_shift,
126
130
  ]);
127
131
 
128
132
  chunk_brick_clipmap_sample.requireResource(BRICK_ATLAS_TEXTURE_RESOURCE);
@@ -277,9 +281,11 @@ chunk_brick_clipmap_march.requireResource(BRICK_OCCUPANCY_TEXTURE_RESOURCE);
277
281
  * The first surface along a ray through the brick clipmap (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §7.9).
278
282
  *
279
283
  * ```wgsl
280
- * fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_max: f32, cascade_count: u32) -> BrickClipmapHit
284
+ * fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_max: f32, cascade_count: u32, atlas_shift: u32) -> BrickClipmapHit
281
285
  * ```
282
286
  *
287
+ * `atlas_shift` is the atlas's footprint, as {@link chunk_brick_clipmap_sample} takes it.
288
+ *
283
289
  * The march (`brick_clipmap_march`) from `t_min`, at most {@link BRICK_TRACE_STEPS} steps, each
284
290
  * reading in a brick one atlas tap:
285
291
  * - EMPTY inside is a hit where the march stands: the ray is inside a solid, and its hit is a back
@@ -316,7 +322,7 @@ struct BrickClipmapHit {
316
322
  cell_min: vec3<f32>,
317
323
  }
318
324
 
319
- fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_max: f32, cascade_count: u32) -> BrickClipmapHit {
325
+ fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_max: f32, cascade_count: u32, atlas_shift: u32) -> BrickClipmapHit {
320
326
  var hit: BrickClipmapHit;
321
327
 
322
328
  hit.kind = BRICK_TRACE_MISS;
@@ -361,7 +367,7 @@ fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_ma
361
367
  }
362
368
 
363
369
  let local = (march.position - march.cell_min) / march.voxel;
364
- let distance = brick_clipmap_sample(march.entry, local, march.voxel);
370
+ let distance = brick_clipmap_sample(march.entry, local, march.voxel, atlas_shift);
365
371
 
366
372
  if (distance < ${BRICK_TRACE_HIT_VOXELS} * march.voxel) {
367
373
  hit.kind = BRICK_TRACE_HIT;
@@ -369,7 +375,7 @@ fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_ma
369
375
  hit.cascade = march.cascade;
370
376
  hit.slot = march.entry;
371
377
  hit.position = march.position;
372
- hit.normal = brick_clipmap_normal(march.entry, local);
378
+ hit.normal = brick_clipmap_normal(march.entry, local, atlas_shift);
373
379
  hit.distance = distance;
374
380
  hit.cell_min = march.cell_min;
375
381
 
@@ -396,7 +402,7 @@ fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_ma
396
402
  * The finest cascade's signed distance at a point (§7.9), for probe relocation.
397
403
  *
398
404
  * ```wgsl
399
- * fn brick_clipmap_distance(position: vec3<f32>, cascade_count: u32) -> f32
405
+ * fn brick_clipmap_distance(position: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> f32
400
406
  * ```
401
407
  *
402
408
  * The finest window holding the point answers, unless its cell is UNKNOWN, which defers to the
@@ -408,7 +414,7 @@ fn brick_clipmap_trace(origin: vec3<f32>, direction: vec3<f32>, t_min: f32, t_ma
408
414
  export const chunk_brick_clipmap_distance = CodeChunk.from(
409
415
  //language=WGSL
410
416
  `
411
- fn brick_clipmap_distance(position: vec3<f32>, cascade_count: u32) -> f32 {
417
+ fn brick_clipmap_distance(position: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> f32 {
412
418
  let count = min(cascade_count, ${CLIPMAP_LEVEL_LIMIT}u);
413
419
 
414
420
  for (var c = 0u; c < count; c++) {
@@ -432,7 +438,7 @@ fn brick_clipmap_distance(position: vec3<f32>, cascade_count: u32) -> f32 {
432
438
  return select(1.0, -1.0, entry == BRICK_CLIPMAP_EMPTY_INSIDE) * BRICK_CLIPMAP_BAND_VOXELS * voxel;
433
439
  }
434
440
 
435
- return brick_clipmap_sample(entry, (position - vec3<f32>(cell) * level.cell_size) / voxel, voxel);
441
+ return brick_clipmap_sample(entry, (position - vec3<f32>(cell) * level.cell_size) / voxel, voxel, atlas_shift);
436
442
  }
437
443
 
438
444
  return BRICK_CLIPMAP_BAND_VOXELS * brick_levels[max(count, 1u) - 1u].cell_size / ${MESH_SDF_BRICK_VOXELS}.0;
@@ -450,7 +456,7 @@ chunk_brick_clipmap_distance.requireResource(BRICK_MAP_TEXTURE_RESOURCE);
450
456
  * no slope: for probe relocation (§8.4).
451
457
  *
452
458
  * ```wgsl
453
- * fn brick_clipmap_gradient(position: vec3<f32>, cascade_count: u32) -> vec3<f32>
459
+ * fn brick_clipmap_gradient(position: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> vec3<f32>
454
460
  * ```
455
461
  *
456
462
  * Four taps of {@link chunk_brick_clipmap_distance} at the corners of a tetrahedron a voxel of the finest
@@ -463,7 +469,7 @@ chunk_brick_clipmap_distance.requireResource(BRICK_MAP_TEXTURE_RESOURCE);
463
469
  export const chunk_brick_clipmap_gradient = CodeChunk.from(
464
470
  //language=WGSL
465
471
  `
466
- fn brick_clipmap_gradient(position: vec3<f32>, cascade_count: u32) -> vec3<f32> {
472
+ fn brick_clipmap_gradient(position: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> vec3<f32> {
467
473
  let cascade = min(brick_clipmap_start(position, cascade_count), max(cascade_count, 1u) - 1u);
468
474
  let h = brick_levels[cascade].cell_size / ${MESH_SDF_BRICK_VOXELS}.0;
469
475
 
@@ -472,10 +478,10 @@ fn brick_clipmap_gradient(position: vec3<f32>, cascade_count: u32) -> vec3<f32>
472
478
  let k2 = vec3<f32>(-1.0, 1.0, -1.0);
473
479
  let k3 = vec3<f32>(1.0, 1.0, 1.0);
474
480
 
475
- let sum = k0 * brick_clipmap_distance(position + h * k0, cascade_count)
476
- + k1 * brick_clipmap_distance(position + h * k1, cascade_count)
477
- + k2 * brick_clipmap_distance(position + h * k2, cascade_count)
478
- + k3 * brick_clipmap_distance(position + h * k3, cascade_count);
481
+ let sum = k0 * brick_clipmap_distance(position + h * k0, cascade_count, atlas_shift)
482
+ + k1 * brick_clipmap_distance(position + h * k1, cascade_count, atlas_shift)
483
+ + k2 * brick_clipmap_distance(position + h * k2, cascade_count, atlas_shift)
484
+ + k3 * brick_clipmap_distance(position + h * k3, cascade_count, atlas_shift);
479
485
 
480
486
  let size = length(sum);
481
487
 
@@ -1 +1 @@
1
- {"version":3,"file":"graph_probe_clipmap_debug_brick_clipmap.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js"],"names":[],"mappings":"AAqHA;;;;;;;GAOG;AACH;IAN+B,KAAK,EAAzB,UAAU;IACc,IAAI,EAA5B,cAAc;IACI,UAAU,EAA5B,MAAM,EAAE;IACiB,aAAa,EAAtC,eAAe;IACb,MAAM,CAoClB;AA9DD;;;;;;;;GAQG;AACH,uDAFU,WAAW,CAWlB;yBA/FU,OAAO,iEAAiE,EAAE,UAAU;6BACpF,OAAO,iCAAiC,EAAE,cAAc;8BACxD,OAAO,6BAA6B,EAAE,eAAe;4BAjBtC,gCAAgC"}
1
+ {"version":3,"file":"graph_probe_clipmap_debug_brick_clipmap.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js"],"names":[],"mappings":"AAuHA;;;;;;;GAOG;AACH;IAN+B,KAAK,EAAzB,UAAU;IACc,IAAI,EAA5B,cAAc;IACI,UAAU,EAA5B,MAAM,EAAE;IACiB,aAAa,EAAtC,eAAe;IACb,MAAM,CAoClB;AA9DD;;;;;;;;GAQG;AACH,uDAFU,WAAW,CAWlB;yBAjGU,OAAO,iEAAiE,EAAE,UAAU;6BACpF,OAAO,iCAAiC,EAAE,cAAc;8BACxD,OAAO,6BAA6B,EAAE,eAAe;4BAjBtC,gCAAgC"}
@@ -34,6 +34,8 @@ const FAR = 1e4;
34
34
  */
35
35
  const DEBUG_BRICK_CLIPMAP_SETTINGS = WebGPUStruct.from({
36
36
  cascade_count: u32,
37
+ /** the brick atlas's footprint as shifts, `GPUBrickClipmap#atlas_shift` */
38
+ brick_atlas_shift: u32,
37
39
  }, "ProbeClipmapDebugBrickClipmapSettings");
38
40
 
39
41
  const resources = new ShaderResourceSetDescriptor();
@@ -67,7 +69,7 @@ fn main(
67
69
  ) -> @location(0) vec4<f32> {
68
70
  let ray = camera_ray_from_uv(uv, camera);
69
71
 
70
- let hit = brick_clipmap_trace(ray.origin, ray.direction, 0.0, ${FAR.toFixed(1)}, settings.cascade_count);
72
+ let hit = brick_clipmap_trace(ray.origin, ray.direction, 0.0, ${FAR.toFixed(1)}, settings.cascade_count, settings.brick_atlas_shift);
71
73
 
72
74
  if (hit.kind == BRICK_TRACE_MISS) {
73
75
  return vec4<f32>(0.08, 0.08, 0.1, 1.0);
@@ -130,7 +132,7 @@ export function graph_probe_clipmap_debug_brick_clipmap({ graph, view, resolutio
130
132
  assert.defined(brick_clipmap, 'brick_clipmap');
131
133
 
132
134
  const data = {};
133
- const settings = { cascade_count: brick_clipmap.cascade_count };
135
+ const settings = { cascade_count: brick_clipmap.cascade_count, brick_atlas_shift: brick_clipmap.atlas_shift };
134
136
 
135
137
  const pass = graph.add("Probe Clipmap Debug / Brick Clipmap", data, (data, resources, context) => {
136
138
  const output = resources.get(data.output);
@@ -1 +1 @@
1
- {"version":3,"file":"graph_probe_clipmap_debug_brick_material.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js"],"names":[],"mappings":"AAsJA;;;;;;;;;GASG;AACH;IAR+B,KAAK,EAAzB,UAAU;IACc,IAAI,EAA5B,cAAc;IACI,UAAU,EAA5B,MAAM,EAAE;IACiB,aAAa,EAAtC,eAAe;IACqC,QAAQ,EAA5D;QAAC,cAAc,qBAA0B;KAAC;IACK,OAAO,EAAtD,qCAAqC;IACnC,MAAM,CAiDlB;;;;oDAtKS,MAAM;;;;;AAuFhB;;;;;;;;;;GAUG;AACH,wDAFU,WAAW,CAWlB;yBA1HU,OAAO,iEAAiE,EAAE,UAAU;6BACpF,OAAO,iCAAiC,EAAE,cAAc;8BACxD,OAAO,6BAA6B,EAAE,eAAe;4BAvBtC,gCAAgC"}
1
+ {"version":3,"file":"graph_probe_clipmap_debug_brick_material.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js"],"names":[],"mappings":"AAwJA;;;;;;;;;GASG;AACH;IAR+B,KAAK,EAAzB,UAAU;IACc,IAAI,EAA5B,cAAc;IACI,UAAU,EAA5B,MAAM,EAAE;IACiB,aAAa,EAAtC,eAAe;IACqC,QAAQ,EAA5D;QAAC,cAAc,qBAA0B;KAAC;IACK,OAAO,EAAtD,qCAAqC;IACnC,MAAM,CAiDlB;;;;oDAxKS,MAAM;;;;;AAyFhB;;;;;;;;;;GAUG;AACH,wDAFU,WAAW,CAWlB;yBA5HU,OAAO,iEAAiE,EAAE,UAAU;6BACpF,OAAO,iCAAiC,EAAE,cAAc;8BACxD,OAAO,6BAA6B,EAAE,eAAe;4BAvBtC,gCAAgC"}
@@ -55,6 +55,8 @@ const DEBUG_BRICK_MATERIAL_SETTINGS = WebGPUStruct.from({
55
55
  cascade_count: u32,
56
56
  /** a {@link ProbeClipmapDebugBrickMaterialChannel} */
57
57
  channel: u32,
58
+ /** the brick atlas's footprint as shifts, `GPUBrickClipmap#atlas_shift` */
59
+ brick_atlas_shift: u32,
58
60
  }, "ProbeClipmapDebugBrickMaterialSettings");
59
61
 
60
62
  const resources = new ShaderResourceSetDescriptor();
@@ -84,7 +86,7 @@ fn main(
84
86
  ) -> @location(0) vec4<f32> {
85
87
  let ray = camera_ray_from_uv(uv, camera);
86
88
 
87
- let hit = brick_clipmap_trace(ray.origin, ray.direction, 0.0, ${FAR.toFixed(1)}, settings.cascade_count);
89
+ let hit = brick_clipmap_trace(ray.origin, ray.direction, 0.0, ${FAR.toFixed(1)}, settings.cascade_count, settings.brick_atlas_shift);
88
90
 
89
91
  if (hit.kind == BRICK_TRACE_MISS) {
90
92
  return vec4<f32>(0.08, 0.08, 0.1, 1.0);
@@ -101,7 +103,7 @@ fn main(
101
103
  }
102
104
 
103
105
  if (settings.channel == ${ProbeClipmapDebugBrickMaterialChannel.Albedo}u) {
104
- let material = probe_clipmap_hit_material(hit.position, hit.normal, hit.cascade);
106
+ let material = probe_clipmap_hit_material(hit.position, hit.normal, hit.cascade, settings.brick_atlas_shift);
105
107
 
106
108
  if (!material.found) {
107
109
  // the source does not know the surface: the hit is black to the probes
@@ -111,7 +113,7 @@ fn main(
111
113
  return vec4<f32>(material.albedo + material.emissive, 1.0);
112
114
  }
113
115
 
114
- let metal_rough = probe_clipmap_hit_metal_rough(hit.position, hit.normal, hit.cascade);
116
+ let metal_rough = probe_clipmap_hit_metal_rough(hit.position, hit.normal, hit.cascade, settings.brick_atlas_shift);
115
117
 
116
118
  if (metal_rough.z == 0.0) {
117
119
  return vec4<f32>(0.3, 0.0, 0.0, 1.0);
@@ -174,7 +176,7 @@ export function graph_probe_clipmap_debug_brick_material({
174
176
  assert.enum(channel, ProbeClipmapDebugBrickMaterialChannel, 'channel');
175
177
 
176
178
  const data = {};
177
- const settings = { cascade_count: brick_clipmap.cascade_count, channel };
179
+ const settings = { cascade_count: brick_clipmap.cascade_count, channel, brick_atlas_shift: brick_clipmap.atlas_shift };
178
180
 
179
181
  const pass = graph.add("Probe Clipmap Debug / Brick Material", data, (data, resources, context) => {
180
182
  const output = resources.get(data.output);
@@ -1 +1 @@
1
- {"version":3,"file":"GPUBrickMaterial.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAyBI;;;;OAIG;IACH;QAF2B,QAAQ,EAAxB,MAAM;OAsBhB;IAhCD;;;;OAIG;IACH,cAFU,YAAU,IAAI,CAEJ;IA6BpB;;OAEG;IACH,4BAEC;IAED;;;;;;OAMG;IACH,mCAMC;IAED;;;;;;;OAOG;IACH,4BAHW,UAAU,WACV,oBAAoB,QAuB9B;IAuCD,gBAQC;;CACJ;yBAnLY,OAAO,iEAAiE,EAAE,UAAU;mCACpF,OAAO,6BAA6B,EAAE,oBAAoB;+BANxC,0CAA0C"}
1
+ {"version":3,"file":"GPUBrickMaterial.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAyBI;;;;OAIG;IACH;QAF2B,QAAQ,EAAxB,MAAM;OAsBhB;IAhCD;;;;OAIG;IACH,cAFU,YAAU,IAAI,CAEJ;IA6BpB;;OAEG;IACH,4BAEC;IAED;;;;;;OAMG;IACH,mCAMC;IAED;;;;;;;OAOG;IACH,4BAHW,UAAU,WACV,oBAAoB,QAuB9B;IAwCD,gBAQC;;CACJ;yBApLY,OAAO,iEAAiE,EAAE,UAAU;mCACpF,OAAO,6BAA6B,EAAE,oBAAoB;+BANxC,0CAA0C"}
@@ -51,7 +51,7 @@ export class GPUBrickMaterial {
51
51
 
52
52
  #data = { take: -1, staging: -1, state: -1 };
53
53
 
54
- #settings = { ring_capacity: 0, resolution: 0 };
54
+ #settings = { ring_capacity: 0, resolution: 0, brick_atlas_shift: 0 };
55
55
 
56
56
  #bindings = {};
57
57
 
@@ -171,6 +171,7 @@ export class GPUBrickMaterial {
171
171
 
172
172
  settings.ring_capacity = frame.ring_capacity;
173
173
  settings.resolution = frame.resolution;
174
+ settings.brick_atlas_shift = frame.clipmap.atlas_shift;
174
175
  b.settings = settings;
175
176
 
176
177
  shader_brick_material_gather.dispatchIndirect({
@@ -17,13 +17,14 @@ export const BRICK_MATERIAL_EMISSIVE_RESOURCE: ShaderResourceDescriptor;
17
17
  *
18
18
  * ```wgsl
19
19
  * fn brick_material_tile(slot: u32) -> vec3<u32>
20
- * fn brick_material_corners(slot: u32, local: vec3<f32>, normal: vec3<f32>) -> SurfaceMaterialCorners
20
+ * fn brick_material_corners(slot: u32, local: vec3<f32>, normal: vec3<f32>, atlas_shift: u32) -> SurfaceMaterialCorners
21
21
  * ```
22
22
  *
23
23
  * `brick_material_tile` is the slot's tile's origin in the planes. `local` is a point by the surface in
24
24
  * voxels from the cell's corner, a hit's position, and `normal` the field's normal there. Surfaces
25
25
  * within {@link BRICK_TRACE_HIT_VOXELS} of each other are one: a ray stands on a surface from anywhere
26
- * that far out of it, so it cannot tell closer ones apart.
26
+ * that far out of it, so it cannot tell closer ones apart. `atlas_shift` is the brick atlas's footprint, as
27
+ * `chunk_brick_clipmap_sample` takes it; the material planes' own footprint is read off them, once a read.
27
28
  *
28
29
  * @type {CodeChunk}
29
30
  */
@@ -33,7 +34,7 @@ export const chunk_brick_material_corners: CodeChunk;
33
34
  * (`surface_material_surface`):
34
35
  *
35
36
  * ```wgsl
36
- * fn brick_material_surface(slot: u32, local: vec3<f32>, normal: vec3<f32>) -> SurfaceMaterialSurface
37
+ * fn brick_material_surface(slot: u32, local: vec3<f32>, normal: vec3<f32>, atlas_shift: u32) -> SurfaceMaterialSurface
37
38
  * ```
38
39
  *
39
40
  * @type {CodeChunk}
@@ -45,7 +46,7 @@ export const chunk_brick_material_surface: CodeChunk;
45
46
  * average, over the reads a probe's rays make:
46
47
  *
47
48
  * ```wgsl
48
- * fn brick_material_surface_pick(slot: u32, local: vec3<f32>, normal: vec3<f32>, u: f32) -> SurfaceMaterialSurface
49
+ * fn brick_material_surface_pick(slot: u32, local: vec3<f32>, normal: vec3<f32>, u: f32, atlas_shift: u32) -> SurfaceMaterialSurface
49
50
  * ```
50
51
  *
51
52
  * @type {CodeChunk}
@@ -56,7 +57,7 @@ export const chunk_brick_material_surface_pick: CodeChunk;
56
57
  * texels {@link chunk_brick_material_surface} takes:
57
58
  *
58
59
  * ```wgsl
59
- * fn brick_material_metal_rough(slot: u32, local: vec3<f32>, normal: vec3<f32>) -> SurfaceMaterialMetalRough
60
+ * fn brick_material_metal_rough(slot: u32, local: vec3<f32>, normal: vec3<f32>, atlas_shift: u32) -> SurfaceMaterialMetalRough
60
61
  * ```
61
62
  *
62
63
  * @type {CodeChunk}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_brick_material.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js"],"names":[],"mappings":"AAgBA;;GAEG;AACH,6CAFU,wBAAwB,CAE0F;AAE5H;;GAEG;AACH,kDAFU,wBAAwB,CAEoG;AAEtI;;GAEG;AACH,+CAFU,wBAAwB,CAE8F;AAEhI;;;;;;;;;;;;;;;;GAgBG;AACH,2CAFU,SAAS,CAqBZ;AAIP;;;;;;;;;GASG;AACH,2CAFU,SAAS,CAWZ;AAIP;;;;;;;;;;GAUG;AACH,gDAFU,SAAS,CAaZ;AAIP;;;;;;;;;GASG;AACH,+CAFU,SAAS,CAWZ;yCArIkC,sDAAsD;0BADrE,uCAAuC"}
1
+ {"version":3,"file":"chunk_brick_material.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js"],"names":[],"mappings":"AAgBA;;GAEG;AACH,6CAFU,wBAAwB,CAE0F;AAE5H;;GAEG;AACH,kDAFU,wBAAwB,CAEoG;AAEtI;;GAEG;AACH,+CAFU,wBAAwB,CAE8F;AAEhI;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAFU,SAAS,CAqBZ;AAIP;;;;;;;;;GASG;AACH,2CAFU,SAAS,CAWZ;AAIP;;;;;;;;;;GAUG;AACH,gDAFU,SAAS,CAaZ;AAIP;;;;;;;;;GASG;AACH,+CAFU,SAAS,CAWZ;yCAtIkC,sDAAsD;0BADrE,uCAAuC"}