@woosh/meep-engine 3.59.0 → 3.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/package.json +1 -1
  2. package/src/shade/playground/probe_clipmap/index.html +12 -0
  3. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  4. package/src/shade/playground/probe_clipmap/main.js +5 -0
  5. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  6. package/src/shade/renderer/Renderer.js +4 -6
  7. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +63 -1
  8. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  9. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +228 -16
  10. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +27 -4
  11. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
  12. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +526 -23
  13. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts +11 -0
  14. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts.map +1 -0
  15. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.js +21 -0
  16. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts +65 -0
  17. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts.map +1 -0
  18. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.js +376 -0
  19. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts +7 -3
  20. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts.map +1 -1
  21. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.js +70 -6
  22. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts +20 -0
  23. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts.map +1 -0
  24. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.js +80 -0
  25. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts +18 -0
  26. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts.map +1 -0
  27. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.js +113 -0
  28. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +47 -0
  29. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +1 -0
  30. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +80 -0
  31. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +91 -0
  32. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -0
  33. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +902 -0
  34. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +16 -0
  35. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +1 -0
  36. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +67 -0
  37. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +17 -0
  38. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +1 -0
  39. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +145 -0
  40. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +12 -0
  41. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +1 -0
  42. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +105 -0
  43. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.d.ts.map +1 -1
  44. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +2 -1
  45. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +3 -9
  46. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  47. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +13 -31
  48. package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_CLIPMAP_PROPOSAL_2026_10_27.md +764 -48
  49. package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_RAYS_VARIABLE_AND_SORTED_SCOPE_2026_10_30.md +410 -0
  50. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +3 -2
  51. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
  52. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +4 -3
  53. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +41 -17
  54. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  55. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +57 -33
  56. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts +11 -3
  57. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts.map +1 -1
  58. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.js +13 -4
  59. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +9 -18
  60. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  61. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +8 -10
  62. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts +12 -0
  63. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
  64. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +28 -0
  65. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +1 -29
  66. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  67. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +1 -74
  68. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +161 -0
  69. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -0
  70. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +219 -0
  71. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts +1 -8
  72. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts.map +1 -1
  73. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.js +1 -9
  74. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts +40 -12
  75. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts.map +1 -1
  76. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.js +373 -31
  77. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -1
  78. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts.map +1 -1
  79. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -1
  80. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts +15 -8
  81. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts.map +1 -1
  82. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.js +28 -14
  83. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +23 -0
  84. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -0
  85. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +66 -0
  86. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts +29 -0
  87. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts.map +1 -0
  88. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +210 -0
  89. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts +29 -0
  90. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts.map +1 -0
  91. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.js +86 -0
  92. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +41 -0
  93. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -0
  94. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +439 -0
  95. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts +23 -0
  96. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts.map +1 -0
  97. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +135 -0
  98. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts +3 -1
  99. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
  100. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +12 -3
  101. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +21 -18
  102. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  103. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +254 -73
  104. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +149 -8
  105. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  106. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +181 -13
  107. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +179 -7
  108. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  109. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +412 -31
  110. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +4 -4
  111. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  112. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +4 -3
  113. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +36 -10
  114. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
  115. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +218 -29
  116. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +5 -1
  117. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
  118. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +24 -14
  119. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +15 -6
  120. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  121. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +21 -22
  122. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts +36 -0
  123. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -0
  124. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +257 -0
  125. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +18 -7
  126. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +157 -51
  128. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts +23 -0
  129. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -0
  130. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +110 -0
  131. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +24 -2
  132. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
  133. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +90 -10
  134. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +45 -0
  135. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -0
  136. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +205 -0
  137. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +1 -1
  138. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts +16 -3
  139. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +55 -10
  141. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +19 -4
  142. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  143. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +60 -6
  144. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts +4 -8
  145. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
  146. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +21 -36
  147. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +21 -14
  148. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  149. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +100 -30
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +6 -2
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +26 -10
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +3 -2
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +12 -12
  156. package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts +10 -0
  157. package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts.map +1 -0
  158. package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.js +21 -0
  159. package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts +5 -2
  160. package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts.map +1 -1
  161. package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.js +31 -23
  162. package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts +10 -0
  163. package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts.map +1 -0
  164. package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.js +22 -0
  165. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts +9 -0
  166. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts.map +1 -0
  167. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.js +18 -0
  168. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts +8 -3
  169. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts.map +1 -1
  170. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.js +41 -32
  171. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts +31 -0
  172. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts.map +1 -0
  173. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.js +71 -0
  174. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts +47 -0
  175. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts.map +1 -0
  176. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.js +210 -0
  177. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +5 -4
  178. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts.map +1 -1
  179. package/src/shade/renderer/gpu_primitive/sort/defs.js +5 -4
  180. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +56 -15
  181. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  182. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +410 -61
  183. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts +4 -1
  184. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts.map +1 -1
  185. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.js +16 -42
  186. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts +15 -0
  187. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts.map +1 -0
  188. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.js +60 -0
  189. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts +25 -0
  190. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts.map +1 -0
  191. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.js +89 -0
  192. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts +3 -8
  193. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts.map +1 -1
  194. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js +28 -160
  195. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts +12 -0
  196. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts.map +1 -0
  197. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.js +74 -0
  198. package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts +3 -1
  199. package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts.map +1 -1
  200. package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.js +387 -188
  201. package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_irradiance_flat.js +1 -1
  202. package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_sh.js +1 -1
  203. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
  204. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +90 -72
  205. package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts +5 -0
  206. package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts.map +1 -1
  207. package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.js +9 -0
  208. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts +13 -0
  209. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts.map +1 -0
  210. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.js +14 -0
  211. package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts +10 -0
  212. package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts.map +1 -0
  213. package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.js +15 -0
  214. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts +4 -3
  215. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts.map +1 -1
  216. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.js +6 -5
  217. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts +17 -2
  218. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts.map +1 -1
  219. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.js +25 -57
  220. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts +13 -0
  221. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts.map +1 -0
  222. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.js +70 -0
  223. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts +10 -0
  224. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts.map +1 -0
  225. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.js +59 -0
  226. package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts +12 -0
  227. package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts.map +1 -0
  228. package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.js +49 -0
  229. package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.d.ts.map +1 -1
  230. package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.js +1 -0
  231. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.d.ts.map +1 -1
  232. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -0
  233. package/src/shade/renderer/path_tracer/shader/chunk_sample_material.d.ts.map +1 -1
  234. package/src/shade/renderer/path_tracer/shader/chunk_sample_material.js +2 -1
  235. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts +7 -0
  236. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
  237. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +15 -6
  238. package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -1
  239. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  240. package/src/shade/renderer/scene/GPUSceneContext.js +26 -1
  241. package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts +7 -7
  242. package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts.map +1 -1
  243. package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.js +262 -294
  244. package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts +9 -0
  245. package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts.map +1 -0
  246. package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.js +21 -0
  247. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +43 -0
  248. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -0
  249. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +87 -0
  250. package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts +7 -1
  251. package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts.map +1 -1
  252. package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.js +1 -1
  253. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts +21 -0
  254. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts.map +1 -0
  255. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.js +42 -0
  256. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  257. package/src/shade/wgsl/emulator/CPUBitmapData.d.ts +19 -0
  258. package/src/shade/wgsl/emulator/CPUBitmapData.d.ts.map +1 -1
  259. package/src/shade/wgsl/emulator/CPUBitmapData.js +27 -0
  260. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  261. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +39 -18
  262. package/src/view/elements/progress/segmented/GhostTrail.d.ts +56 -0
  263. package/src/view/elements/progress/segmented/GhostTrail.d.ts.map +1 -0
  264. package/src/view/elements/progress/segmented/GhostTrail.js +98 -0
  265. package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts +3 -1
  266. package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts.map +1 -1
  267. package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.js +3 -1
  268. package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts +11 -0
  269. package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts.map +1 -0
  270. package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.js +15 -0
  271. package/src/view/elements/progress/segmented/SegmentDefinition.d.ts +3 -0
  272. package/src/view/elements/progress/segmented/SegmentDefinition.d.ts.map +1 -1
  273. package/src/view/elements/progress/segmented/SegmentDefinition.js +3 -0
  274. package/src/view/elements/progress/segmented/SegmentTier.d.ts +38 -0
  275. package/src/view/elements/progress/segmented/SegmentTier.d.ts.map +1 -0
  276. package/src/view/elements/progress/segmented/SegmentTier.js +50 -0
  277. package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts +155 -10
  278. package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts.map +1 -1
  279. package/src/view/elements/progress/segmented/SegmentedResourceBarView.js +427 -101
  280. package/src/view/elements/progress/segmented/playground/index.html +78 -0
  281. package/src/view/elements/progress/segmented/playground/main.d.ts +2 -0
  282. package/src/view/elements/progress/segmented/playground/main.d.ts.map +1 -0
  283. package/src/view/elements/progress/segmented/playground/main.js +173 -0
  284. package/src/view/elements/progress/segmented/segment_cell_layout.d.ts +48 -0
  285. package/src/view/elements/progress/segmented/segment_cell_layout.d.ts.map +1 -0
  286. package/src/view/elements/progress/segmented/segment_cell_layout.js +75 -0
  287. package/src/view/elements/progress/segmented/segment_notch_place.d.ts +18 -0
  288. package/src/view/elements/progress/segmented/segment_notch_place.d.ts.map +1 -0
  289. package/src/view/elements/progress/segmented/segment_notch_place.js +28 -0
  290. package/src/view/elements/progress/segmented/segment_tick_positions.d.ts +32 -0
  291. package/src/view/elements/progress/segmented/segment_tick_positions.d.ts.map +1 -0
  292. package/src/view/elements/progress/segmented/segment_tick_positions.js +103 -0
  293. package/src/view/elements/progress/segmented/segmented-resource-bar.css +142 -0
  294. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts +0 -35
  295. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts.map +0 -1
  296. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.js +0 -238
  297. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts +0 -99
  298. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts.map +0 -1
  299. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.js +0 -139
  300. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts +0 -65
  301. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts.map +0 -1
  302. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.js +0 -393
  303. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts +0 -17
  304. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts.map +0 -1
  305. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.js +0 -36
  306. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts +0 -29
  307. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts.map +0 -1
  308. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.js +0 -108
  309. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts +0 -31
  310. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts.map +0 -1
  311. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.js +0 -113
  312. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts +0 -36
  313. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts.map +0 -1
  314. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.js +0 -85
  315. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts +0 -23
  316. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts.map +0 -1
  317. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.js +0 -273
  318. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts +0 -13
  319. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts.map +0 -1
  320. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.js +0 -151
  321. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts +0 -13
  322. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts.map +0 -1
  323. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.js +0 -133
  324. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts +0 -22
  325. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts.map +0 -1
  326. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.js +0 -135
