@woosh/meep-engine 3.60.6 → 3.60.8

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 (328) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/package.json +1 -1
  3. package/src/core/binary/BitSet.d.ts.map +1 -1
  4. package/src/core/binary/BitSet.js +2 -1
  5. package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.d.ts +2 -2
  6. package/src/core/binary/operations/ceil_log2.d.ts.map +1 -0
  7. package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.js +18 -18
  8. package/src/core/binary/zstd/ZstdReverseBitReader.d.ts.map +1 -1
  9. package/src/core/binary/zstd/ZstdReverseBitReader.js +225 -223
  10. package/src/core/binary/zstd/zstd_fse.d.ts.map +1 -1
  11. package/src/core/binary/zstd/zstd_fse.js +267 -265
  12. package/src/core/binary/zstd/zstd_huffman.d.ts.map +1 -1
  13. package/src/core/binary/zstd/zstd_huffman.js +246 -244
  14. package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
  15. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +8 -2
  16. package/src/core/bvh2/bvh3/ebvh_optimize_treelet.d.ts.map +1 -1
  17. package/src/core/bvh2/bvh3/ebvh_optimize_treelet.js +8 -7
  18. package/src/core/collection/PairUint32Map.d.ts.map +1 -1
  19. package/src/core/collection/PairUint32Map.js +2 -2
  20. package/src/core/collection/Uint32Map.d.ts.map +1 -1
  21. package/src/core/collection/Uint32Map.js +2 -4
  22. package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -1
  23. package/src/core/collection/heap/FibonacciHeap.js +2 -1
  24. package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
  25. package/src/core/geom/2d/r-tree/StaticR2Tree.js +8 -2
  26. package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.d.ts.map +1 -1
  27. package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.js +2 -3
  28. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  29. package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -14
  30. package/src/engine/graphics/texture/atlas/sprite_atlas_border.d.ts.map +1 -1
  31. package/src/engine/graphics/texture/atlas/sprite_atlas_border.js +70 -69
  32. package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.d.ts.map +1 -1
  33. package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.js +2 -1
  34. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  35. package/src/engine/graphics3/GPUParticleEmitterSystem.js +2 -1
  36. package/src/engine/graphics3/decal/GPUDecalRenderer.d.ts.map +1 -1
  37. package/src/engine/graphics3/decal/GPUDecalRenderer.js +2 -1
  38. package/src/engine/graphics3/decal/chunk_decal_record.d.ts +14 -0
  39. package/src/engine/graphics3/decal/chunk_decal_record.d.ts.map +1 -0
  40. package/src/engine/graphics3/decal/chunk_decal_record.js +44 -0
  41. package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts.map +1 -1
  42. package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +2 -15
  43. package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts.map +1 -1
  44. package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +3 -16
  45. package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
  46. package/src/engine/graphics3/decal/shader_decal_composite.js +3 -23
  47. package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.d.ts.map +1 -1
  48. package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.js +2 -1
  49. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  50. package/src/engine/physics/queries/shape_cast.js +2 -2
  51. package/src/format/image/avif/av1/decode/decode_palette.js +442 -442
  52. package/src/format/image/avif/av1/entropy/SymbolWriter.d.ts.map +1 -1
  53. package/src/format/image/avif/av1/entropy/SymbolWriter.js +2 -1
  54. package/src/generation/foliage/material/foliage_tile.d.ts.map +1 -1
  55. package/src/generation/foliage/material/foliage_tile.js +2 -1
  56. package/src/generation/markers/GridActionRuleSet.d.ts.map +1 -1
  57. package/src/generation/markers/GridActionRuleSet.js +12 -3
  58. package/src/shade/device/mock/SoftwareGPUDevice.d.ts.map +1 -1
  59. package/src/shade/device/mock/SoftwareGPUDevice.js +6 -13
  60. package/src/shade/playground/caldera/main.js +3 -2
  61. package/src/shade/playground/probe_clipmap/README.md +2 -1
  62. package/src/shade/playground/probe_clipmap/index.html +7 -2
  63. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  64. package/src/shade/playground/probe_clipmap/main.js +17 -7
  65. package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.d.ts.map +1 -1
  66. package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.js +7 -13
  67. package/src/shade/playground/vgeo_scene/main.js +2 -1
  68. package/src/shade/playground/vsm/VSMDebugOverlay.d.ts.map +1 -1
  69. package/src/shade/playground/vsm/VSMDebugOverlay.js +3 -1
  70. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  71. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  72. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  73. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  74. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.d.ts.map +1 -1
  75. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.js +5 -4
  76. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.d.ts.map +1 -1
  77. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.js +168 -166
  78. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.d.ts.map +1 -1
  79. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.js +221 -219
  80. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  81. package/src/shade/renderer/fow/shader_fog_of_war.d.ts.map +1 -1
  82. package/src/shade/renderer/fow/shader_fog_of_war.js +8 -19
  83. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  84. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +6 -6
  85. package/src/shade/renderer/geometry/sdf/MeshSDFLayout.d.ts.map +1 -1
  86. package/src/shade/renderer/geometry/sdf/MeshSDFLayout.js +2 -1
  87. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
  88. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +2 -1
  89. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
  90. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +2 -1
  91. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.d.ts.map +1 -1
  92. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.js +10 -31
  93. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.d.ts.map +1 -1
  94. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.js +9 -15
  95. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts +2 -1
  96. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts.map +1 -1
  97. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.js +6 -5
  98. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.d.ts.map +1 -1
  99. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.js +2 -1
  100. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +15 -3
  101. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  102. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +168 -18
  103. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +98 -57
  104. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  105. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +168 -77
  106. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +4 -2
  107. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  108. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +27 -12
  109. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
  110. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +12 -7
  111. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  112. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +8 -2
  113. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -1
  114. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +5 -2
  115. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +1 -1
  116. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
  117. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +5 -3
  118. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +1 -1
  119. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
  120. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +1 -1
  121. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.d.ts.map +1 -1
  122. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.js +4 -2
  123. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.d.ts.map +1 -1
  124. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.js +1 -1
  125. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.d.ts.map +1 -1
  126. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.js +1 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.d.ts.map +1 -1
  128. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.js +3 -1
  129. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_cards.js +2 -2
  130. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +114 -41
  131. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  132. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +424 -207
  133. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +34 -25
  134. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  135. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +41 -31
  136. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts +7 -5
  137. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts.map +1 -1
  138. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.js +7 -5
  139. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts +47 -0
  140. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts.map +1 -0
  141. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.js +84 -0
  142. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +48 -0
  143. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -0
  144. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +101 -0
  145. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +58 -4
  146. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  147. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +127 -30
  148. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts +18 -7
  149. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts.map +1 -1
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.js +39 -13
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts +29 -8
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts.map +1 -1
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +112 -56
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts +19 -0
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts.map +1 -0
  156. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.js +35 -0
  157. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +9 -3
  159. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +3 -3
  160. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +5 -5
  161. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +8 -12
  162. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
  163. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +23 -56
  164. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +0 -3
  165. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
  166. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +11 -15
  167. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts +26 -0
  168. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts.map +1 -0
  169. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.js +173 -0
  170. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts +32 -0
  171. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts.map +1 -0
  172. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.js +166 -0
  173. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +3 -4
  174. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  175. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +3 -4
  176. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -1
  177. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +3 -1
  178. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +6 -12
  179. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  180. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +15 -65
  181. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -1
  182. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +7 -2
  183. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +4 -4
  184. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
  185. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +24 -17
  186. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts +7 -5
  187. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts.map +1 -1
  188. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.js +18 -10
  189. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +2 -2
  190. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -1
  191. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +9 -5
  192. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts +3 -0
  193. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
  194. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +9 -6
  195. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts +1 -1
  196. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts.map +1 -1
  197. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.js +16 -16
  198. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts +36 -0
  199. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts.map +1 -0
  200. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.js +233 -0
  201. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  202. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +7 -5
  203. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
  204. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +5 -3
  205. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  206. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +10 -4
  207. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +2 -1
  208. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
  209. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +12 -6
  210. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +1 -2
  211. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
  212. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +5 -6
  213. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +14 -18
  214. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
  215. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +25 -35
  216. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts +13 -0
  217. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts.map +1 -0
  218. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.js +12 -0
  219. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts +27 -2
  220. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts.map +1 -1
  221. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.js +62 -6
  222. package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.d.ts.map +1 -1
  223. package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.js +10 -19
  224. package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.d.ts.map +1 -1
  225. package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.js +6 -3
  226. package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts.map +1 -1
  227. package/src/shade/renderer/hiz/hzb_pick_alignment.js +149 -148
  228. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.d.ts.map +1 -1
  229. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.js +4 -2
  230. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.d.ts.map +1 -1
  231. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.js +6 -5
  232. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.d.ts.map +1 -1
  233. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.js +3 -1
  234. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.d.ts.map +1 -1
  235. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.js +3 -1
  236. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.d.ts.map +1 -1
  237. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.js +3 -1
  238. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts +0 -5
  239. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts.map +1 -1
  240. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.js +0 -7
  241. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts +15 -2
  242. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts.map +1 -1
  243. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js +51 -16
  244. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts.map +1 -1
  245. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js +3 -2
  246. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  247. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts +17 -0
  248. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts.map +1 -0
  249. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.js +81 -0
  250. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.d.ts.map +1 -1
  251. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js +5 -48
  252. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.d.ts.map +1 -1
  253. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js +4 -44
  254. package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.d.ts.map +1 -1
  255. package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js +4 -1
  256. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
  257. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +8 -7
  258. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  259. package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.d.ts.map +1 -1
  260. package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.js +5 -7
  261. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts +17 -0
  262. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts.map +1 -0
  263. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.js +56 -0
  264. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.d.ts.map +1 -1
  265. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.js +2 -22
  266. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.d.ts.map +1 -1
  267. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.js +2 -13
  268. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  269. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +10 -13
  270. package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.d.ts.map +1 -1
  271. package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.js +39 -38
  272. package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.d.ts.map +1 -1
  273. package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.js +7 -12
  274. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts +8 -6
  275. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts.map +1 -1
  276. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js +10 -7
  277. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts +16 -0
  278. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts.map +1 -0
  279. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.js +35 -0
  280. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts +5 -2
  281. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts.map +1 -1
  282. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.js +27 -18
  283. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.d.ts.map +1 -1
  284. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.js +5 -15
  285. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.d.ts.map +1 -1
  286. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.js +5 -19
  287. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.d.ts.map +1 -1
  288. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.js +3 -22
  289. package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.d.ts.map +1 -1
  290. package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.js +2 -1
  291. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.d.ts.map +1 -1
  292. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.js +154 -152
  293. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
  294. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +2 -1
  295. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts +3 -1
  296. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts.map +1 -1
  297. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js +4 -3
  298. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts +7 -1
  299. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts.map +1 -1
  300. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.js +54 -47
  301. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts.map +1 -1
  302. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.js +371 -370
  303. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  304. package/src/shade/renderer/water/GPUWaterRenderer.js +2 -1
  305. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  306. package/src/shade/renderer/water/surface/lod/shader_water_lod.d.ts.map +1 -1
  307. package/src/shade/renderer/water/surface/lod/shader_water_lod.js +12 -14
  308. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  309. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +2 -9
  310. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  311. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +2 -1
  312. package/src/shade/renderer/wind/WIND_FIELD.d.ts +3 -1
  313. package/src/shade/renderer/wind/WIND_FIELD.d.ts.map +1 -1
  314. package/src/shade/renderer/wind/WIND_FIELD.js +4 -3
  315. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +8 -2
  316. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
  317. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +11 -4
  318. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -2
  319. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  320. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +13 -4
  321. package/src/shade/util/texture_mip_extent.d.ts.map +1 -1
  322. package/src/shade/util/texture_mip_extent.js +88 -87
  323. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  324. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +9 -7
  325. package/src/format/image/avif/av1/util/ceil_log2.d.ts.map +0 -1
  326. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts +0 -1
  327. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts.map +0 -1
  328. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"graph_build_world_light_clusters.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js"],"names":[],"mappings":"AAoDA;;;;GAIG;AACH,sEAFW,eAAe,QAMzB;AAED;;;;;;;;;;;;;;;GAeG;AACH;IAXsG,KAAK,EAAhG,OAAO,8DAA8D,EAAE,UAAU;IAClB,MAAM,EAArE,OAAO,0BAA0B,EAAE,kBAAkB;IACrC,MAAM,EAAtB,MAAM;IAEU,aAAa,EAA7B,MAAM;IACU,MAAM,EAAtB,MAAM;IAEqB,YAAY,EAAvC,UAAU,MAAM,CAAC;IACU,YAAY,EAAvC,UAAU,MAAM,CAAC;IACf;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CA6H1C;8BAlLY,OAAO,6CAA6C,EAAE,eAAe"}
