@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,219 +1,221 @@
1
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
- import { ComputeShader } from "../../shader/ComputeShader.js";
3
- import { chunk_grid_tile_halo_f32 } from "../../shader/chunk/grid/chunk_grid_tile_halo_f32.js";
4
- import { GRID_TILE_WINDOW_STRUCT } from "../../shader/chunk/grid/GRID_TILE_WINDOW_STRUCT.js";
5
- import { chunk_index_to_grid3d } from "../../shader/chunk/grid/chunk_index_to_grid3d.js";
6
- import { chunk_is_finite } from "../../shader/chunk/math/chunk_is_finite.js";
7
- import { chunk_subgroup_atomic_add } from "../../shader/chunk/subgroup/chunk_subgroup_atomic_add.js";
8
- import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
9
- import { atomic_u32, f32, u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
10
- import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
11
- import { chunk_fluid_mg_relax } from "./chunk_fluid_mg_relax.js";
12
- import { chunk_fluid_pressure_ghost } from "./chunk_fluid_pressure_ghost.js";
13
- import { FLUID_MG_SMOOTH_SWEEP_LIMIT } from "./FLUID_MG.js";
14
- import { FLUID_MG_PASS_STRUCT } from "./FLUID_MG_PASS_STRUCT.js";
15
-
16
- const resources = new ShaderResourceSetDescriptor();
17
-
18
- resources.createGroup()
19
- .addUniform('params', FLUID_MG_PASS_STRUCT)
20
- .addStorageBuffer('input', WebGPUArray.from(f32), false)
21
- .addStorageBuffer('output', WebGPUArray.from(f32), true)
22
- .addStorageBuffer('rhs', WebGPUArray.from(f32), false)
23
- .addStorageBuffer('words', WebGPUArray.from(u32), false)
24
- .addStorageBuffer('coarse', WebGPUArray.from(f32), false)
25
- .addStorageBuffer('nonfinite', WebGPUArray.from(atomic_u32), true)
26
- .addStorageBuffer('ghost_pressure', WebGPUArray.from(f32), false);
27
-
28
- /**
29
- * The pressure V-cycle's smoother, and the SOR arm's (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §8): one
30
- * workgroup an 8×8×4 tile of a level, one invocation a cell.
31
- *
32
- * 1. The workgroup loads its tile and a one-cell halo from `input` into workgroup memory
33
- * (`chunk_grid_tile_halo_f32`). A value that is not finite is loaded as 0. With `prolong`, the 6×6×4
34
- * coarse error neighbourhood covering the tile and its halo is first staged into workgroup memory
35
- * (`tile_coarse`, 144 cells, out-of-bounds coarse cells zeroed), and every value inside the level is
36
- * loaded with the coarser level's error added trilinearly (`fluid_mg_prolong_cached`), which is the
37
- * separate prolongation pass folded in. A cell beyond the level is its ghost: the cascade's Dirichlet
38
- * pressure on the finest level, its parent's at the ghost cell's centre (`chunk_fluid_pressure_ghost`,
39
- * from the step's `ghost_pressure`), 0 below it.
40
- * 2. `sweeps` times, for red then black, each cell of a colour in `colours` with a degree of freedom
41
- * relaxes toward its equation (`chunk_fluid_mg_relax`) against its neighbours in the tile, the
42
- * halo frozen. A colour reads only the other colour, so its cells update together, and a barrier
43
- * separates the colours.
44
- * 3. Every cell inside the level is written to `output`, which is never `input`, so no tile reads what
45
- * another wrote. With `prolong`, a cell with no degree of freedom is written as `input` held it (a
46
- * non-finite value as 0): the prolongation leaves it alone.
47
- *
48
- * Both colours in one dispatch, as the V-cycle runs it, is only stable at ω = 1; the SOR arm runs one
49
- * colour a dispatch at ω > 1, which against a halo of the other colour is the global red-black update
50
- * exactly. The host asserts both.
51
- *
52
- * Each invocation counts its own cell's input and RHS when not finite, and the workgroup adds the counts
53
- * to `nonfinite[0]` with one atomic per subgroup.
54
- *
55
- * Dispatched as `ceil(size / (8, 8, 4))` workgroups. Workgroup memory: 2,976 bytes.
56
- */
57
- export const shader_fluid_mg_smooth = ComputeShader.from({
58
- label: 'Fluid / pressure / smooth',
59
- resources,
60
- body: CodeChunk.from(
61
- //language=WGSL
62
- `
63
- const FLUID_MG_SOURCE_PRESSURE = 0u;
64
- const FLUID_MG_SOURCE_ERROR = 1u;
65
- const FLUID_MG_SMOOTH_SWEEP_LIMIT = ${FLUID_MG_SMOOTH_SWEEP_LIMIT}u;
66
- const FLUID_MG_COARSE_TILE_CELLS = 144u;
67
-
68
- var<workgroup> tile_p: array<f32, GRID_TILE_HALO_CELLS>;
69
- var<workgroup> tile_coarse: array<f32, FLUID_MG_COARSE_TILE_CELLS>;
70
- var<private> coarse_tile_origin: vec3<i32>;
71
-
72
- fn fluid_mg_input_index(storage_cell: vec3<u32>) -> u32 {
73
- return storage_cell.x + params.input_period.x * (storage_cell.y + params.input_period.y * storage_cell.z);
74
- }
75
-
76
- // the window-local cell an input storage cell holds: the inverse of grid_tile_window_storage
77
- fn fluid_mg_input_local(storage_cell: vec3<u32>) -> vec3<i32> {
78
- let offset = vec3<i32>(storage_cell) - vec3<i32>(params.input_corner_storage);
79
-
80
- return select(offset, offset + vec3<i32>(params.input_period), offset < vec3<i32>(0));
81
- }
82
-
83
- fn fluid_mg_prolong_cached(fine: vec3<i32>) -> f32 {
84
- let c = vec3<u32>((fine >> vec3<u32>(1u)) - coarse_tile_origin);
85
- let base = i32(c.x + 6u * (c.y + 6u * c.z));
86
- let dx = select(-1, 1, (fine.x & 1) != 0);
87
- let dy = select(-6, 6, (fine.y & 1) != 0);
88
- let dz = select(-36, 36, (fine.z & 1) != 0);
89
-
90
- var v = 0.421875 * tile_coarse[u32(base)];
91
- v += 0.140625 * tile_coarse[u32(base + dx)];
92
- v += 0.140625 * tile_coarse[u32(base + dy)];
93
- v += 0.046875 * tile_coarse[u32(base + dx + dy)];
94
- v += 0.140625 * tile_coarse[u32(base + dz)];
95
- v += 0.046875 * tile_coarse[u32(base + dx + dz)];
96
- v += 0.046875 * tile_coarse[u32(base + dy + dz)];
97
- v += 0.015625 * tile_coarse[u32(base + dx + dy + dz)];
98
-
99
- return v;
100
- }
101
-
102
- fn grid_tile_f32_fetch_inside(source: u32, storage_cell: vec3<u32>) -> f32 {
103
- var value = input[fluid_mg_input_index(storage_cell)];
104
-
105
- if (params.prolong != 0u) {
106
- value += fluid_mg_prolong_cached(fluid_mg_input_local(storage_cell));
107
- }
108
-
109
- return select(0.0, value, is_finite(value));
110
- }
111
-
112
- fn grid_tile_f32_fetch_outside(source: u32, world_cell: vec3<i32>) -> f32 {
113
- if (source == FLUID_MG_SOURCE_PRESSURE) {
114
- return fluid_pressure_ghost(world_cell);
115
- }
116
-
117
- return 0.0;
118
- }
119
-
120
-
121
- // where the finest level's window is, for its pressure ghosts
122
- fn fluid_pressure_ghost_corner() -> vec3<i32> {
123
- return params.corner;
124
- }
125
-
126
- fn fluid_pressure_ghost_size() -> vec3<u32> {
127
- return params.size;
128
- }
129
- fn tile_read_p(local: vec3<i32>) -> f32 {
130
- return grid_tile_f32_read(&tile_p, local);
131
- }
132
-
133
- @compute @workgroup_size(8, 8, 4)
134
- fn main(
135
- @builtin(workgroup_id) group: vec3<u32>,
136
- @builtin(local_invocation_id) local_id: vec3<u32>,
137
- @builtin(local_invocation_index) lane: u32,
138
- ) {
139
- let window = ${GRID_TILE_WINDOW_STRUCT.wgsl_ref}(params.corner, params.input_corner_storage, params.size, params.input_period);
140
- let source = select(FLUID_MG_SOURCE_ERROR, FLUID_MG_SOURCE_PRESSURE, params.level == 0u);
141
- let tile_origin = vec3<i32>(group) * GRID_TILE_SIZE;
142
- coarse_tile_origin = (tile_origin >> vec3<u32>(1u)) - vec3<i32>(1);
143
-
144
- if (params.prolong != 0u) {
145
- if (lane < FLUID_MG_COARSE_TILE_CELLS) {
146
- let coarse_local = vec3<i32>(index_to_grid3d(lane, vec2<u32>(6u, 6u)));
147
- let coarse_cell = coarse_tile_origin + coarse_local;
148
- var coarse_value = 0.0;
149
-
150
- if (all(coarse_cell >= vec3<i32>(0)) && all(coarse_cell < vec3<i32>(params.coarse_size))) {
151
- let c = vec3<u32>(coarse_cell);
152
- coarse_value = coarse[c.x + params.coarse_size.x * (c.y + params.coarse_size.y * c.z)];
153
- }
154
-
155
- tile_coarse[lane] = coarse_value;
156
- }
157
-
158
- workgroupBarrier();
159
- }
160
-
161
- grid_tile_f32_load(&tile_p, window, source, tile_origin, lane);
162
-
163
- let local = vec3<i32>(local_id);
164
- let cell = vec3<u32>(tile_origin + local);
165
- let inside = all(cell < params.size);
166
-
167
- var word = 0u;
168
- var f = 0.0;
169
- var zeroed = 0u;
170
-
171
- if (inside) {
172
- let linear = cell.x + params.size.x * (cell.y + params.size.y * cell.z);
173
- let rhs_value = rhs[linear];
174
- let held = input[fluid_mg_input_index(grid_tile_window_storage(vec3<i32>(cell), params.input_corner_storage, params.input_period))];
175
-
176
- word = words[linear];
177
- let keep = select(rhs_value, held, word == 0u);
178
- f = select(0.0, keep, is_finite(keep));
179
- zeroed = select(0u, 1u, !is_finite(held)) + select(0u, 1u, !is_finite(rhs_value));
180
- }
181
-
182
- subgroup_atomic_add_u32(&nonfinite[0], zeroed);
183
-
184
- let parity = (cell.x + cell.y + cell.z) & 1u;
185
- let sweeps = min(params.sweeps, FLUID_MG_SMOOTH_SWEEP_LIMIT);
186
-
187
- for (var sweep = 0u; sweep < sweeps; sweep++) {
188
- for (var colour = 0u; colour < 2u; colour++) {
189
- if (inside && word != 0u && parity == colour && ((params.colours >> colour) & 1u) != 0u) {
190
- let stencil = fluid_mg_stencil(local, cell, params.size, word, params.edge_weight);
191
-
192
- grid_tile_f32_write(&tile_p, local, fluid_mg_relax(tile_read_p(local), stencil, f, params.h2, params.omega));
193
- }
194
-
195
- workgroupBarrier();
196
- }
197
- }
198
-
199
- if (inside) {
200
- var value = tile_read_p(local);
201
-
202
- if (params.prolong != 0u && word == 0u) {
203
- value = f;
204
- }
205
-
206
- let storage = grid_tile_window_storage(vec3<i32>(cell), params.output_corner_storage, params.output_period);
207
-
208
- output[storage.x + params.output_period.x * (storage.y + params.output_period.y * storage.z)] = value;
209
- }
210
- }
211
- `, [
212
- chunk_grid_tile_halo_f32,
213
- chunk_index_to_grid3d,
214
- chunk_fluid_mg_relax,
215
- chunk_fluid_pressure_ghost,
216
- chunk_is_finite,
217
- chunk_subgroup_atomic_add,
218
- ]),
219
- });
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+ import { ComputeShader } from "../../shader/ComputeShader.js";
3
+ import { chunk_grid3d_to_index } from "../../shader/chunk/grid/chunk_grid3d_to_index.js";
4
+ import { chunk_grid_tile_halo_f32 } from "../../shader/chunk/grid/chunk_grid_tile_halo_f32.js";
5
+ import { GRID_TILE_WINDOW_STRUCT } from "../../shader/chunk/grid/GRID_TILE_WINDOW_STRUCT.js";
6
+ import { chunk_index_to_grid3d } from "../../shader/chunk/grid/chunk_index_to_grid3d.js";
7
+ import { chunk_is_finite } from "../../shader/chunk/math/chunk_is_finite.js";
8
+ import { chunk_subgroup_atomic_add } from "../../shader/chunk/subgroup/chunk_subgroup_atomic_add.js";
9
+ import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
10
+ import { atomic_u32, f32, u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
11
+ import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
12
+ import { chunk_fluid_mg_relax } from "./chunk_fluid_mg_relax.js";
13
+ import { chunk_fluid_pressure_ghost } from "./chunk_fluid_pressure_ghost.js";
14
+ import { FLUID_MG_SMOOTH_SWEEP_LIMIT } from "./FLUID_MG.js";
15
+ import { FLUID_MG_PASS_STRUCT } from "./FLUID_MG_PASS_STRUCT.js";
16
+
17
+ const resources = new ShaderResourceSetDescriptor();
18
+
19
+ resources.createGroup()
20
+ .addUniform('params', FLUID_MG_PASS_STRUCT)
21
+ .addStorageBuffer('input', WebGPUArray.from(f32), false)
22
+ .addStorageBuffer('output', WebGPUArray.from(f32), true)
23
+ .addStorageBuffer('rhs', WebGPUArray.from(f32), false)
24
+ .addStorageBuffer('words', WebGPUArray.from(u32), false)
25
+ .addStorageBuffer('coarse', WebGPUArray.from(f32), false)
26
+ .addStorageBuffer('nonfinite', WebGPUArray.from(atomic_u32), true)
27
+ .addStorageBuffer('ghost_pressure', WebGPUArray.from(f32), false);
28
+
29
+ /**
30
+ * The pressure V-cycle's smoother, and the SOR arm's (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §8): one
31
+ * workgroup an 8×8×4 tile of a level, one invocation a cell.
32
+ *
33
+ * 1. The workgroup loads its tile and a one-cell halo from `input` into workgroup memory
34
+ * (`chunk_grid_tile_halo_f32`). A value that is not finite is loaded as 0. With `prolong`, the 6×6×4
35
+ * coarse error neighbourhood covering the tile and its halo is first staged into workgroup memory
36
+ * (`tile_coarse`, 144 cells, out-of-bounds coarse cells zeroed), and every value inside the level is
37
+ * loaded with the coarser level's error added trilinearly (`fluid_mg_prolong_cached`), which is the
38
+ * separate prolongation pass folded in. A cell beyond the level is its ghost: the cascade's Dirichlet
39
+ * pressure on the finest level, its parent's at the ghost cell's centre (`chunk_fluid_pressure_ghost`,
40
+ * from the step's `ghost_pressure`), 0 below it.
41
+ * 2. `sweeps` times, for red then black, each cell of a colour in `colours` with a degree of freedom
42
+ * relaxes toward its equation (`chunk_fluid_mg_relax`) against its neighbours in the tile, the
43
+ * halo frozen. A colour reads only the other colour, so its cells update together, and a barrier
44
+ * separates the colours.
45
+ * 3. Every cell inside the level is written to `output`, which is never `input`, so no tile reads what
46
+ * another wrote. With `prolong`, a cell with no degree of freedom is written as `input` held it (a
47
+ * non-finite value as 0): the prolongation leaves it alone.
48
+ *
49
+ * Both colours in one dispatch, as the V-cycle runs it, is only stable at ω = 1; the SOR arm runs one
50
+ * colour a dispatch at ω > 1, which against a halo of the other colour is the global red-black update
51
+ * exactly. The host asserts both.
52
+ *
53
+ * Each invocation counts its own cell's input and RHS when not finite, and the workgroup adds the counts
54
+ * to `nonfinite[0]` with one atomic per subgroup.
55
+ *
56
+ * Dispatched as `ceil(size / (8, 8, 4))` workgroups. Workgroup memory: 2,976 bytes.
57
+ */
58
+ export const shader_fluid_mg_smooth = ComputeShader.from({
59
+ label: 'Fluid / pressure / smooth',
60
+ resources,
61
+ body: CodeChunk.from(
62
+ //language=WGSL
63
+ `
64
+ const FLUID_MG_SOURCE_PRESSURE = 0u;
65
+ const FLUID_MG_SOURCE_ERROR = 1u;
66
+ const FLUID_MG_SMOOTH_SWEEP_LIMIT = ${FLUID_MG_SMOOTH_SWEEP_LIMIT}u;
67
+ const FLUID_MG_COARSE_TILE_CELLS = 144u;
68
+
69
+ var<workgroup> tile_p: array<f32, GRID_TILE_HALO_CELLS>;
70
+ var<workgroup> tile_coarse: array<f32, FLUID_MG_COARSE_TILE_CELLS>;
71
+ var<private> coarse_tile_origin: vec3<i32>;
72
+
73
+ fn fluid_mg_input_index(storage_cell: vec3<u32>) -> u32 {
74
+ return grid3d_to_index(storage_cell, params.input_period.xy);
75
+ }
76
+
77
+ // the window-local cell an input storage cell holds: the inverse of grid_tile_window_storage
78
+ fn fluid_mg_input_local(storage_cell: vec3<u32>) -> vec3<i32> {
79
+ let offset = vec3<i32>(storage_cell) - vec3<i32>(params.input_corner_storage);
80
+
81
+ return select(offset, offset + vec3<i32>(params.input_period), offset < vec3<i32>(0));
82
+ }
83
+
84
+ fn fluid_mg_prolong_cached(fine: vec3<i32>) -> f32 {
85
+ let c = vec3<u32>((fine >> vec3<u32>(1u)) - coarse_tile_origin);
86
+ let base = i32(grid3d_to_index(c, vec2<u32>(6u, 6u)));
87
+ let dx = select(-1, 1, (fine.x & 1) != 0);
88
+ let dy = select(-6, 6, (fine.y & 1) != 0);
89
+ let dz = select(-36, 36, (fine.z & 1) != 0);
90
+
91
+ var v = 0.421875 * tile_coarse[u32(base)];
92
+ v += 0.140625 * tile_coarse[u32(base + dx)];
93
+ v += 0.140625 * tile_coarse[u32(base + dy)];
94
+ v += 0.046875 * tile_coarse[u32(base + dx + dy)];
95
+ v += 0.140625 * tile_coarse[u32(base + dz)];
96
+ v += 0.046875 * tile_coarse[u32(base + dx + dz)];
97
+ v += 0.046875 * tile_coarse[u32(base + dy + dz)];
98
+ v += 0.015625 * tile_coarse[u32(base + dx + dy + dz)];
99
+
100
+ return v;
101
+ }
102
+
103
+ fn grid_tile_f32_fetch_inside(source: u32, storage_cell: vec3<u32>) -> f32 {
104
+ var value = input[fluid_mg_input_index(storage_cell)];
105
+
106
+ if (params.prolong != 0u) {
107
+ value += fluid_mg_prolong_cached(fluid_mg_input_local(storage_cell));
108
+ }
109
+
110
+ return select(0.0, value, is_finite(value));
111
+ }
112
+
113
+ fn grid_tile_f32_fetch_outside(source: u32, world_cell: vec3<i32>) -> f32 {
114
+ if (source == FLUID_MG_SOURCE_PRESSURE) {
115
+ return fluid_pressure_ghost(world_cell);
116
+ }
117
+
118
+ return 0.0;
119
+ }
120
+
121
+
122
+ // where the finest level's window is, for its pressure ghosts
123
+ fn fluid_pressure_ghost_corner() -> vec3<i32> {
124
+ return params.corner;
125
+ }
126
+
127
+ fn fluid_pressure_ghost_size() -> vec3<u32> {
128
+ return params.size;
129
+ }
130
+ fn tile_read_p(local: vec3<i32>) -> f32 {
131
+ return grid_tile_f32_read(&tile_p, local);
132
+ }
133
+
134
+ @compute @workgroup_size(8, 8, 4)
135
+ fn main(
136
+ @builtin(workgroup_id) group: vec3<u32>,
137
+ @builtin(local_invocation_id) local_id: vec3<u32>,
138
+ @builtin(local_invocation_index) lane: u32,
139
+ ) {
140
+ let window = ${GRID_TILE_WINDOW_STRUCT.wgsl_ref}(params.corner, params.input_corner_storage, params.size, params.input_period);
141
+ let source = select(FLUID_MG_SOURCE_ERROR, FLUID_MG_SOURCE_PRESSURE, params.level == 0u);
142
+ let tile_origin = vec3<i32>(group) * GRID_TILE_SIZE;
143
+ coarse_tile_origin = (tile_origin >> vec3<u32>(1u)) - vec3<i32>(1);
144
+
145
+ if (params.prolong != 0u) {
146
+ if (lane < FLUID_MG_COARSE_TILE_CELLS) {
147
+ let coarse_local = vec3<i32>(index_to_grid3d(lane, vec2<u32>(6u, 6u)));
148
+ let coarse_cell = coarse_tile_origin + coarse_local;
149
+ var coarse_value = 0.0;
150
+
151
+ if (all(coarse_cell >= vec3<i32>(0)) && all(coarse_cell < vec3<i32>(params.coarse_size))) {
152
+ let c = vec3<u32>(coarse_cell);
153
+ coarse_value = coarse[grid3d_to_index(c, params.coarse_size.xy)];
154
+ }
155
+
156
+ tile_coarse[lane] = coarse_value;
157
+ }
158
+
159
+ workgroupBarrier();
160
+ }
161
+
162
+ grid_tile_f32_load(&tile_p, window, source, tile_origin, lane);
163
+
164
+ let local = vec3<i32>(local_id);
165
+ let cell = vec3<u32>(tile_origin + local);
166
+ let inside = all(cell < params.size);
167
+
168
+ var word = 0u;
169
+ var f = 0.0;
170
+ var zeroed = 0u;
171
+
172
+ if (inside) {
173
+ let linear = grid3d_to_index(cell, params.size.xy);
174
+ let rhs_value = rhs[linear];
175
+ let held = input[fluid_mg_input_index(grid_tile_window_storage(vec3<i32>(cell), params.input_corner_storage, params.input_period))];
176
+
177
+ word = words[linear];
178
+ let keep = select(rhs_value, held, word == 0u);
179
+ f = select(0.0, keep, is_finite(keep));
180
+ zeroed = select(0u, 1u, !is_finite(held)) + select(0u, 1u, !is_finite(rhs_value));
181
+ }
182
+
183
+ subgroup_atomic_add_u32(&nonfinite[0], zeroed);
184
+
185
+ let parity = (cell.x + cell.y + cell.z) & 1u;
186
+ let sweeps = min(params.sweeps, FLUID_MG_SMOOTH_SWEEP_LIMIT);
187
+
188
+ for (var sweep = 0u; sweep < sweeps; sweep++) {
189
+ for (var colour = 0u; colour < 2u; colour++) {
190
+ if (inside && word != 0u && parity == colour && ((params.colours >> colour) & 1u) != 0u) {
191
+ let stencil = fluid_mg_stencil(local, cell, params.size, word, params.edge_weight);
192
+
193
+ grid_tile_f32_write(&tile_p, local, fluid_mg_relax(tile_read_p(local), stencil, f, params.h2, params.omega));
194
+ }
195
+
196
+ workgroupBarrier();
197
+ }
198
+ }
199
+
200
+ if (inside) {
201
+ var value = tile_read_p(local);
202
+
203
+ if (params.prolong != 0u && word == 0u) {
204
+ value = f;
205
+ }
206
+
207
+ let storage = grid_tile_window_storage(vec3<i32>(cell), params.output_corner_storage, params.output_period);
208
+
209
+ output[grid3d_to_index(storage, params.output_period.xy)] = value;
210
+ }
211
+ }
212
+ `, [
213
+ chunk_grid3d_to_index,
214
+ chunk_grid_tile_halo_f32,
215
+ chunk_index_to_grid3d,
216
+ chunk_fluid_mg_relax,
217
+ chunk_fluid_pressure_ghost,
218
+ chunk_is_finite,
219
+ chunk_subgroup_atomic_add,
220
+ ]),
221
+ });
@@ -49,7 +49,7 @@ export class GPUFluidQueries {
49
49
  * @param {import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
50
50
  * @param {{encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
51
51
  */
52
- static "__#283@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
52
+ static "__#285@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
53
53
  encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
54
54
  }): void;
55
55
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"shader_fog_of_war.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/fow/shader_fog_of_war.js"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,6CAqBsB;AA4KtB;;;;;;;;;;;GAWG;AACH,gCAFU,WAAW,CA0BlB;AAEH;;;;GAIG;AACH,mCAFU,2BAA2B,CAES;6BAlPjB,gCAAgC;4BAJjC,0BAA0B;4CACV,mDAAmD"}
1
+ {"version":3,"file":"shader_fog_of_war.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/fow/shader_fog_of_war.js"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,6CAqBsB;AA+JtB;;;;;;;;;;;GAWG;AACH,gCAFU,WAAW,CA0BlB;AAEH;;;;GAIG;AACH,mCAFU,2BAA2B,CAES;6BArOjB,gCAAgC;4BAJjC,0BAA0B;4CACV,mDAAmD"}
@@ -7,6 +7,8 @@ import { BlendState } from "../../descriptor/blend/BlendState.js";
7
7
  import { CAMERA_UNIFORM_STRUCT } from "../camera/CAMERA_UNIFORM_STRUCT.js";
8
8
  import { chunk_project_position_from_depth } from "../shader/chunk/camera/chunk_project_position_from_depth.js";
9
9
  import { chunk_mat4_extract_position } from "../shader/chunk/geometry/mat4/chunk_mat4_extract_position.js";
10
+ import { chunk_gaussian } from "../shader/chunk/math/statistics/chunk_gaussian.js";
11
+ import { chunk_interleaved_gradient_noise } from "../shader/chunk/noise/chunk_interleaved_gradient_noise.js";
10
12
  import { CodeChunk } from "../shader/compiler/CodeChunk.js";
11
13
  import { ImageShader } from "../shader/ImageShader.js";
12
14
  import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
@@ -72,8 +74,6 @@ const HALF_SAMPLES_Y = f32(SAMPLES_Y - 1) * 0.5;
72
74
 
73
75
  const SIGMA = vec2<f32>(${FOG_OF_WAR_BLUR_SIGMA}, ${FOG_OF_WAR_BLUR_SIGMA});
74
76
 
75
- const SIGMA_SQ_2 = SIGMA * SIGMA * 2.0;
76
-
77
77
  const TAP_SPACING = f32(${FOG_OF_WAR_BLUR_TAP_SPACING});
78
78
 
79
79
  /**
@@ -81,10 +81,6 @@ const TAP_SPACING = f32(${FOG_OF_WAR_BLUR_TAP_SPACING});
81
81
  */
82
82
  const MINIMUM_DEPTH = 1e-6;
83
83
 
84
- fn gaussian(sigma_sq_2: f32, x: f32) -> f32 {
85
- return exp(-(x * x) / sigma_sq_2);
86
- }
87
-
88
84
  /**
89
85
  * The mask, smoothed. The fog grid is one texel per world cell, so an unsmoothed read is a grid of
90
86
  * squares — the blur is the look rather than an approximation of one.
@@ -97,11 +93,11 @@ fn sample_fog(uv: vec2<f32>) -> f32 {
97
93
 
98
94
  for (var iy = 0; iy < SAMPLES_Y; iy = iy + 1) {
99
95
  let y = f32(iy) - HALF_SAMPLES_Y;
100
- let fy = gaussian(SIGMA_SQ_2.y, y);
96
+ let fy = gaussian(SIGMA.y, y);
101
97
 
102
98
  for (var ix = 0; ix < SAMPLES_X; ix = ix + 1) {
103
99
  let x = f32(ix) - HALF_SAMPLES_X;
104
- let fx = gaussian(SIGMA_SQ_2.x, x);
100
+ let fx = gaussian(SIGMA.x, x);
105
101
 
106
102
  let weight = fx * fy;
107
103
 
@@ -119,15 +115,6 @@ fn sample_fog(uv: vec2<f32>) -> f32 {
119
115
  return accumulated / total;
120
116
  }
121
117
 
122
- /**
123
- * Interleaved gradient noise.
124
- *
125
- * @see Jimenez 2014, "Next Generation Post Processing in Call of Duty"
126
- */
127
- fn gradient_noise(coord: vec2<f32>) -> f32 {
128
- return fract(52.9829189 * fract(dot(coord, vec2<f32>(0.06711056, 0.00583715))));
129
- }
130
-
131
118
  @fragment
132
119
  fn main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> {
133
120
  let resolution = vec2<f32>(textureDimensions(tDepth).xy);
@@ -196,8 +183,8 @@ fn main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> {
196
183
  colour scaled by it in the blend — so both are dithered, and the rgb noise is attenuated by
197
184
  alpha exactly as the rgb band amplitude is.
198
185
  */
199
- let noise_a = gradient_noise(coord.xy) * (1.0 / 255.0) - (0.5 / 255.0);
200
- let noise_rgb = gradient_noise(coord.xy + vec2<f32>(7.0, 13.0)) * (1.0 / 255.0) - (0.5 / 255.0);
186
+ let noise_a = interleaved_gradient_noise(coord.xy) * (1.0 / 255.0) - (0.5 / 255.0);
187
+ let noise_rgb = interleaved_gradient_noise(coord.xy + vec2<f32>(7.0, 13.0)) * (1.0 / 255.0) - (0.5 / 255.0);
201
188
 
202
189
  color.a = color.a + noise_a;
203
190
  color = vec4<f32>(color.rgb + vec3<f32>(noise_rgb), color.a);
@@ -208,6 +195,8 @@ fn main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> {
208
195
  CAMERA_UNIFORM_STRUCT.declaration_chunk,
209
196
  chunk_project_position_from_depth,
210
197
  chunk_mat4_extract_position,
198
+ chunk_gaussian,
199
+ chunk_interleaved_gradient_noise,
211
200
  ]
212
201
  );
213
202