@@ -1,32 +1,51 @@
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
3
  import { CLIPMAP_LEVEL_ARRAY } from "../../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
4
+ import { chunk_sphere_sample_volume } from "../../../shader/chunk/geometry/sphere/chunk_sphere_sample_volume.js";
4
5
  import { chunk_mod_v3i } from "../../../shader/chunk/geometry/vec3/chunk_mod_v3i.js";
6
+ import { chunk_rgb_to_luminance } from "../../../shader/chunk/color/chunk_rgb_to_luminance.js";
7
+ import { chunk_lower_bound_branchless } from "../../../shader/chunk/math/chunk_lower_bound_branchless.js";
5
8
  import { chunk_stbn_sample_vec2 } from "../../../shader/chunk/noise/chunk_stbn_sample_vec2.js";
9
+ import { chunk_r2_canonical } from "../../../shader/chunk/noise/r/chunk_r2_canonical.js";
6
10
  import { chunk_hash_lowbias32 } from "../../../shader/chunk/random/chunk_hash_lowbias32.js";
11
+ import { chunk_hash_to_float01 } from "../../../shader/chunk/random/chunk_hash_to_float01.js";
12
+ import { chunk_pcg3d } from "../../../shader/chunk/random/pcg/chunk_pcg3d.js";
7
13
  import { METRO_L1_IRRADIANCE_STRUCT } from "../../../shader/chunk/spherical_harmonics/l1i/chunk_convert_to_irradiance_sh.js";
8
14
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
9
15
  import { ShaderResourceDescriptor } from "../../../shader/resource/ShaderResourceDescriptor.js";
10
- import { atomic_u32, f32, u32, vec2u, vec3i, vec4f } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
16
+ import { atomic_u32, f32, u32, vec2u, vec3i, vec3u, vec4f, vec4u } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
11
17
  import { WebGPUArray } from "../../../shader/type/WebGPUArray.js";