1
+ {"version":3,"file":"graph_build_world_light_clusters.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js"],"names":[],"mappings":"AAsCA;;;;GAIG;AACH,gEAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,8DAHW,MAAM,GACJ,MAAM,CAKlB;AA4BD;;;;GAIG;AACH,sEAFW,eAAe,QAMzB;AAED;;;;;;;;;;;;;;;GAeG;AACH;IAXsG,KAAK,EAAhG,OAAO,8DAA8D,EAAE,UAAU;IAClB,MAAM,EAArE,OAAO,0BAA0B,EAAE,kBAAkB;IACrC,MAAM,EAAtB,MAAM;IAEU,aAAa,EAA7B,MAAM;IACU,MAAM,EAAtB,MAAM;IAEqB,YAAY,EAAvC,UAAU,MAAM,CAAC;IACU,YAAY,EAAvC,UAAU,MAAM,CAAC;IACf;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAgI1C;8BAtNY,OAAO,6CAA6C,EAAE,eAAe"}
@@ -17,7 +17,6 @@ import {
17
17
  WORLD_LIGHT_CLUSTER_CULL_SETTINGS,
18
18
  WORLD_LIGHT_CLUSTER_GRID_SIZE,
19
19
  WORLD_LIGHT_CLUSTER_LIGHT_CAPACITY,
20
- WORLD_LIGHT_CLUSTER_MAX_CASCADES,
21
20
  WORLD_LIGHT_CLUSTER_MAX_LIGHTS_PER_CELL,
22
21
  } from "./WORLD_LIGHT_CLUSTER.js";