12
18
  import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
13
19
  import { STBN_VEC2_RESOURCE } from "../../../STATIC_GRAPHICS_ENGINE_ASSET_RESOURCES.js";
14
20
  import {
15
21
  PROBE_BLEND_SKIRT,
16
22
  PROBE_CLIPMAP_NONE,
23
+ PROBE_AGE_BUCKETS,
24
+ PROBE_COUNTER_AGES,
25
+ PROBE_COUNTER_EVICTED,
17
26
  PROBE_COUNTER_FREE,
18
27
  PROBE_COUNTER_PERIOD,
19
28
  PROBE_COUNTER_STARVED,
29
+ PROBE_COUNTER_WAITING,
20
30
  PROBE_DISPATCH_ACTIVE,
21
31
  PROBE_DISPATCH_ADMIT,
32
+ PROBE_DISPATCH_ORDER,
22
33
  PROBE_DISPATCH_PUBLISH,
23
34
  PROBE_DISPATCH_RAYS,
24
35
  PROBE_DISPATCH_ROWS,
25
36
  PROBE_DISPATCH_TEXELS,
26
37
  PROBE_DISPATCH_TRACED,
38
+ PROBE_GUIDE_SCALE,
39
+ PROBE_ORDER_RUN,
27
40
  PROBE_RAY_BACK_FACE,
41
+ PROBE_RAY_CASCADE_MASK,
28
42
  PROBE_RAY_CASCADE_SHIFT,
29
43
  PROBE_RAY_KIND_MASK,
44
+ PROBE_RAY_NONE,
45
+ PROBE_RAY_ORIGIN_JITTER,
46
+ PROBE_RAY_PROBE_SHIFT,
47
+ PROBE_RECORD_CASCADE_SHIFT,
48
+ PROBE_RECORD_SCREEN,
30
49
  PROBE_RELOCATION_LIMIT,
31
50
  PROBE_STATE_ALIVE,
32
51
  PROBE_STATE_DEAD,
@@ -34,12 +53,13 @@ import {
34
53
  PROBE_STATE_KIND_MASK,
35
54
  PROBE_STATE_NEW,
36
55
  PROBE_STATE_UPDATES_SHIFT,
56
+ PROBE_TEXEL_RAYS,
37
57
  PROBE_THREAD_WORKGROUP_SIZE,
38
58
  PROBE_WANTED_SCREEN
39
59
  } from "./PROBE_CLIPMAP.js";
40
60
 
41
61
  /**
42
- * A probe's record (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.2), 64 bytes a slot: where it is, when it
62
+ * A probe's record (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.2), 48 bytes a slot: where it is, when it
43
63
  * was wanted and traced, its last update's back faces, whose want it was, and its irradiance. Where
44
64
  * relocation moved it is the state's second word, which readers weighing it load with the state.
45
65
  *
@@ -48,24 +68,25 @@ import {
48
68
  export const PROBE_RECORD_STRUCT = WebGPUStruct.from({
49
69
  /** the lattice point, in its cascade's spacing: the probe stands at `cell · spacing` before relocation */
50
70
  cell: vec3i,
51
- cascade: u32,
52
- /** when a pixel or a hit last wanted it: seconds since the clipmap was made */
53
- wanted_time: f32,
54
- /** when it was last updated, on the same clock */
55
- traced_time: f32,
56
- /** the share of its last update's resolved rays that hit back faces (§8.4) */
57
- back_face: f32,
58
71
  /**
59
- * 1 when a pixel wanted it in the last frame anything did, 0 when only hits did (§8.3): whether its
60
- * hits want in turn.
72
+ * The share of its last update's resolved rays that hit back faces (§8.4), unorm16 in the low half;
73
+ * whether a pixel wanted it, `PROBE_RECORD_SCREEN`; and its cascade, `probe_record_cascade`
74
+ * (`PROBE_CLIPMAP.js`).
61
75
  */
62
- screen: u32,
63
- /** the irradiance its rays saw, the Metro L1 encoding: luma as SH2, chroma constant */
64
- sh: METRO_L1_IRRADIANCE_STRUCT,
65
- }, "ProbeRecord");
76
+ flags: u32,
77
+ /** the frame a pixel or a hit last wanted it, of the frames the clipmap has recorded */
78
+ wanted_frame: u32,
79
+ /** the frame it was last updated */
80
+ traced_frame: u32,
81
+ /**
82
+ * The irradiance its rays saw, the Metro L1 encoding (luma as SH2, chroma constant) in half floats:
83
+ * Y's xy, Y's zw, CoCg. `probe_record_sh_decode`.
84
+ */
85
+ sh: vec3u,
86
+ }, "ProbeRecord").pack();
66
87
 
67
88
  /**
68
- * A ray of a probe's update (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.6), 28 bytes, as trace writes it for
89
+ * A ray of a probe's update (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.6), 24 bytes, as trace writes it for
69
90
  * the passes after it.
70
91
  *
71
92
  * @type {WebGPUStruct}
@@ -85,14 +106,13 @@ export const PROBE_RAY_STRUCT = WebGPUStruct.from({
85
106
  /** its kind, the back face, and the hit's cascade (`PROBE_CLIPMAP.js`) */
86
107
  flags: u32,
87
108
  /**
88
- * The light, three half floats, red and green here and blue in {@link light_b}'s low half. Trace
89
- * writes the direct irradiance at a front-face hit, E_dir (§8.7), zero for any other ray; shade
90
- * writes over it the radiance the ray brings back.
109
+ * The light, RGB9E5 (`rgbe9995_encode`): held to its largest value, 65,408, which the half-float
110
+ * atlases after it also hold. Trace writes the direct irradiance at a front-face hit, E_dir (§8.7),
111
+ * zero for any other ray; shade writes over it the radiance the ray brings back, and the light pass
112
+ * adds what the hit takes from beyond the trace.
91
113
  */
92
- light_rg: u32,
93
- /** the light's blue, a half float in the low half */
94
- light_b: u32,
95
- }, "ProbeRay");
114
+ light: u32,
115
+ }, "ProbeRay").pack();
96
116
 
97
117
  /**
98
118
  * The cascades' cage windows, a {@link CLIPMAP_LEVEL_ARRAY} as a uniform, finest first: a cell of
@@ -154,6 +174,29 @@ export const PROBE_COUNTERS_READ_RESOURCE = ShaderResourceDescriptor.storageBuff
154
174
  */