23
22
 
@@ -37,18 +36,51 @@ const PROXIES_DESCRIPTOR = BufferResourceDescriptor.from(
37
36
  GPUBufferUsage.STORAGE,
38
37
  );
39
38
 
40
- const LOOKUP_DESCRIPTOR = BufferResourceDescriptor.from(
41
- WORLD_LIGHT_CLUSTER_MAX_CASCADES * WORLD_LIGHT_CLUSTER_CELLS_PER_CASCADE * LIGHT_CLUSTER_METADATA.aligned_size,
42
- GPUBufferUsage.STORAGE,
43
- );
39
+ /**
40
+ * Bytes of the cluster lookup over a clipmap of so many cascades.
41
+ * @param {number} cascade_count
42
+ * @returns {number}
43
+ */
44
+ export function world_light_clusters_lookup_size(cascade_count) {
45
+ return cascade_count * WORLD_LIGHT_CLUSTER_CELLS_PER_CASCADE * LIGHT_CLUSTER_METADATA.aligned_size;
46
+ }
44
47
 
45
- const DATA_DESCRIPTOR = BufferResourceDescriptor.from(
46
- COLLECTION_U32_STRUCT_WRITE.size
47
- + WORLD_LIGHT_CLUSTER_MAX_CASCADES * WORLD_LIGHT_CLUSTER_CELLS_PER_CASCADE * WORLD_LIGHT_CLUSTER_MAX_LIGHTS_PER_CELL * u32.size,
48
- GPUBufferUsage.STORAGE,
49
- 0,
50
- 16,
51
- );
48
+ /**
49
+ * Bytes of the cluster data over a clipmap of so many cascades: the larger of the two, which a host
50
+ * checks against the device's `maxStorageBufferBindingSize` for the cascades it builds.
51
+ * @param {number} cascade_count
52
+ * @returns {number}
53
+ */
54
+ export function world_light_clusters_data_size(cascade_count) {
55
+ return COLLECTION_U32_STRUCT_WRITE.size
56
+ + cascade_count * WORLD_LIGHT_CLUSTER_CELLS_PER_CASCADE * WORLD_LIGHT_CLUSTER_MAX_LIGHTS_PER_CELL * u32.size;
57
+ }
58
+
59
+ /**
60
+ * The lookup's and the data's descriptors by cascade count, made once a count: a clipmap's count is
61
+ * its structure, so a frame meets the one it met before.
62
+ * @type {Map<number, {lookup: BufferResourceDescriptor, data: BufferResourceDescriptor}>}
63
+ */
64
+ const descriptors_by_cascade_count = new Map();
65
+
66
+ /**
67
+ * @param {number} cascade_count
68
+ * @returns {{lookup: BufferResourceDescriptor, data: BufferResourceDescriptor}}
69
+ */
70
+ function descriptors_for(cascade_count) {
71
+ let descriptors = descriptors_by_cascade_count.get(cascade_count);
72
+
73
+ if (descriptors === undefined) {
74
+ descriptors = {
75
+ lookup: BufferResourceDescriptor.from(world_light_clusters_lookup_size(cascade_count), GPUBufferUsage.STORAGE),
76
+ data: BufferResourceDescriptor.from(world_light_clusters_data_size(cascade_count), GPUBufferUsage.STORAGE, 0, 16),
77
+ };
78
+
79
+ descriptors_by_cascade_count.set(cascade_count, descriptors);
80
+ }
81
+
82
+ return descriptors;
83
+ }
52
84
 
53
85
  /**
54
86
  * Offer the pipelines {@link graph_build_world_light_clusters} dispatches — see {@link PipelineEnquiry}.
@@ -68,8 +100,8 @@ export function enquire_build_world_light_clusters_pipelines(enquiry) {
68
100
  * @param {object} options
69
101
  * @param {import("../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} options.graph
70
102
  * @param {import("../GPULightCollection.js").GPULightCollection} options.lights
71
- * @param {number} options.levels graph handle of a uniform that starts with the clipmap's cascade windows,
72
- * a `CLIPMAP_LEVEL_ARRAY`
103
+ * @param {number} options.levels graph handle of a buffer that starts with the clipmap's cascade windows,
104
+ * `cascade_count` `CLIPMAP_LEVEL_STRUCT`s, finest first, read as storage
73
105
  * @param {number} options.cascade_count active cascade count
74
106
  * @param {number} options.border cells of its own past each face of a cascade's window that its cluster
75
107
  * cells cover too
@@ -193,8 +225,11 @@ export function graph_build_world_light_clusters({
193
225
  assign_data.levels = assign_pass.read(levels);
194
226
  assign_data.culled_lights = assign_pass.read(cull_data.culled_lights);
195
227
  assign_data.proxies = assign_pass.read(cull_data.proxies);
196
- assign_data.lookup = assign_pass.create("World cluster / lookup", LOOKUP_DESCRIPTOR);
197
- assign_data.data = assign_pass.create("World cluster / data", DATA_DESCRIPTOR);
228
+ // a clipmap of no cascade still binds a lookup and data, of one cascade
229
+ const descriptors = descriptors_for(Math.max(cascade_count, 1));
230
+
231
+ assign_data.lookup = assign_pass.create("World cluster / lookup", descriptors.lookup);
232
+ assign_data.data = assign_pass.create("World cluster / data", descriptors.data);
198
233
 
199
234
  return {
200
235
  lookup: assign_data.lookup,
@@ -1 +1 @@
1
- {"version":3,"file":"shader_world_cluster_assign_lights.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js"],"names":[],"mappings":"AAqBA,oEAA4E;AAI5E;;GAEG;AACH,4CAFU,YAAY,CAOW;AAmIjC;;;;;;;GAOG;AACH,iDAFU,aAAa,CAMpB;6BAvK0B,mCAAmC;8BAJlC,+BAA+B"}
1
+ {"version":3,"file":"shader_world_cluster_assign_lights.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js"],"names":[],"mappings":"AAqBA,oEAA4E;AAI5E;;GAEG;AACH,4CAFU,YAAY,CAOW;AAoIjC;;;;;;;GAOG;AACH,iDAFU,aAAa,CAMpB;6BAxK0B,mCAAmC;8BAJlC,+BAA+B"}
@@ -1,6 +1,6 @@
1
1
  import { COLLECTION_U32_STRUCT_READ } from "../../gpu_primitive/COLLECTION_U32_STRUCT_READ.js";
2
2
  import { COLLECTION_U32_STRUCT_WRITE } from "../../gpu_primitive/COLLECTION_U32_STRUCT_WRITE.js";
3
- import { CLIPMAP_LEVEL_ARRAY, CLIPMAP_LEVEL_STRUCT } from "../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
3
+ import { CLIPMAP_LEVEL_STRUCT } from "../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
4
4
  import { chunk_grid3d_to_index } from "../../shader/chunk/grid/chunk_grid3d_to_index.js";
5
5
  import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
6
6
  import { ComputeShader } from "../../shader/ComputeShader.js";
@@ -38,7 +38,8 @@ const resources = new ShaderResourceSetDescriptor();
38
38
  resources.setImmediate("settings", WORLD_CLUSTER_ASSIGN_SETTINGS);
39
39
 
40
40
  resources.createGroup()
41
- .addUniform("levels", CLIPMAP_LEVEL_ARRAY)
41
+ // read from the front of whatever buffer holds the clipmap's windows, however many it has
42
+ .addStorageBuffer("levels", WebGPUArray.from(CLIPMAP_LEVEL_STRUCT), false)
42
43
  .addStorageBuffer("culled_lights", COLLECTION_U32_STRUCT_READ, false)
43
44
  .addStorageBuffer("proxies", WebGPUArray.from(CLUSTER_LIGHT_PROXY), false)
44
45
  .addStorageBuffer("world_cluster_lookup", LIGHT_CLUSTER_LOOKUP_STRUCT, true)
@@ -13,7 +13,7 @@ export class TinyGltf {
13
13
  * @readonly
14
14
  * @type {TextureFormat}
15
15
  */
16
- static readonly "__#302@#UNCOMPRESSED_TARGET": TextureFormat;
16
+ static readonly "__#304@#UNCOMPRESSED_TARGET": TextureFormat;
17
17
  /**
18
18
  * @param {AssetManager} assetManager
19
19
  * @param {AssetRequestScope} [scope]
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Shared 88x88 f16-packed Circle-of-Confusion (CoC) workgroup LDS cache (8x8 tile + 40-pixel apron)
3
+ * for Depth-of-Field raymarch and slice compute passes.
4
+ *
5
+ * Expects `tColorCoc: texture_2d<f32>` in scope.
6
+ *
7
+ * ```wgsl
8
+ * fn dof_load_coc(p: vec2<i32>, dims: vec2<i32>) -> f32
9
+ * fn dof_populate_lds_coc(tile_blurred: bool, region_origin: vec2<i32>, lid: u32, dims: vec2<i32>)
10
+ * fn dof_read_coc(xt: vec2<i32>, region_origin: vec2<i32>) -> f32
11
+ * ```
12
+ *
13
+ * @type {CodeChunk}
14
+ */
15
+ export const chunk_dof_lds_coc_cache: CodeChunk;
16
+ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
17
+ //# sourceMappingURL=chunk_dof_lds_coc_cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_dof_lds_coc_cache.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,sCAFU,SAAS,CAyDjB;0BAhFwB,uCAAuC"}
@@ -0,0 +1,81 @@
1
+ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
2
+ import { DOF_LDS_APRON, DOF_LDS_WORKGROUP } from "../DOF_CONFIG.js";
3
+
4
+ // ── Workgroup-LDS cache geometry (derived; see DOF_LDS_* in DOF_CONFIG) ──
5
+ const WG = DOF_LDS_WORKGROUP; // 8 — workgroup side
6
+ const APRON = DOF_LDS_APRON; // 40 — cached skirt, full-res px
7
+ const REGION = WG + 2 * APRON; // 88 — cached square side (even)
8
+ const ROW_U32 = REGION / 2; // 44 — u32 per cached row (2 f16/u32)
9
+ const LDS_U32 = REGION * ROW_U32; // 3872 — total u32 (× 4 B = 15 488 B)
10
+ const WG_THREADS = WG * WG; // 64 — threads per workgroup
11
+
12
+ /**
13
+ * Shared 88x88 f16-packed Circle-of-Confusion (CoC) workgroup LDS cache (8x8 tile + 40-pixel apron)
14
+ * for Depth-of-Field raymarch and slice compute passes.
15
+ *
16
+ * Expects `tColorCoc: texture_2d<f32>` in scope.
17
+ *
18
+ * ```wgsl
19
+ * fn dof_load_coc(p: vec2<i32>, dims: vec2<i32>) -> f32
20
+ * fn dof_populate_lds_coc(tile_blurred: bool, region_origin: vec2<i32>, lid: u32, dims: vec2<i32>)
21
+ * fn dof_read_coc(xt: vec2<i32>, region_origin: vec2<i32>) -> f32
22
+ * ```
23
+ *
24
+ * @type {CodeChunk}
25
+ */
26
+ export const chunk_dof_lds_coc_cache = CodeChunk.from(
27
+ //language=WGSL
28
+ `
29
+ const WG: i32 = ${WG};
30
+ const APRON: i32 = ${APRON};
31
+ const REGION: i32 = ${REGION};
32
+ const ROW_U32: i32 = ${ROW_U32};
33
+ const LDS_U32: u32 = ${LDS_U32}u;
34
+ const WG_THREADS: u32 = ${WG_THREADS}u;
35
+
36
+ // Workgroup CoC cache: the REGION×REGION (tile + apron) signed-CoC field, two
37
+ // f16 packed per u32. The CoC texture is rgba16float, so packing its already-
38
+ // f16 .a channel round-trips losslessly — the cached march stays bit-identical
39
+ // to the texture march (and to the fragment reference).
40
+ var<workgroup> lds_coc: array<u32, LDS_U32>;
41
+
42
+ // Clamped CoC fetch used by the cooperative load.
43
+ fn dof_load_coc(p: vec2<i32>, dims: vec2<i32>) -> f32 {
44
+ return textureLoad(tColorCoc, clamp(p, vec2<i32>(0), dims - vec2<i32>(1)), 0).a;
45
+ }
46
+
47
+ // Cooperative load: pack the tile+apron CoC field into shared memory. Each
48
+ // u32 slot holds two horizontally-adjacent texels of the REGION grid; every
49
+ // slot is written by exactly one thread, so there is no read-modify-write
50
+ // race. Skipped entirely for an in-focus tile (the load is the bulk of the
51
+ // cost the cache is meant to remove).
52
+ fn dof_populate_lds_coc(tile_blurred: bool, region_origin: vec2<i32>, lid: u32, dims: vec2<i32>) {
53
+ if (tile_blurred) {
54
+ for (var s: u32 = lid; s < LDS_U32; s = s + WG_THREADS) {
55
+ let si = i32(s);
56
+ let ry = si / ROW_U32;
57
+ let jx = si % ROW_U32;
58
+ let gy = region_origin.y + ry;
59
+ let gx = region_origin.x + 2 * jx;
60
+ let c0 = dof_load_coc(vec2<i32>(gx, gy), dims);
61
+ let c1 = dof_load_coc(vec2<i32>(gx + 1, gy), dims);
62
+ lds_coc[s] = pack2x16float(vec2<f32>(c0, c1));
63
+ }
64
+ }
65
+ // Unconditional barrier (uniform control flow): every thread reaches it, so
66
+ // the cache is fully published before any thread reads it.
67
+ workgroupBarrier();
68
+ }
69
+
70
+ // CoC at a clamped pixel coordinate: the workgroup cache when inside the apron,
71
+ // a texture load for the rare far tap (|offset| in (APRON, MAXR]).
72
+ fn dof_read_coc(xt: vec2<i32>, region_origin: vec2<i32>) -> f32 {
73
+ let rc = xt - region_origin;
74
+ if (rc.x >= 0 && rc.x < REGION && rc.y >= 0 && rc.y < REGION) {
75
+ let pair = unpack2x16float(lds_coc[rc.y * ROW_U32 + (rc.x >> 1)]);
76
+ return select(pair.x, pair.y, (rc.x & 1) != 0);
77
+ }
78
+ return textureLoad(tColorCoc, xt, 0).a;
79
+ }
80
+ `
81
+ );
@@ -1 +1 @@
1
- {"version":3,"file":"shader_dof_raymarch_compute.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js"],"names":[],"mappings":"AA0OA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,0CAFU,aAAa,CAMpB;8BAxQ2B,kCAAkC"}
1
+ {"version":3,"file":"shader_dof_raymarch_compute.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js"],"names":[],"mappings":"AA+LA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,0CAFU,aAAa,CAMpB;8BA7N2B,kCAAkC"}
@@ -6,7 +6,8 @@ import { ComputeShader } from "../../../shader/ComputeShader.js";
6
6
  import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