155
175
  export const PROBE_FREE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_free", WebGPUArray.u32, true);
156
176
 
177
+ /**
178
+ * What the next frame's retire evicts (§8.3), as the frame's schedule leaves it: the oldest `buckets` of the
179
+ * `PROBE_AGE_BUCKETS` age buckets whole, and `remaining` probes of the bucket below them. Zero, as a new
180
+ * buffer holds it, evicts nothing.
181
+ * @type {WebGPUStruct}
182
+ */
183
+ export const PROBE_EVICTION_STRUCT = WebGPUStruct.from({
184
+ buckets: u32,
185
+ remaining: u32,
186
+ }, "ProbeEviction").pack();
187
+
188
+ /**
189
+ * The eviction as retire reads it: plainly, every thread.
190
+ * @type {ShaderResourceDescriptor}
191
+ */
192
+ export const PROBE_EVICTION_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_eviction", PROBE_EVICTION_STRUCT);
193
+
194
+ /**
195
+ * The eviction as schedule writes it.
196
+ * @type {ShaderResourceDescriptor}
197
+ */
198
+ export const PROBE_EVICTION_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_eviction", PROBE_EVICTION_STRUCT, true);
199
+
157
200
  /**
158
201
  * The live probes' slots as retire reads them: the list the frame before wrote.
159
202
  * @type {ShaderResourceDescriptor}
@@ -178,12 +221,6 @@ export const PROBE_ACTIVE_WRITTEN_RESOURCE = ShaderResourceDescriptor.storageBuf
178
221
  */
179
222
  export const PROBE_WANTED_BITS_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_wanted_bits", WebGPUArray.from(atomic_u32), true);
180
223
 
181
- /**
182
- * The wanted bits, read plainly once want has set them.
183
- * @type {ShaderResourceDescriptor}
184
- */
185
- export const PROBE_WANTED_BITS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_wanted_bits", WebGPUArray.u32);
186
-
187
224
  /**
188
225
  * The probes the frame updates, as the due passes list them, at most U (§8.5).
189
226
  * @type {ShaderResourceDescriptor}
@@ -196,6 +233,13 @@ export const PROBE_TRACE_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer
196
233
  */
197
234
  export const PROBE_TRACE_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_trace", COLLECTION_U32_STRUCT_READ);
198
235
 
236
+ /**
237
+ * The probes the frame updates, as the order pass sorts them in place: the count read plainly, the
238
+ * entries written.
239
+ * @type {ShaderResourceDescriptor}
240
+ */
241
+ export const PROBE_TRACE_ORDER_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_trace", COLLECTION_U32_STRUCT_READ, true);
242
+
199
243
  /**
200
244
  * The keys wanted this frame, each once, as want lists them.
201
245
  * @type {ShaderResourceDescriptor}
@@ -239,6 +283,76 @@ export const PROBE_RAYS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer(
239
283
  */
240
284
  export const PROBE_RAYS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_rays", WebGPUArray.from(PROBE_RAY_STRUCT));
241
285
 
286
+ /**
287
+ * Each listed probe's rays this update that the budget does not scale, `{count, elements}` by its place in
288
+ * the trace list: a uniform update's R and a DEAD probe's fewest, zero for a guided update. The trace
289
+ * command writes the count, the ray counts pass the elements.
290
+ * @type {ShaderResourceDescriptor}
291
+ */
292
+ export const PROBE_RAY_COUNTS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_ray_counts", COLLECTION_U32_STRUCT_READ, true);
293
+
294
+ /**
295
+ * Each listed probe's rays this update that the budget scales, laid out as `probe_ray_counts`: a guided
296
+ * update's request, zero for any other.
297
+ * @type {ShaderResourceDescriptor}
298
+ */
299
+ export const PROBE_RAY_REQUESTS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_ray_requests", COLLECTION_U32_STRUCT_READ, true);
300
+
301
+ /**
302
+ * The inclusive sums of `probe_ray_counts`, as the scan leaves them.
303
+ * @type {ShaderResourceDescriptor}
304
+ */
305
+ export const PROBE_RAY_COUNT_SUMS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_ray_count_sums", COLLECTION_U32_STRUCT_READ);
306
+
307
+ /**
308
+ * The inclusive sums of `probe_ray_requests`, as the scan leaves them.
309
+ * @type {ShaderResourceDescriptor}
310
+ */
311
+ export const PROBE_RAY_REQUEST_SUMS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_ray_request_sums", COLLECTION_U32_STRUCT_READ);
312
+
313
+ /**
314
+ * The frame's rays laid out by listed probe (§8.6): inclusive sums of each listed probe's rays, so that the
315
+ * k-th listed probe's rays are the frame's `[sums[k − 1], sums[k])`, the first from 0, and the frame's
316
+ * count of rays is the last sum. The ray layout pass writes them, the trace command their count.
317
+ * @type {ShaderResourceDescriptor}
318
+ */
319
+ export const PROBE_RAY_SUMS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_ray_sums", COLLECTION_U32_STRUCT_READ, true);
320
+
321
+ /**
322
+ * The frame's rays laid out by listed probe, as the passes after the layout read them.
323
+ * @type {ShaderResourceDescriptor}
324
+ */
325
+ export const PROBE_RAY_SUMS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_ray_sums", COLLECTION_U32_STRUCT_READ);
326
+
327
+ /**
328
+ * A slot's ray request (§8.6), as projection writes it after each update: the rays its next guided update
329
+ * asks for, and what tells it the probe's light moved.
330
+ *
331
+ * @type {WebGPUStruct}
332
+ */
333
+ export const PROBE_REQUEST_STRUCT = WebGPUStruct.from({
334
+ /** the rays the probe's next guided update asks for */
335
+ rays: u32,
336
+ /** the running mean of the update's change score: its texels' falls from their means, each in its own deviation, summed over the root of their count */
337
+ change_mean: f32,
338
+ /** the running variance of the change score */
339
+ change_variance: f32,
340
+ /** the scores its running statistics hold, up to `PROBE_RADIANCE_SAMPLES_LIMIT` */
341
+ changes: u32,
342
+ }, "ProbeRequest").pack();
343
+
344
+ /**
345
+ * Each slot's {@link PROBE_REQUEST_STRUCT}, as projection writes it.
346
+ * @type {ShaderResourceDescriptor}
347
+ */
348
+ export const PROBE_REQUESTS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_requests", WebGPUArray.from(PROBE_REQUEST_STRUCT), true);
349
+
350
+ /**
351
+ * Each slot's ray request, as the ray counts pass reads it.
352
+ * @type {ShaderResourceDescriptor}
353
+ */
354
+ export const PROBE_REQUESTS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_requests", WebGPUArray.from(PROBE_REQUEST_STRUCT));
355
+
242
356
  /**
243
357
  * The listed probes' maps, as accumulation writes them for projection and publish, in list order,
244
358
  * `probe_clipmap_maps_words` a probe.
@@ -252,6 +366,15 @@ export const PROBE_MAPS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer(
252
366
  */
253
367
  export const PROBE_MAPS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_maps", WebGPUArray.u32);
254
368
 
369
+ /**
370
+ * Each slot's radiance estimators (§8.8), n_r² a slot by texel, as accumulation reads and writes them: the
371
+ * texel's multi-scale mean past its mean, which the radiance atlas holds. Four words of half floats: the short
372
+ * mean's r and g; its b and the deviation's r; the deviation's g and b; the blend reduction and the
373
+ * inconsistency.
374
+ * @type {ShaderResourceDescriptor}
375
+ */
376
+ export const PROBE_ESTIMATORS_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_estimators", WebGPUArray.from(vec4u), true);
377
+
255
378
  /**
256
379
  * A row of a listed probe's radiance map, projected: its irradiance SH, and its rays this update.
257
380
  * @type {WebGPUStruct}
@@ -262,7 +385,11 @@ export const PROBE_PROJECTION_ROW_STRUCT = WebGPUStruct.from({
262
385
  resolved: u32,
263
386
  /** of them, the back faces */
264
387
  back_faces: u32,
265
- }, "ProbeProjectionRow");
388
+ /** how far the update's samples fell from their texels' means, each in its own deviation, luminance, summed */
389
+ change: f32,
390
+ /** the texels that blended a sample */
391
+ blended: f32,
392
+ }, "ProbeProjectionRow").pack();
266
393
 