7
7
  import { chunk_dof_aperture_shape } from "../chunk_dof_aperture_shape.js";
8
8
  import { chunk_dof_sample_offset } from "../chunk_dof_sample_offset.js";
9
- import { DOF_FOCUS_CUTOFF, DOF_LDS_APRON, DOF_LDS_WORKGROUP, DOF_MAX_COC_RADIUS, DOF_TILE_SIZE } from "../DOF_CONFIG.js";
9
+ import { DOF_FOCUS_CUTOFF, DOF_LDS_WORKGROUP, DOF_MAX_COC_RADIUS, DOF_TILE_SIZE } from "../DOF_CONFIG.js";
10
+ import { chunk_dof_lds_coc_cache } from "./chunk_dof_lds_coc_cache.js";
10
11
  import { DOF_SETTINGS_STRUCT } from "./DOF_SETTINGS_STRUCT.js";
11
12
 
12
13
  const resources = new ShaderResourceSetDescriptor();
@@ -26,13 +27,7 @@ resources.createGroup()
26
27
  .addStorageTexture("tOut", "rgba16float", "2d", "write-only")
27
28
  ;
28
29
 
29
- // ── Workgroup-LDS cache geometry (derived; see DOF_LDS_* in DOF_CONFIG) ──
30
30
  const WG = DOF_LDS_WORKGROUP; // 8 — workgroup side
31
- const APRON = DOF_LDS_APRON; // 40 — cached skirt, full-res px
32
- const REGION = WG + 2 * APRON; // 88 — cached square side (even)
33
- const ROW_U32 = REGION / 2; // 44 — u32 per cached row (2 f16/u32)
34
- const LDS_U32 = REGION * ROW_U32; // 3872 — total u32 (× 4 B = 15 488 B)
35
- const WG_THREADS = WG * WG; // 64 — threads per workgroup
36
31
 