267
394
  /**
268
395
  * The listed probes' rows, n_r a probe, as the projection's rows write them.
@@ -315,11 +442,19 @@ export const PROBE_DEPTH_STORE_RESOURCE = ShaderResourceDescriptor.storageTextur
315
442
  * fn probe_state_kind(state: u32) -> u32 // of the state's first word
316
443
  * fn probe_state_updates(state: u32) -> u32
317
444
  * fn probe_state(kind: u32, updates: u32) -> u32
445
+ * fn probe_clipmap_age_bucket(age: u32) -> u32 // the bucket of frames unwanted that eviction orders by
446
+ * fn probe_record_flags(back_face: f32, screen: bool, cascade: u32) -> u32
447
+ * fn probe_record_cascade(flags: u32) -> u32
448
+ * fn probe_record_sh_encode(sh: MetroL1) -> vec3<u32> // held to the half float's largest, ±65,504
449
+ * fn probe_record_sh_decode(sh: vec3<u32>) -> MetroL1
318
450
  * fn probe_clipmap_offset_encode(offset: vec3<f32>, spacing: f32) -> u32 // the state's second word
319
451
  * fn probe_clipmap_offset_decode(word: u32, spacing: f32) -> vec3<f32>
320
452
  * fn probe_clipmap_maps_words(radiance_resolution: u32, depth_resolution: u32) -> u32 // a listed probe's, in probe_maps
321
453
  * ```
322
454
  *
455
+ * An age's bucket is its count of binary digits: 0 frames the first, 1 the second, 2 and 3 the third, and
456
+ * the last everything from 2^(`PROBE_AGE_BUCKETS` − 2) frames on.
457
+ *
323
458
  * The offset's fields are of `PROBE_RELOCATION_LIMIT` of the spacing, 511 steps each way: under a
324
459
  * thousandth of the spacing apart, and zero at the lattice point.
325
460
  *
@@ -338,6 +473,10 @@ const PROBE_STATE_DEAD = ${PROBE_STATE_DEAD}u;
338
473
  const PROBE_COUNTER_FREE = ${PROBE_COUNTER_FREE}u;
339
474
  const PROBE_COUNTER_STARVED = ${PROBE_COUNTER_STARVED}u;
340
475
  const PROBE_COUNTER_PERIOD = ${PROBE_COUNTER_PERIOD}u;
476
+ const PROBE_COUNTER_WAITING = ${PROBE_COUNTER_WAITING}u;
477
+ const PROBE_COUNTER_EVICTED = ${PROBE_COUNTER_EVICTED}u;
478
+ const PROBE_COUNTER_AGES = ${PROBE_COUNTER_AGES}u;
479
+ const PROBE_AGE_BUCKETS = ${PROBE_AGE_BUCKETS}u;
341
480
 
342
481
  const PROBE_DISPATCH_ACTIVE = ${PROBE_DISPATCH_ACTIVE}u;
343
482
  const PROBE_DISPATCH_ADMIT = ${PROBE_DISPATCH_ADMIT}u;
@@ -346,13 +485,21 @@ const PROBE_DISPATCH_RAYS = ${PROBE_DISPATCH_RAYS}u;
346
485
  const PROBE_DISPATCH_TEXELS = ${PROBE_DISPATCH_TEXELS}u;
347
486
  const PROBE_DISPATCH_ROWS = ${PROBE_DISPATCH_ROWS}u;
348
487
  const PROBE_DISPATCH_PUBLISH = ${PROBE_DISPATCH_PUBLISH}u;
488
+ const PROBE_DISPATCH_ORDER = ${PROBE_DISPATCH_ORDER}u;
489
+ const PROBE_ORDER_RUN = ${PROBE_ORDER_RUN}u;
349
490
 
350
491
  const PROBE_RAY_KIND_MASK = ${PROBE_RAY_KIND_MASK}u;
492
+ const PROBE_RAY_NONE = ${PROBE_RAY_NONE}u;
351
493
  const PROBE_RAY_BACK_FACE = ${PROBE_RAY_BACK_FACE}u;
352
494
  const PROBE_RAY_CASCADE_SHIFT = ${PROBE_RAY_CASCADE_SHIFT}u;
495
+ const PROBE_RAY_CASCADE_MASK = ${PROBE_RAY_CASCADE_MASK}u;
496
+ const PROBE_RAY_PROBE_SHIFT = ${PROBE_RAY_PROBE_SHIFT}u;
353
497
 
354
498
  const PROBE_WANTED_SCREEN = ${PROBE_WANTED_SCREEN}u;
355
499
 
500
+ const PROBE_RECORD_SCREEN = ${PROBE_RECORD_SCREEN}u;
501
+ const PROBE_RECORD_CASCADE_SHIFT = ${PROBE_RECORD_CASCADE_SHIFT}u;
502
+
356
503
  const PROBE_THREAD_WORKGROUP_SIZE = ${PROBE_THREAD_WORKGROUP_SIZE}u;
357
504
  const PROBE_BLEND_SKIRT = ${PROBE_BLEND_SKIRT}.0;
358
505
 
@@ -390,8 +537,36 @@ fn probe_state(kind: u32, updates: u32) -> u32 {
390
537
  return kind | (updates << ${PROBE_STATE_UPDATES_SHIFT}u);
391
538
  }
392
539
 
540
+ fn probe_clipmap_age_bucket(age: u32) -> u32 {
541
+ return min(32u - countLeadingZeros(age), PROBE_AGE_BUCKETS - 1u);
542
+ }
543
+
544
+ fn probe_record_flags(back_face: f32, screen: bool, cascade: u32) -> u32 {
545
+ return (pack2x16unorm(vec2<f32>(back_face, 0.0)) & 0xFFFFu) | select(0u, PROBE_RECORD_SCREEN, screen) | (cascade << PROBE_RECORD_CASCADE_SHIFT);
546
+ }
547
+
548
+ fn probe_record_cascade(flags: u32) -> u32 {
549
+ return flags >> PROBE_RECORD_CASCADE_SHIFT;
550
+ }
551
+
552
+ fn probe_record_sh_encode(sh: ${METRO_L1_IRRADIANCE_STRUCT.wgsl_ref}) -> vec3<u32> {
553
+ let y = clamp(sh.Y, vec4<f32>(-65504.0), vec4<f32>(65504.0));
554
+ let cocg = clamp(sh.CoCg, vec2<f32>(-65504.0), vec2<f32>(65504.0));
555
+
556
+ return vec3<u32>(pack2x16float(y.xy), pack2x16float(y.zw), pack2x16float(cocg));
557
+ }
558
+
559
+ fn probe_record_sh_decode(sh: vec3<u32>) -> ${METRO_L1_IRRADIANCE_STRUCT.wgsl_ref} {
560
+ var out: ${METRO_L1_IRRADIANCE_STRUCT.wgsl_ref};
561
+
562
+ out.Y = vec4<f32>(unpack2x16float(sh.x), unpack2x16float(sh.y));
563
+ out.CoCg = unpack2x16float(sh.z);
564
+
565
+ return out;
566
+ }
567
+
393
568
  fn probe_clipmap_maps_words(radiance_resolution: u32, depth_resolution: u32) -> u32 {
394
- return 3u * radiance_resolution * radiance_resolution + depth_resolution * depth_resolution;
569
+ return 4u * radiance_resolution * radiance_resolution + depth_resolution * depth_resolution;
395
570
  }
396
571
 
397
572
  fn probe_clipmap_offset_encode(offset: vec3<f32>, spacing: f32) -> u32 {
@@ -409,9 +584,53 @@ fn probe_clipmap_offset_decode(word: u32, spacing: f32) -> vec3<f32> {
409
584
  }
410
585
  `, [
411
586
  PROBE_RECORD_STRUCT.declaration_chunk,
587
+ METRO_L1_IRRADIANCE_STRUCT.declaration_chunk,
412
588
  chunk_mod_v3i,
413
589
  ]);
414
590
 
591
+ /**
592
+ * Where the frame's rays are, by listed probe (§8.6): the scan of each listed probe's count of rays this
593
+ * update, `probe_ray_sums`. A probe's rays follow one another, in the trace list's order.
594
+ *
595
+ * ```wgsl
596
+ * fn probe_clipmap_ray_probe(ray: u32) -> u32 // the listed probe the frame's ray is one of, by its place in the list; the list's count or more for none
597
+ * fn probe_clipmap_probe_rays(k: u32) -> vec2<u32> // the k-th listed probe's first ray, and how many it has
598
+ * ```
599
+ *
600
+ * @type {CodeChunk}
601
+ */
602
+ export const chunk_probe_clipmap_ray_layout = CodeChunk.from(
603
+ //language=WGSL
604
+ `
605
+ fn probe_clipmap_ray_probe(ray: u32) -> u32 {
606
+ let listed = probe_ray_sums.count;
607
+
608
+ if (listed == 0u) {
609
+ return 0u;
610
+ }
611
+
612
+ // the first whose rays end past this one
613
+ return lower_bound_branchless(&probe_ray_sums.elements, ray + 1u, listed);
614
+ }
615
+
616
+ fn probe_clipmap_probe_rays(k: u32) -> vec2<u32> {
617
+ let end = probe_ray_sums.elements[k];
618
+
619
+ var first = 0u;
620
+
621
+ // not a select, which reads both sides, k − 1 wrapping at the first
622
+ if (k > 0u) {
623
+ first = probe_ray_sums.elements[k - 1u];
624
+ }
625
+
626
+ return vec2<u32>(first, end - first);
627
+ }
628
+ `, [
629
+ chunk_lower_bound_branchless,
630
+ ]);
631
+
632
+ chunk_probe_clipmap_ray_layout.requireResource(PROBE_RAY_SUMS_READ_RESOURCE);
633
+
415
634
  /**
416
635
  * Which octahedral radiance texel a ray of an update is, and the way back (§8.6). An update casts R rays
417
636
  * over the n_r² texels:
@@ -491,3 +710,165 @@ fn probe_clipmap_ray_jitter(slot: u32, texel: u32, ray: u32, updates: u32, rays:
491
710
  ]);
492
711
 
493
712
  chunk_probe_clipmap_ray_jitter.requireResource(STBN_VEC2_RESOURCE);
713
+
714
+ /**
715
+ * Where a ray of an update starts (§8.6): a point of the ball of `PROBE_RAY_ORIGIN_JITTER` of the spacing
716
+ * around the probe, uniform in its volume, as Brick4's bake jitters its probes. The point is drawn from the
717
+ * probe's slot and the ray's direction as its record packs it, so every pass that puts a hit back together
718
+ * from `t` (shade, light, want hits) draws the same one. The trace's jitter moves the direction every
719
+ * update, and the point with it.
720
+ *
721
+ * ```wgsl
722
+ * fn probe_clipmap_ray_origin(probe: vec4<f32>, slot: u32, direction: u32) -> vec3<f32> // probe: its `probe_origins` entry; direction: as the ray's record packs it
723
+ * ```
724
+ *
725
+ * @type {CodeChunk}
726
+ */
727
+ export const chunk_probe_clipmap_ray_origin = CodeChunk.from(
728
+ //language=WGSL
729
+ `
730
+ fn probe_clipmap_ray_origin(probe: vec4<f32>, slot: u32, direction: u32) -> vec3<f32> {
731
+ let hash = pcg3d(vec3<u32>(slot, direction, 0xBB67AE85u));
732
+ let uvw = vec3<f32>(hash_to_float01(hash.x), hash_to_float01(hash.y), hash_to_float01(hash.z));
733
+
734
+ return probe.xyz + ${PROBE_RAY_ORIGIN_JITTER} * probe.w * sphere_sample_volume(uvw);
735
+ }
736
+ `, [
737
+ chunk_pcg3d,
738
+ chunk_hash_to_float01,
739
+ chunk_sphere_sample_volume,
740
+ ]);
741
+
742
+ /**
743
+ * The listed probes' guides, `probe_guide_words` a probe in list order, as the guide passes write them.
744
+ * @type {ShaderResourceDescriptor}
745
+ */
746
+ export const PROBE_GUIDE_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_guide", WebGPUArray.u32, true);
747
+
748
+ /**
749
+ * The listed probes' guides, as trace, accumulation and projection read them.
750
+ * @type {ShaderResourceDescriptor}
751
+ */
752
+ export const PROBE_GUIDE_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_guide", WebGPUArray.u32);
753
+
754
+ /**
755
+ * The guide's walk over a probe's octahedral texels, and the weights it walks (§8.6). A guided update
756
+ * gives each texel `R·(w + e)/W` rays: `w` is its weight, `e` the even share of the leftover, `W` the
757
+ * total. Its rays follow one another in the order of the walk. That order is the radiance map's rows,
758
+ * from the corner the update's count names (`updates mod 4` mirrors x, y, or both), and it is its own
759
+ * inverse.
760
+ *
761
+ * A probe's first n_r²/R updates are uniform, so that together they reach every texel (Enshrouded gives a new
762
+ * probe its most rays for the same reason): the guide would weigh a texel no ray has reached as dark.
763
+ *
764
+ * A DEAD probe's updates are all uniform. Readers weigh it at nothing, so its light is not worth guiding.
765
+ * Its updates exist to reclassify it, and only uniform rays do that (§8.4); guided ones would leave it
766
+ * dead for `PROBE_UNIFORM_PERIOD` of its already rare updates.
767
+ *
768
+ * - A texel's weight is its share of the probe's luminance in units of 1/`PROBE_GUIDE_SCALE`, held to
769
+ * `(PROBE_TEXEL_RAYS − 2 − R/n_r²)/R`. With the even share added, that leaves a texel under
770
+ * `PROBE_TEXEL_RAYS` rays. What the hold takes off, and what flooring the weights leaves over, is
771
+ * spread evenly over every texel. A dark probe's rays are therefore an even, stratified spread.
772
+ * - The walk position `p` starts at ray `⌈R·Σ_{q<p}(w_q + e)/W − φ⌉`, `φ` being the update's phase in
773
+ * [0, 1). That is systematic sampling: every texel takes ⌊its share⌋ or ⌈its share⌉ rays.
774
+ * - A guide's words (`probe_clipmap_guide_words`, by offset from the probe's): the first rays by walk
775
+ * position at 0; the weights by texel at n_r²; the row luminances at 2·n_r²; the row weights at
776
+ * 2·n_r² + n_r; the total at 2·n_r² + 2·n_r, and the even share after it.
777
+ *
778
+ * ```wgsl
779
+ * fn probe_clipmap_guided(state: u32, period: u32, rays: u32, texels: u32) -> bool // the state's first word: the update's rays follow the guide
780
+ * fn probe_clipmap_guide_words(n: u32) -> u32
781
+ * fn probe_clipmap_guide_texel(position: u32, updates: u32, n: u32) -> u32 // and the other way: the walk is its own inverse
782
+ * fn probe_clipmap_guide_luminance(radiance: vec3<f32>) -> f32
783
+ * fn probe_clipmap_guide_weight(luminance: f32, total: f32, rays: u32, texels: u32) -> u32
784
+ * fn probe_clipmap_guide_phase(slot: u32, updates: u32) -> f32
785
+ * fn probe_clipmap_guide_start(before: u32, total: u32, rays: u32, phase: f32) -> u32 // before: the weight walked before
786
+ * fn probe_clipmap_guide_rate(expected: f32, rays: u32, texels: u32, period: u32) -> f32 // the share of updates a texel takes rays in
787
+ * ```
788
+ *
789
+ * @type {CodeChunk}
790
+ */
791
+ export const chunk_probe_clipmap_guide = CodeChunk.from(
792
+ //language=WGSL
793
+ `
794
+ const PROBE_GUIDE_SCALE = ${PROBE_GUIDE_SCALE}u;
795
+ const PROBE_TEXEL_RAYS = ${PROBE_TEXEL_RAYS}u;
796
+
797
+ fn probe_clipmap_guided(state: u32, period: u32, rays: u32, texels: u32) -> bool {
798
+ let updates = probe_state_updates(state);
799
+
800
+ return probe_state_kind(state) != PROBE_STATE_DEAD && updates >= texels / rays && updates % period != 0u;
801
+ }
802
+
803
+ fn probe_clipmap_guide_words(n: u32) -> u32 {
804
+ return 2u * n * n + 2u * n + 2u;
805
+ }
806
+
807
+ fn probe_clipmap_guide_texel(position: u32, updates: u32, n: u32) -> u32 {
808
+ let corner = updates % 4u;
809
+ let column = position % n;
810
+ let row = position / n;
811
+ let x = select(column, n - 1u - column, (corner & 1u) != 0u);
812
+ let y = select(row, n - 1u - row, (corner & 2u) != 0u);
813
+
814
+ return y * n + x;
815
+ }
816
+
817
+ fn probe_clipmap_guide_luminance(radiance: vec3<f32>) -> f32 {
818
+ return max(rgb_to_luminance(radiance), 0.0);
819
+ }
820
+
821
+ fn probe_clipmap_guide_weight(luminance: f32, total: f32, rays: u32, texels: u32) -> u32 {
822
+ if (total <= 0.0) {
823
+ return 0u;
824
+ }
825
+
826
+ let hold = max(f32(PROBE_TEXEL_RAYS) - 2.0 - f32(rays) / f32(texels), 0.0) / f32(rays);
827
+
828
+ return u32(floor(min(luminance / total, hold) * f32(PROBE_GUIDE_SCALE)));
829
+ }
830
+
831
+ fn probe_clipmap_guide_phase(slot: u32, updates: u32) -> f32 {
832
+ return hash_to_float01(pcg3d(vec3<u32>(slot, updates, 0x6A09E667u)).x);
833
+ }
834
+
835
+ fn probe_clipmap_guide_start(before: u32, total: u32, rays: u32, phase: f32) -> u32 {
836
+ let at = ceil(f32(before) / f32(total) * f32(rays) - phase);
837
+
838
+ return u32(clamp(at, 0.0, f32(rays)));
839
+ }
840
+
841
+ fn probe_clipmap_guide_rate(expected: f32, rays: u32, texels: u32, period: u32) -> f32 {
842
+ let uniform = min(f32(rays) / f32(texels), 1.0);
843
+ let guided = min(expected, 1.0);
844
+
845
+ return (uniform + f32(period - 1u) * guided) / f32(period);
846
+ }
847
+ `, [
848
+ chunk_probe_clipmap,
849
+ chunk_rgb_to_luminance,
850
+ chunk_hash_to_float01,
851
+ chunk_pcg3d,
852
+ ]);
853
+
854
+ /**
855
+ * The jitter of a guided update's ray in its texel. The first ray takes the texel's STBN jitter
856
+ * (`probe_clipmap_ray_jitter` at round 0). The rest rotate it by the R2 sequence, so a texel's rays
857
+ * spread over it the way a lattice does.
858
+ *
859
+ * ```wgsl
860
+ * fn probe_clipmap_guided_ray_jitter(slot: u32, texel: u32, round: u32, updates: u32, rays: u32, n: u32) -> vec2<f32> // round: the ray's place among its texel's
861
+ * ```
862
+ *
863
+ * @type {CodeChunk}
864
+ */
865
+ export const chunk_probe_clipmap_guided_ray_jitter = CodeChunk.from(
866
+ //language=WGSL
867
+ `
868
+ fn probe_clipmap_guided_ray_jitter(slot: u32, texel: u32, round: u32, updates: u32, rays: u32, n: u32) -> vec2<f32> {
869
+ return fract(probe_clipmap_ray_jitter(slot, texel, 0u, updates, rays, n) + r2_canonical(round) - 0.5);
870
+ }
871
+ `, [
872
+ chunk_probe_clipmap_ray_jitter,
873
+ chunk_r2_canonical,
874
+ ]);
@@ -276,22 +276,22 @@ fn probe_clipmap_sh_of(pick: ProbeClipmapPick) -> ProbeClipmapSH {
276
276
 
277
277
  // each by name, the slots of a weight of zero not read
278
278
  if (pick.weights.x > 0.0) {
279
- let sh = probe_records[pick.slots.x].sh;
279
+ let sh = probe_record_sh_decode(probe_records[pick.slots.x].sh);
280
280
  out.sh.CoCg += pick.weights.x * sh.CoCg;
281
281
  out.sh.Y += pick.weights.x * sh.Y;
282
282
  }
283
283
  if (pick.weights.y > 0.0) {
284
- let sh = probe_records[pick.slots.y].sh;
284
+ let sh = probe_record_sh_decode(probe_records[pick.slots.y].sh);
285
285
  out.sh.CoCg += pick.weights.y * sh.CoCg;
286
286
  out.sh.Y += pick.weights.y * sh.Y;
287
287
  }
288
288
  if (pick.weights.z > 0.0) {
289
- let sh = probe_records[pick.slots.z].sh;
289
+ let sh = probe_record_sh_decode(probe_records[pick.slots.z].sh);
290
290
  out.sh.CoCg += pick.weights.z * sh.CoCg;
291
291
  out.sh.Y += pick.weights.z * sh.Y;
292
292
  }
293
293
  if (pick.weights.w > 0.0) {
294
- let sh = probe_records[pick.slots.w].sh;
294
+ let sh = probe_record_sh_decode(probe_records[pick.slots.w].sh);
295
295
  out.sh.CoCg += pick.weights.w * sh.CoCg;
296
296
  out.sh.Y += pick.weights.w * sh.Y;
297
297
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_probe_clipmap_sample_radiance.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,kDAFU,SAAS,CAoIZ;0BA3KmB,uCAAuC"}
1
+ {"version":3,"file":"chunk_probe_clipmap_sample_radiance.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,kDAFU,SAAS,CAqIZ;0BA5KmB,uCAAuC"}
@@ -76,11 +76,12 @@ fn probe_clipmap_radiance(slot: u32, direction: vec3<f32>) -> vec3<f32> {
76
76
  // a picked probe's share for the lobe, its radiance along it and its SH
77
77
  fn probe_clipmap_lobe(slot: u32, share: f32, position: vec3<f32>, normal: vec3<f32>, bias_direction: vec3<f32>, lobe: vec3<f32>) -> ProbeClipmapLobe {
78
78
  let record = probe_records[slot];
79
- let spacing = probe_levels[record.cascade].cell_size;
79
+ let cascade = probe_record_cascade(record.flags);
80
+ let spacing = probe_levels[cascade].cell_size;
80
81
  let probe = vec3<f32>(record.cell) * spacing + probe_clipmap_offset_decode(probe_states[slot].y, spacing);
81
82
 
82
83
  // the visibility it was picked at: Chebyshev's from its depth toward the biased point
83
- let biased = probe_clipmap_biased(record.cascade, position, bias_direction);
84
+ let biased = probe_clipmap_biased(cascade, position, bias_direction);
84
85
  let to_point = biased - probe;
85
86
  let distance = length(to_point);
86
87
  let visibility = probe_visibility_chebyshev(probe_clipmap_depth_moments(slot, to_point / max(distance, 1e-6)), distance / spacing);
@@ -89,7 +90,7 @@ fn probe_clipmap_lobe(slot: u32, share: f32, position: vec3<f32>, normal: vec3<f
89
90
 
90
91
  var out: ProbeClipmapLobe;
91
92
  out.weight = share * probe_visibility_weight(toward, lobe, visibility) / probe_visibility_weight(toward, normal, visibility);
92
- out.sh = record.sh;
93
+ out.sh = probe_record_sh_decode(record.sh);
93
94
 
94
95
  // the reflected ray met with a sphere about the probe, its radius the probe's mean depth along the lobe
95
96
  let radius = probe_clipmap_depth_moments(slot, lobe).x * spacing;