37
32
  const body = CodeChunk.from(
38
33
  //language=WGSL
@@ -42,24 +37,6 @@ const CUTOFF: f32 = ${DOF_FOCUS_CUTOFF};
42
37
  const TILE_SIZE: i32 = ${DOF_TILE_SIZE};
43
38
  const MAX_STEPS: u32 = 64u; // bitmask width (vec2<u32>); >= max STEPS (ultra = 48)
44
39
 
45
- const WG: i32 = ${WG};
46
- const APRON: i32 = ${APRON};
47
- const REGION: i32 = ${REGION};
48
- const ROW_U32: i32 = ${ROW_U32};
49
- const LDS_U32: u32 = ${LDS_U32}u;
50
- const WG_THREADS: u32 = ${WG_THREADS}u;
51
-
52
- // Workgroup CoC cache: the REGION×REGION (tile + apron) signed-CoC field, two
53
- // f16 packed per u32. The CoC texture is rgba16float, so packing its already-
54
- // f16 .a channel round-trips losslessly — the cached march stays bit-identical
55
- // to the texture march (and to the fragment reference).
56
- var<workgroup> lds_coc: array<u32, LDS_U32>;
57
-
58
- // Clamped CoC fetch used by the cooperative load.
59
- fn dof_load_coc(p: vec2<i32>, dims: vec2<i32>) -> f32 {
60
- return textureLoad(tColorCoc, clamp(p, vec2<i32>(0), dims - vec2<i32>(1)), 0).a;
61
- }
62
-
63
40
  @compute @workgroup_size(${WG}, ${WG}, 1)
64
41
  fn main(
65
42
  @builtin(global_invocation_id) gid: vec3<u32>,
@@ -84,21 +61,7 @@ fn main(
84
61
  // race. Skipped entirely for an in-focus tile (the load is the bulk of the
85
62
  // cost the cache is meant to remove).
86
63
  let region_origin = tile_origin - vec2<i32>(APRON);
87
- if (tile_blurred) {
88
- for (var s: u32 = lid; s < LDS_U32; s = s + WG_THREADS) {
89
- let si = i32(s);
90
- let ry = si / ROW_U32;
91
- let jx = si % ROW_U32;
92
- let gy = region_origin.y + ry;
93
- let gx = region_origin.x + 2 * jx;
94
- let c0 = dof_load_coc(vec2<i32>(gx, gy), dims);
95
- let c1 = dof_load_coc(vec2<i32>(gx + 1, gy), dims);
96
- lds_coc[s] = pack2x16float(vec2<f32>(c0, c1));
97
- }
98
- }
99
- // Unconditional barrier (uniform control flow): every thread reaches it, so
100
- // the cache is fully published before any thread reads it.
101
- workgroupBarrier();
64
+ dof_populate_lds_coc(tile_blurred, region_origin, lid, dims);
102
65
 
103
66
  let pixel = vec2<i32>(gid.xy);
104
67
  if (pixel.x >= dims.x || pixel.y >= dims.y) {
@@ -163,14 +126,7 @@ fn main(
163
126
  let x = coord + dir * r;
164
127
  let xt = vec2<i32>(clamp(x, vec2<f32>(0.0), dims_f - 1.0));
165
128
 
166
- let rc = xt - region_origin; // cache coord
167
- var s_coc: f32;
168
- if (rc.x >= 0 && rc.x < REGION && rc.y >= 0 && rc.y < REGION) {
169
- let pair = unpack2x16float(lds_coc[rc.y * ROW_U32 + (rc.x >> 1)]);
170
- s_coc = select(pair.x, pair.y, (rc.x & 1) != 0);
171
- } else {
172
- s_coc = textureLoad(tColorCoc, xt, 0).a;
173
- }
129
+ let s_coc = dof_read_coc(xt, region_origin);
174
130
  let reach = abs(s_coc);
175
131
 
176
132
  let cover = saturate(rho * reach - r + 1.0);
@@ -224,6 +180,7 @@ fn main(
224
180
  }
225
181
  `,
226
182
  [
183
+ chunk_dof_lds_coc_cache,
227
184
  chunk_dof_sample_offset,
228
185
  chunk_dof_aperture_shape,
229
186
  chunk_stbn_sample_vec2,
@@ -1 +1 @@
1
- {"version":3,"file":"shader_dof_slice_compute.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js"],"names":[],"mappings":"AAuPA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uCAFU,aAAa,CAMpB;8BA5Q2B,kCAAkC"}
1
+ {"version":3,"file":"shader_dof_slice_compute.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js"],"names":[],"mappings":"AA+MA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uCAFU,aAAa,CAMpB;8BApO2B,kCAAkC"}
@@ -7,13 +7,13 @@ import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderReso
7
7
  import { chunk_dof_aperture_shape } from "../chunk_dof_aperture_shape.js";
8
8
  import {
9
9
  DOF_FOCUS_CUTOFF,
10
- DOF_LDS_APRON,
11
10
  DOF_LDS_WORKGROUP,
12
11
  DOF_MAX_COC_RADIUS,
13
12
  DOF_SLICE_DIRECTIONS,
14
13
  DOF_SLICE_SLOPES,
15
14
  DOF_TILE_SIZE,
16
15
  } from "../DOF_CONFIG.js";
16
+ import { chunk_dof_lds_coc_cache } from "./chunk_dof_lds_coc_cache.js";
17
17
  import { DOF_SETTINGS_STRUCT } from "./DOF_SETTINGS_STRUCT.js";
18
18
 
19
19
  const resources = new ShaderResourceSetDescriptor();
@@ -33,13 +33,7 @@ resources.createGroup()
33
33
  .addStorageTexture("tOut", "rgba16float", "2d", "write-only")
34
34
  ;
35
35
 
36
- // ── Workgroup-LDS cache geometry (shared with the 2D compute march) ──
37
36
  const WG = DOF_LDS_WORKGROUP; // 8 — workgroup side
38
- const APRON = DOF_LDS_APRON; // 40 — cached skirt, full-res px
39
- const REGION = WG + 2 * APRON; // 88 — cached square side (even)
40
- const ROW_U32 = REGION / 2; // 44 — u32 per cached row (2 f16/u32)
41
- const LDS_U32 = REGION * ROW_U32; // 3872 — total u32 (× 4 B = 15 488 B)
42
- const WG_THREADS = WG * WG; // 64 — threads per workgroup
43
37
 
44
38
  const D = DOF_SLICE_DIRECTIONS; // aperture directions over [0, π)
45
39
  const M = DOF_SLICE_SLOPES; // aperture radii ("slopes") per direction
@@ -52,37 +46,14 @@ const CUTOFF: f32 = ${DOF_FOCUS_CUTOFF};
52
46
  const TILE_SIZE: i32 = ${DOF_TILE_SIZE};
53
47
  const MAX_STEPS: u32 = 64u; // per-(slope) bitmask width (vec2<u32>); >= max N
54
48
 
55
- const WG: i32 = ${WG};
56
- const APRON: i32 = ${APRON};
57
- const REGION: i32 = ${REGION};
58
- const ROW_U32: i32 = ${ROW_U32};
59
- const LDS_U32: u32 = ${LDS_U32}u;
60
- const WG_THREADS: u32 = ${WG_THREADS}u;
61
-
62
49
  const D: u32 = ${D}u; // directions over [0, π)
63
50
  const M: u32 = ${M}u; // slopes per direction
64
51
 
65
- // Workgroup CoC cache: the REGION×REGION (tile + apron) signed-CoC field, two
66
- // f16 packed per u32 (the rgba16float source round-trips losslessly). Same as
67
- // the 2D compute march; the slice march reads it once per step and tests every
68
- // slope against that one read.
69
- var<workgroup> lds_coc: array<u32, LDS_U32>;
70
-
71
- // Clamped CoC fetch used by the cooperative load.
72
- fn dof_load_coc(p: vec2<i32>, dims: vec2<i32>) -> f32 {
73
- return textureLoad(tColorCoc, clamp(p, vec2<i32>(0), dims - vec2<i32>(1)), 0).a;
74
- }
75
-
76
52
  // CoC at a march position: the workgroup cache when inside the apron, a texture
77
53
  // load for the rare far tap (|offset| in (APRON, MAXR]).
78
54
  fn slice_read_coc(pos: vec2<f32>, region_origin: vec2<i32>, dims: vec2<i32>, dims_f: vec2<f32>) -> f32 {
79
55
  let xt = vec2<i32>(clamp(pos, vec2<f32>(0.0), dims_f - 1.0));
80
- let rc = xt - region_origin;
81
- if (rc.x >= 0 && rc.x < REGION && rc.y >= 0 && rc.y < REGION) {
82
- let pair = unpack2x16float(lds_coc[rc.y * ROW_U32 + (rc.x >> 1)]);
83
- return select(pair.x, pair.y, (rc.x & 1) != 0);
84
- }
85
- return textureLoad(tColorCoc, xt, 0).a;
56
+ return dof_read_coc(xt, region_origin);
86
57
  }
87
58
 
88
59
  @compute @workgroup_size(${WG}, ${WG}, 1)
@@ -101,19 +72,7 @@ fn main(
101
72
 
102
73
  // Cooperative load (skipped for an in-focus tile); unconditional barrier.
103
74
  let region_origin = tile_origin - vec2<i32>(APRON);
104
- if (tile_blurred) {
105
- for (var s: u32 = lid; s < LDS_U32; s = s + WG_THREADS) {
106
- let si = i32(s);
107
- let ry = si / ROW_U32;
108
- let jx = si % ROW_U32;
109
- let gy = region_origin.y + ry;
110
- let gx = region_origin.x + 2 * jx;
111
- let c0 = dof_load_coc(vec2<i32>(gx, gy), dims);
112
- let c1 = dof_load_coc(vec2<i32>(gx + 1, gy), dims);
113
- lds_coc[s] = pack2x16float(vec2<f32>(c0, c1));
114
- }
115
- }
116
- workgroupBarrier();
75
+ dof_populate_lds_coc(tile_blurred, region_origin, lid, dims);
117
76
 
118
77
  let pixel = vec2<i32>(gid.xy);
119
78
  if (pixel.x >= dims.x || pixel.y >= dims.y) {
@@ -238,6 +197,7 @@ fn main(
238
197
  }
239
198
  `,
240
199
  [
200
+ chunk_dof_lds_coc_cache,
241
201
  chunk_dof_aperture_shape,
242
202
  chunk_stbn_sample_vec2,
243
203
  chunk_rgb_to_luminance,
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_integrate_lighting_sample.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js"],"names":[],"mappings":"AAIA,gEA6CC;0BAhDyB,oCAAoC"}
1
+ {"version":3,"file":"chunk_integrate_lighting_sample.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js"],"names":[],"mappings":"AAIA,gEAgDC;0BAnDyB,oCAAoC"}
@@ -34,7 +34,10 @@ fn horizon_integrate_lighting_sample(
34
34
  }
35
35
 
36
36
  // see "Horizon-Based Indirect Lighting (HBIL)" equation 18
37
- let occlusion = integrate_solid_angle(_integrant, h0, h1);
37
+ // integrate_solid_angle integrates from its first angle to its second. The band this sample blocks runs from
38
+ // the new horizon, nearer the view ray, out to the previous one, so in that order it comes out positive; the
39
+ // other way round both terms flip, and a caller's choice of integrant can only undo that for the tangent's.
40
+ let occlusion = integrate_solid_angle(_integrant, h1, h0);
38
41
 
39
42
  let sample_color = textureLoad(tColor, tex_coord_i, 0).rgb ;
40
43
 
@@ -1 +1 @@
1
- {"version":3,"file":"fragment_shader_gtao_with_irradiance.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js"],"names":[],"mappings":"AA0YA,+DAkCG;4BA5ZyB,6BAA6B"}
1
+ {"version":3,"file":"fragment_shader_gtao_with_irradiance.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js"],"names":[],"mappings":"AA2YA,+DAkCG;4BA7ZyB,6BAA6B"}
@@ -210,7 +210,8 @@ fn main(
210
210
  // centre that is the view-space N.xy along the slice and N.z this read before the slices followed the ray.
211
211
  let slice_tangent_ws = normalize(orthoWorldDir);
212
212
  let light_integrant_front = 0.5 * vec2(dot(view_normal_ws, slice_tangent_ws), dot(view_normal_ws, view_direction_ws));
213
- // The back-side integrant has a flipped X component because the slice direction is flipped.
213
+ // Sample 0 lies along the tangent and sample 1 against it, so the back side, sample 1's, has the tangent's
214
+ // term flipped.
214
215
  let light_integrant_back = vec2(-light_integrant_front.x, light_integrant_front.y);
215
216
 
216
217
  var sliceLighting: vec3<f32>;
@@ -281,7 +282,7 @@ fn main(
281
282
  sampleHorizonVec0, // ref_direction
282
283
  horizonCos0, // h0 (previous horizon)
283
284
  shc0, // h1 (new horizon)
284
- light_integrant_back
285
+ light_integrant_front
285
286
  );
286
287
 
287
288
  sliceLighting += s0;
@@ -295,7 +296,7 @@ fn main(
295
296
  sampleHorizonVec1, // ref_direction
296
297
  horizonCos1, // h0 (previous horizon)
297
298
  shc1, // h1 (new horizon)
298
- light_integrant_front
299
+ light_integrant_back
299
300
  );
300
301
 
301
302
  sliceLighting += s1;
@@ -327,10 +328,10 @@ fn main(
327
328
  let localVisibility = visibilityProjLength * ( iarc0 + iarc1 );
328
329
 
329
330
  visibility += localVisibility;
330
-
331
- // unfudged, like the bent normal below: the fudge corrects the visibility integral only
332
- sliceLighting *= projectedNormalVecLength;
333
-
331
+
332
+ // Not weighted by projectedNormalVecLength, as the visibility and the bent normal are: those integrate
333
+ // against the projected normal made unit, and put its length back. The lighting's integrant dots the
334
+ // whole normal with directions in the slice, which already is the projected normal, length and all.
334
335
  lighting += sliceLighting;
335
336
 
336
337
  // see "Algorithm 2 Extension that computes bent normals b."
@@ -51,7 +51,7 @@ export class NSS {
51
51
  * @returns {number}
52
52
  */
53
53
  static recommended_jitter_sequence_size(upscale_ratio: number): number;
54
- static "__#210@#preprocess_tensor_descriptor"(render_w: any, render_h: any): TextureResourceDescriptor;
54
+ static "__#212@#preprocess_tensor_descriptor"(render_w: any, render_h: any): TextureResourceDescriptor;
55
55
  /**
56
56
  * @param {GraphicsContext} graphics
57
57
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_nss_luma_derivative.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.js"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,kDAoBE;0BAhCwB,oCAAoC"}
1
+ {"version":3,"file":"chunk_nss_luma_derivative.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.js"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,kDAkBE;0BA/BwB,oCAAoC"}
@@ -1,6 +1,6 @@
1
- import { chunk_rgb_to_luminance } from "../../shader/chunk/color/chunk_rgb_to_luminance.js";
2
- import { F16_MAX_DEFINITION } from "../../shader/chunk/math/F16_MAX_DEFINITION.js";
1
+ import { chunk_rgb_to_luminance } from "../../shader/chunk/color/chunk_rgb_to_luminance.js";
3
2
  import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
+ import { chunk_nss_tonemap } from "./chunk_nss_tonemap.js";
4
4
 
5
5
  /**
6
6
  * Computes a per-pixel "luminance derivative" — the delta between the
@@ -16,10 +16,8 @@ export const chunk_nss_luma_derivative = CodeChunk.from(
16
16
  //language=WGSL
17
17
  `
18
18
  fn nss_luma_derivative(current_rgb: vec3<f32>, history_rgb: vec3<f32>) -> f32 {
19
- let current_finite = select(vec3<f32>(0.0), clamp(current_rgb, vec3<f32>(0.0), vec3<f32>(F16_MAX)), current_rgb == current_rgb);
20
- let lc = rgb_to_luminance(current_finite);
21
- let history_finite = select(vec3<f32>(0.0), clamp(history_rgb, vec3<f32>(0.0), vec3<f32>(F16_MAX)), history_rgb == history_rgb);
22
- let lh = rgb_to_luminance(history_finite);
19
+ let lc = rgb_to_luminance(nss_sanitize_hdr(current_rgb));
20
+ let lh = rgb_to_luminance(nss_sanitize_hdr(history_rgb));
23
21
 
24
22
  // tonemap the luma to compress HDR before differencing — same trick TAA
25
23
  // uses to keep specular highlights from saturating the variance metric.
@@ -29,7 +27,7 @@ fn nss_luma_derivative(current_rgb: vec3<f32>, history_rgb: vec3<f32>) -> f32 {
29
27
  return saturate(abs(lc_t - lh_t) * 4.0);
30
28
  }
31
29
  `, [
32
- F16_MAX_DEFINITION,
30
+ chunk_nss_tonemap,
33
31
  chunk_rgb_to_luminance,
34
32
  ]
35
33
  );
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Shared HDR sanitization and max-channel Karis tonemapping (`c / (1 + max(r, g, b))`) and its
3
+ * inverse for Neural Super Sampling (NSS).
4
+ *
5
+ * ```wgsl
6
+ * const NSS_EXPOSURE: f32 = 7.38905609893;
7
+ * fn nss_sanitize_hdr(rgb: vec3<f32>) -> vec3<f32>
8
+ * fn nss_tonemap(rgb: vec3<f32>) -> vec3<f32>
9
+ * fn nss_tonemap_exposure(rgb: vec3<f32>) -> vec3<f32>
10
+ * fn nss_tonemap_inv(rgb: vec3<f32>) -> vec3<f32>
11
+ * ```
12
+ *
13
+ * @type {CodeChunk}
14
+ */
15
+ export const chunk_nss_tonemap: CodeChunk;
16
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
17
+ //# sourceMappingURL=chunk_nss_tonemap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_nss_tonemap.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/nss/chunk_nss_tonemap.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,gCAFU,SAAS,CAwCjB;0BAtDwB,oCAAoC"}
@@ -0,0 +1,56 @@
1
+ import { F16_MAX_DEFINITION } from "../../shader/chunk/math/F16_MAX_DEFINITION.js";
2
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
+
4
+ /**
5
+ * Shared HDR sanitization and max-channel Karis tonemapping (`c / (1 + max(r, g, b))`) and its
6
+ * inverse for Neural Super Sampling (NSS).
7
+ *
8
+ * ```wgsl
9
+ * const NSS_EXPOSURE: f32 = 7.38905609893;
10
+ * fn nss_sanitize_hdr(rgb: vec3<f32>) -> vec3<f32>
11
+ * fn nss_tonemap(rgb: vec3<f32>) -> vec3<f32>
12
+ * fn nss_tonemap_exposure(rgb: vec3<f32>) -> vec3<f32>
13
+ * fn nss_tonemap_inv(rgb: vec3<f32>) -> vec3<f32>
14
+ * ```
15
+ *
16
+ * @type {CodeChunk}
17
+ */
18
+ export const chunk_nss_tonemap = CodeChunk.from(
19
+ //language=WGSL
20
+ `
21
+ const NSS_EXPOSURE: f32 = 7.38905609893; // e^2
22
+
23
+ fn nss_sanitize_hdr(rgb: vec3<f32>) -> vec3<f32> {
24
+ return select(vec3<f32>(0.0), clamp(rgb, vec3<f32>(0.0), vec3<f32>(F16_MAX)), rgb == rgb);
25
+ }
26
+
27
+ // Karis tonemap (max-of-channels).
28
+ // The guard is a FINITE clamp, not just a non-negative one: this target is rgba16float, so shading
29
+ // above its range stores as +Inf and rgb / (1.0 + m) is Inf/Inf = NaN, which goes straight into the
30
+ // next frame's history and stays there. NaN fails every comparison including with itself, which is
31
+ // what the componentwise test in nss_sanitize_hdr is.
32
+ fn nss_tonemap(rgb: vec3<f32>) -> vec3<f32> {
33
+ let finite = nss_sanitize_hdr(rgb);
34
+ let m = max(max(finite.r, finite.g), finite.b);
35
+ return finite / (1.0 + m);
36
+ }
37
+
38
+ // Karis tonemap (max-of-channels), applied to EXPOSURE-scaled colour.
39
+ // ARM's training distribution: Tonemap(EXPOSURE * raw) -> network input.
40
+ fn nss_tonemap_exposure(rgb: vec3<f32>) -> vec3<f32> {
41
+ let scaled = nss_sanitize_hdr(rgb) * NSS_EXPOSURE;
42
+ let m = max(max(scaled.r, scaled.g), scaled.b);
43
+ return scaled / (1.0 + m);
44
+ }
45
+
46
+ // Karis inverse — clamp to dodge the inf at m == 1.0.
47
+ fn nss_tonemap_inv(rgb: vec3<f32>) -> vec3<f32> {
48
+ let c = clamp(rgb, vec3<f32>(0.0), vec3<f32>(0.99999));
49
+ let m = max(max(c.r, c.g), c.b);
50
+ return c / (1.0 - m);
51
+ }
52
+ `,
53
+ [
54
+ F16_MAX_DEFINITION,
55
+ ]
56
+ );
@@ -1 +1 @@
1
- {"version":3,"file":"shader_nss_postprocess.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/nss/shader_nss_postprocess.js"],"names":[],"mappings":"AAiSA,mDAIG;8BAnS2B,+BAA+B"}
1
+ {"version":3,"file":"shader_nss_postprocess.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/nss/shader_nss_postprocess.js"],"names":[],"mappings":"AA6QA,mDAIG;8BAhR2B,+BAA+B"}