@woosh/meep-engine 3.67.0 → 3.68.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 (311) hide show
  1. package/package.json +1 -1
  2. package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
  3. package/src/engine/graphics3/GraphicsEngine.js +4 -9
  4. package/src/engine/graphics3/load_cube_environment.js +3 -3
  5. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  6. package/src/shade/playground/probe_clipmap/index.html +43 -0
  7. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  8. package/src/shade/playground/probe_clipmap/main.js +29 -0
  9. package/src/shade/renderer/Renderer.d.ts +7 -0
  10. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  11. package/src/shade/renderer/Renderer.js +213 -15
  12. package/src/shade/renderer/ShadeIndirectLightingMode.d.ts +1 -0
  13. package/src/shade/renderer/ShadeIndirectLightingMode.js +9 -0
  14. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +22 -0
  15. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +1 -0
  16. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js +160 -0
  17. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts +45 -0
  18. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts.map +1 -0
  19. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.js +57 -0
  20. package/src/shade/renderer/atmosphere/GPUSky.d.ts +23 -8
  21. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  22. package/src/shade/renderer/atmosphere/GPUSky.js +91 -34
  23. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts +17 -0
  24. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts.map +1 -1
  25. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.js +55 -25
  26. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts +164 -0
  27. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts.map +1 -0
  28. package/src/shade/renderer/atmosphere/SceneAtmosphere.js +308 -0
  29. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts +3 -12
  30. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts.map +1 -1
  31. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.js +52 -89
  32. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts +14 -0
  33. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts.map +1 -0
  34. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.js +103 -0
  35. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts +10 -4
  36. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts.map +1 -1
  37. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js +95 -57
  38. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts +10 -14
  39. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts.map +1 -1
  40. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js +97 -69
  41. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts +17 -0
  42. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts.map +1 -1
  43. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.js +117 -48
  44. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts +8 -0
  45. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts.map +1 -1
  46. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.js +65 -35
  47. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts +2 -1
  48. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts.map +1 -1
  49. package/src/shade/renderer/atmosphere/compute_mie_absorption.js +6 -6
  50. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts +41 -0
  51. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts.map +1 -0
  52. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.js +123 -0
  53. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
  54. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +21 -64
  55. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts +6 -2
  56. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
  57. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +55 -179
  58. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts +7 -0
  59. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts.map +1 -0
  60. package/src/shade/renderer/atmosphere/shader_sky_view_lut.js +111 -0
  61. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts +0 -1
  62. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts.map +1 -1
  63. package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +68 -79
  64. package/src/shade/renderer/deferred/shader_background.js +1 -1
  65. package/src/shade/renderer/deferred/shader_background_sky.d.ts +5 -0
  66. package/src/shade/renderer/deferred/shader_background_sky.d.ts.map +1 -0
  67. package/src/shade/renderer/deferred/shader_background_sky.js +130 -0
  68. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +2 -1
  69. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -1
  70. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +6 -2
  71. package/src/shade/renderer/extension/ViewTextures.d.ts +3 -2
  72. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  73. package/src/shade/renderer/extension/ViewTextures.js +3 -2
  74. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  75. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  76. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  77. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  78. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  79. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +1 -1
  80. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +20 -1
  81. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  82. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +29 -0
  83. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts +47 -0
  84. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts.map +1 -0
  85. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js +246 -0
  86. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +4 -15
  87. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  88. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +8 -148
  89. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +4 -9
  90. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  91. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +9 -58
  92. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +142 -0
  93. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -0
  94. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +938 -0
  95. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +192 -0
  96. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -0
  97. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +231 -0
  98. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +11 -0
  99. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts.map +1 -0
  100. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +25 -0
  101. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +110 -0
  102. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -0
  103. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +197 -0
  104. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +150 -0
  105. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -0
  106. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +408 -0
  107. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +23 -0
  108. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts.map +1 -0
  109. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +63 -0
  110. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts +24 -0
  111. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts.map +1 -0
  112. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.js +61 -0
  113. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +39 -0
  114. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -0
  115. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +126 -0
  116. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +21 -0
  117. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts.map +1 -0
  118. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +74 -0
  119. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts +20 -0
  120. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts.map +1 -0
  121. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.js +26 -0
  122. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts +24 -0
  123. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts.map +1 -0
  124. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.js +57 -0
  125. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +22 -0
  126. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts.map +1 -0
  127. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +53 -0
  128. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +62 -0
  129. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -0
  130. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +156 -0
  131. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts +18 -0
  132. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts.map +1 -0
  133. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.js +50 -0
  134. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +21 -0
  135. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -0
  136. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +54 -0
  137. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +67 -0
  138. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -0
  139. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +509 -0
  140. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts +20 -0
  141. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts.map +1 -0
  142. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.js +128 -0
  143. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +62 -0
  144. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -0
  145. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +478 -0
  146. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +69 -0
  147. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -0
  148. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +457 -0
  149. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +27 -0
  150. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -0
  151. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +219 -0
  152. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +22 -0
  153. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts.map +1 -0
  154. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +151 -0
  155. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +66 -0
  156. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts.map +1 -0
  157. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +301 -0
  158. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +59 -0
  159. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -0
  160. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +364 -0
  161. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +40 -0
  162. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -0
  163. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +275 -0
  164. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -1
  165. package/src/shade/renderer/grass/blade/GPUGrassBlades.js +17 -2
  166. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +18 -8
  167. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -1
  168. package/src/shade/renderer/grass/blade/grass_blade_resolve.js +114 -32
  169. package/src/shade/renderer/light/GPULightCollection.d.ts +1 -1
  170. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  171. package/src/shade/renderer/light/GPULightCollection.js +213 -80
  172. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.d.ts +1 -2
  173. package/src/shade/renderer/light/environment/chunk_sample_environment_color.d.ts.map +1 -0
  174. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.js +3 -4
  175. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  176. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -1
  177. package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js +1 -1
  178. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +1 -1
  179. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +1 -1
  180. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +1 -1
  181. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +1 -1
  182. package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.js +1 -1
  183. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  184. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +2 -0
  185. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +2 -0
  186. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +6 -0
  187. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
  188. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +9 -1
  189. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.d.ts.map +1 -1
  190. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.js +4 -3
  191. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts +17 -0
  192. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts.map +1 -0
  193. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.js +16 -0
  194. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts +21 -0
  195. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts.map +1 -0
  196. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.js +30 -0
  197. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -5
  198. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  199. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +19 -17
  200. package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.js +2 -0
  201. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  202. package/src/shade/renderer/scene/GPUSceneContext.js +2 -1
  203. package/src/shade/renderer/scene/Scene.d.ts +9 -2
  204. package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
  205. package/src/shade/renderer/scene/Scene.js +10 -2
  206. package/src/shade/renderer/shader/ImageShader.d.ts +24 -12
  207. package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
  208. package/src/shade/renderer/shader/ImageShader.js +11 -8
  209. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts +3 -1
  210. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts.map +1 -1
  211. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js +11 -3
  212. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts +2 -11
  213. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts.map +1 -1
  214. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js +23 -32
  215. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts +6 -0
  216. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts.map +1 -1
  217. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js +14 -2
  218. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.d.ts.map +1 -1
  219. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js +4 -2
  220. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.d.ts.map +1 -1
  221. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js +11 -3
  222. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts.map +1 -1
  223. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js +68 -69
  224. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts +4 -1
  225. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts.map +1 -1
  226. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js +46 -39
  227. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.d.ts.map +1 -1
  228. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js +5 -3
  229. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +18 -10
  230. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -1
  231. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +30 -27
  232. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts +14 -0
  233. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts.map +1 -0
  234. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.js +30 -0
  235. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts +21 -0
  236. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts.map +1 -0
  237. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js +60 -0
  238. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.d.ts → io/chunk_light_get_sun.d.ts} +3 -6
  239. package/src/shade/renderer/shader/chunk/light/io/chunk_light_get_sun.d.ts.map +1 -0
  240. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.js → io/chunk_light_get_sun.js} +6 -26
  241. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.js +1 -1
  242. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +3 -1
  243. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  244. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -2
  245. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  246. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +743 -739
  247. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +2 -0
  248. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  249. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +19 -17
  250. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
  251. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +5 -3
  252. package/src/shade/renderer/water/chunk_water_gi.js +2 -0
  253. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  254. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  255. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts +0 -2
  256. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +0 -1
  257. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +0 -45
  258. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts +0 -2
  259. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +0 -1
  260. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +0 -17
  261. package/src/engine/graphics/sh3/sky/hosek/README.md +0 -4
  262. package/src/engine/graphics/sh3/sky/hosek/data.d.ts +0 -17
  263. package/src/engine/graphics/sh3/sky/hosek/data.d.ts.map +0 -1
  264. package/src/engine/graphics/sh3/sky/hosek/data.js +0 -3744
  265. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts +0 -2
  266. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts.map +0 -1
  267. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +0 -71
  268. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts +0 -26
  269. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts.map +0 -1
  270. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.js +0 -70
  271. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +0 -22
  272. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +0 -1
  273. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +0 -388
  274. package/src/engine/graphics3/make_default_environment.d.ts +0 -15
  275. package/src/engine/graphics3/make_default_environment.d.ts.map +0 -1
  276. package/src/engine/graphics3/make_default_environment.js +0 -111
  277. package/src/shade/renderer/atmosphere/MIE_G.d.ts +0 -6
  278. package/src/shade/renderer/atmosphere/MIE_G.d.ts.map +0 -1
  279. package/src/shade/renderer/atmosphere/MIE_G.js +0 -5
  280. package/src/shade/renderer/atmosphere/chunk_sample_environment_color.d.ts.map +0 -1
  281. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts +0 -4
  282. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts.map +0 -1
  283. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.js +0 -44
  284. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +0 -2
  285. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +0 -1
  286. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.js +0 -43
  287. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts +0 -3
  288. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts.map +0 -1
  289. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.js +0 -6
  290. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts +0 -3
  291. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts.map +0 -1
  292. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.js +0 -18
  293. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts +0 -14
  294. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts.map +0 -1
  295. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.js +0 -86
  296. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts +0 -8
  297. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts.map +0 -1
  298. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.js +0 -125
  299. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts +0 -3
  300. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts.map +0 -1
  301. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.js +0 -17
  302. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts +0 -3
  303. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts.map +0 -1
  304. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.js +0 -38
  305. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts +0 -16
  306. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts.map +0 -1
  307. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.js +0 -28
  308. package/src/shade/renderer/shader/chunk/light/sky/chunk_sample_sky_color.d.ts.map +0 -1
  309. package/src/shade/renderer/view/GPUViewSkyContext.d.ts +0 -26
  310. package/src/shade/renderer/view/GPUViewSkyContext.d.ts.map +0 -1
  311. package/src/shade/renderer/view/GPUViewSkyContext.js +0 -170
@@ -1 +1 @@
1
- {"version":3,"file":"GPUProbeClipmapGI.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IAsUI;;;;OAIG;IACH,oDAJW,eAAe,YACf,oBAAoB,GAClB,OAAO,CAUnB;IA/OD;;OAEG;IACH,sBAFW,eAAe,EAMzB;IAED;;OAEG;IACH,qCAEC;IAED;;OAEG;IACH,qCAEC;IAED;;OAEG;IACH,mCAEC;IAED;;OAEG;IACH,oCAEC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH;QAZ+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACgB,QAAQ,EAAtC,oBAAoB;QACJ,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QACK,IAAI;QACE,MAAM,GAAvB,MAAM;QAEU,QAAQ,EAAxB,MAAM;aAyIhB;IAqDD;;;OAGG;IACH,0BAEC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH;QAT+B,KAAK,EAAzB,UAAU;QACM,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QAEW,cAAc,GAA/B,MAAM;QACY,SAAS,GAA3B,OAAO;QACY,MAAM;QACE,UAAU,EAArC,UAAU,MAAM,CAAC;aAmC3B;IAED;;;;;;;;;;;;;;OAcG;IACH;QAN+B,KAAK,EAAzB,UAAU;QACwD,KAAK,EAAvE,OAAO,gCAAgC,EAAE,eAAe;QACxC,MAAM,EAAtB,MAAM;QACU,kBAAkB,EAAlC,MAAM;QACU,wBAAwB,EAAxC,MAAM;aAiBhB;IAED;;;;;;;;;OASG;IACH,4CAUC;IAwDD;;;;;;;;;;;;;;;;OAgBG;IACH;QAR+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACgB,QAAQ,EAAtC,oBAAoB;QACF,UAAU,EAA5B,MAAM,EAAE;QACQ,QAAQ;QACtB,MAAM,CA8ClB;IAED;;;;;OAKG;IACH,uBAFW,aAAa,QASvB;IAED;;;OAGG;IACH,0BAHW,aAAa,GACX,OAAO,CAanB;IAqED;;;OAGG;IACH,gBA2BC;IAED,gBAcC;;CACJ;yBA9uBY,OAAO,8DAA8D,EAAE,UAAU;8BACjF,OAAO,0BAA0B,EAAE,eAAe;6BAClD,OAAO,8BAA8B,EAAE,cAAc;mCACrD,OAAO,2BAA2B,EAAE,oBAAoB;4BACxD,OAAO,4BAA4B,EAAE,aAAa;gCA3B/B,4BAA4B;gCAa5B,4BAA4B;uCAMrB,6BAA6B"}
1
+ {"version":3,"file":"GPUProbeClipmapGI.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IAmWI;;;;OAIG;IACH,oDAJW,eAAe,YACf,oBAAoB,GAClB,OAAO,CAUnB;IAzQD;;OAEG;IACH,sBAFW,eAAe,EAMzB;IAED;;OAEG;IACH,qCAEC;IAED;;OAEG;IACH,qCAEC;IAED;;OAEG;IACH,mCAEC;IAED;;OAEG;IACH,oCAEC;IAED;;;OAGG;IACH,iCAEC;IAED;;;OAGG;IACH,qBAEC;IAED;;;OAGG;IACH;gBAHsB,MAAM;cAAQ,MAAM;MAKzC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH;QAZ+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACgB,QAAQ,EAAtC,oBAAoB;QACJ,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QACK,IAAI;QACE,MAAM,GAAvB,MAAM;QAEU,QAAQ,EAAxB,MAAM;aA2IhB;IAqDD;;;OAGG;IACH,0BAEC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH;QAT+B,KAAK,EAAzB,UAAU;QACM,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QAEW,cAAc,GAA/B,MAAM;QACY,SAAS,GAA3B,OAAO;QACY,MAAM;QACE,UAAU,EAArC,UAAU,MAAM,CAAC;aAmC3B;IAED;;;;;;;;;;;;;;OAcG;IACH;QAN+B,KAAK,EAAzB,UAAU;QACwD,KAAK,EAAvE,OAAO,gCAAgC,EAAE,eAAe;QACxC,MAAM,EAAtB,MAAM;QACU,kBAAkB,EAAlC,MAAM;QACU,wBAAwB,EAAxC,MAAM;aAiBhB;IAED;;;;;;;;;OASG;IACH,4CAUC;IAwDD;;;;;;;;;;;;;;;;OAgBG;IACH;QAR+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACgB,QAAQ,EAAtC,oBAAoB;QACF,UAAU,EAA5B,MAAM,EAAE;QACQ,QAAQ;QACtB,MAAM,CA8ClB;IAED;;;;;OAKG;IACH,uBAFW,aAAa,QASvB;IAED;;;OAGG;IACH,0BAHW,aAAa,GACX,OAAO,CAanB;IAqED;;;OAGG;IACH,gBA2BC;IAED,gBAcC;;CACJ;yBA3wBY,OAAO,8DAA8D,EAAE,UAAU;8BACjF,OAAO,0BAA0B,EAAE,eAAe;6BAClD,OAAO,8BAA8B,EAAE,cAAc;mCACrD,OAAO,2BAA2B,EAAE,oBAAoB;4BACxD,OAAO,4BAA4B,EAAE,aAAa;gCA3B/B,4BAA4B;gCAa5B,4BAA4B;uCAMrB,6BAA6B;iCACnC,gCAAgC"}
@@ -160,6 +160,9 @@ export class GPUProbeClipmapGI {
160
160
  */
161
161
  #material_writers = [];
162
162
 
163
+ /** The graph handle of the brick clipmap's last write this frame, as {@link graph_update} left it. */
164
+ #bricks = -1;
165
+
163
166
  /**
164
167
  * @param {GraphicsContext} graphics
165
168
  */
@@ -197,6 +200,30 @@ export class GPUProbeClipmapGI {
197
200
  return this.#holds;
198
201
  }
199
202
 
203
+ /**
204
+ * @returns {GPUBrickMaterial|undefined} the bricks' surface material, which a ray's hit reads; undefined while the
205
+ * mode is not running
206
+ */
207
+ get material() {
208
+ return this.#material;
209
+ }
210
+
211
+ /**
212
+ * @returns {number} the graph handle of the brick clipmap's last write in this frame's {@link graph_update}, which a
213
+ * pass tracing the bricks after it reads
214
+ */
215
+ get bricks() {
216
+ return this.#bricks;
217
+ }
218
+
219
+ /**
220
+ * @returns {{lookup: number, data: number}} graph handles of the world light clusters this frame's
221
+ * {@link graph_update} built over the bricks' cascades, where a ray's hit finds its local lights
222
+ */
223
+ get clusters() {
224
+ return this.#clusters;
225
+ }
226
+
200
227
  /**
201
228
  * Take a frame of the mode: make the clipmaps for `view` and the structure `settings` describe,
202
229
  * unless they already are, hold the scene's geometry caches and record their bake. Allocates nothing
@@ -290,6 +317,8 @@ export class GPUProbeClipmapGI {
290
317
  movers,
291
318
  });
292
319
 
320
+ this.#bricks = bricks;
321
+
293
322
  const material = this.#material;
294
323
 
295
324
  const clusters = this.#graph_clusters(graph, scene);
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The irradiance a front-face hit in the brick clipmap takes from the directional lights
3
+ * (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.7), shadowed by rays traced through the bricks:
4
+ *
5
+ * ```wgsl
6
+ * fn probe_clipmap_sun_irradiance(position: vec3<f32>, normal: vec3<f32>, cascade: u32, seed: vec2<u32>, t_max: f32, cascade_count: u32, atlas_shift: u32) -> vec3<f32>
7
+ * ```
8
+ *
9
+ * E_dir = Σ colour·max(0, n·l)·visibility over the directional lights. The visibility is a shadow ray toward
10
+ * each of the first {@link PROBE_SHADOWED_SUNS} lights that cast shadows, in the table's order; lights past them
11
+ * are unshadowed. It starts a voxel of the hit's cascade off the surface along `normal`, outside the field's
12
+ * half-voxel expand, and heads for a point of the light's disk drawn as the path tracer draws it
13
+ * (`cone_sample_direction`), from `seed` and the light's place among the shadowed: a caller that integrates
14
+ * many hits over a seed that differs between them integrates the penumbra. The light is seen whole if the ray
15
+ * misses within `t_max`, and not at all if it hits or spends its steps. A surface turned from a light traces no
16
+ * ray toward it; the light keeps its place among the shadowed all the same.
17
+ *
18
+ * @type {CodeChunk}
19
+ */
20
+ export const chunk_probe_clipmap_sun_irradiance: CodeChunk;
21
+ /**
22
+ * The irradiance a front-face hit in brick cascade `cascade` takes from the local lights, E_loc
23
+ * (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.7):
24
+ *
25
+ * ```wgsl
26
+ * fn probe_clipmap_local_irradiance(cascade: u32, position: vec3<f32>, normal: vec3<f32>, random: vec4<f32>, cascade_count: u32, atlas_shift: u32) -> vec3<f32>
27
+ * ```
28
+ *
29
+ * - One of the point and spot lights of the hit's cell of the world light clusters, built over the bricks'
30
+ * cascades so that every hit has one, at most `IRRADIANCE_CLIPMAP_LIGHT_BUDGET` of each; past them lights are
31
+ * dropped. Each light's unshadowed irradiance is the irradiance clipmap's, at the footprint of a voxel of the
32
+ * hit's cascade, by its cosine at the hit's normal.
33
+ * - One is picked by weighted reservoir sampling over the cell's lights by `random.x`, its weight the luminance
34
+ * of that irradiance, with the number stretched over the candidates as `sample_discrete_wrs` does; it lights
35
+ * the hit by its irradiance over the chance of its pick, w/W. A caller blending many hits averages the picks
36
+ * to the cell's sum.
37
+ * - The picked light's shadow is a ray traced through the brick clipmap: from a voxel off the surface, past the
38
+ * field's half-voxel expand, toward the point of the light's sphere `random.yzw` draws, as the path tracer
39
+ * draws it, stopping short of that point by the light's near clip or a voxel, whichever is more. It sees the
40
+ * light if it misses; a hit, or a march that spends its steps, is no light. A light that casts no shadow
41
+ * traces none.
42
+ *
43
+ * @type {CodeChunk}
44
+ */
45
+ export const chunk_probe_clipmap_local_irradiance: CodeChunk;
46
+ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
47
+ //# sourceMappingURL=chunk_probe_clipmap_hit_light.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_probe_clipmap_hit_light.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iDAFU,SAAS,CAkDZ;AAKP;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,mDAFU,SAAS,CAsHZ;0BAhOmB,uCAAuC"}
@@ -0,0 +1,246 @@
1
+ import { MESH_SDF_BRICK_VOXELS } from "../../../geometry/sdf/MESH_SDF.js";
2
+ import { chunk_light_cluster_counts } from "../../../light/cluster/chunk_light_cluster_counts.js";
3
+ import { LIGHT_DATA_RESOURCE } from "../../../light/LIGHT_DATA_RESOURCE.js";
4
+ import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
5
+ import { LIGHT_FLAGS } from "../../../light/model/io/LIGHT_FLAGS.js";
6
+ import {
7
+ chunk_world_light_cluster_lookup_at,
8
+ WORLD_CLUSTER_DATA_RESOURCE
9
+ } from "../../../light/world_cluster/chunk_world_light_cluster_lookup.js";
10
+ import { chunk_rgb_to_luminance } from "../../../shader/chunk/color/chunk_rgb_to_luminance.js";
11
+ import { chunk_cone_sample_direction } from "../../../shader/chunk/geometry/cone/chunk_cone_sample_direction.js";
12
+ import { chunk_sphere_sample_volume } from "../../../shader/chunk/geometry/sphere/chunk_sphere_sample_volume.js";
13
+ import {
14
+ chunk_directional_lights_iteration_mask
15
+ } from "../../../shader/chunk/light/io/chunk_directional_lights_iteration_mask.js";
16
+ import { chunk_hash_to_float01 } from "../../../shader/chunk/random/chunk_hash_to_float01.js";
17
+ import { chunk_pcg3d } from "../../../shader/chunk/random/pcg/chunk_pcg3d.js";
18
+ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
19
+ import {
20
+ chunk_irradiance_clipmap_local_light
21
+ } from "../../../volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.js";
22
+ import { IRRADIANCE_CLIPMAP_LIGHT_BUDGET } from "../../../volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js";
23
+ import { BRICK_LEVELS_RESOURCE, chunk_brick_clipmap_trace } from "../brick/chunk_brick_clipmap_trace.js";
24
+ import { PROBE_SHADOWED_SUNS } from "./PROBE_CLIPMAP.js";
25
+
26
+ const DIRECTIONAL = LIGHT_DATABASE_SPEC.get('light_directional');
27
+ const POINT = LIGHT_DATABASE_SPEC.get('light_point');
28
+ const SPOT = LIGHT_DATABASE_SPEC.get('light_spot');
29
+
30
+ /**
31
+ * The irradiance a front-face hit in the brick clipmap takes from the directional lights
32
+ * (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.7), shadowed by rays traced through the bricks:
33
+ *
34
+ * ```wgsl
35
+ * fn probe_clipmap_sun_irradiance(position: vec3<f32>, normal: vec3<f32>, cascade: u32, seed: vec2<u32>, t_max: f32, cascade_count: u32, atlas_shift: u32) -> vec3<f32>
36
+ * ```
37
+ *
38
+ * E_dir = Σ colour·max(0, n·l)·visibility over the directional lights. The visibility is a shadow ray toward
39
+ * each of the first {@link PROBE_SHADOWED_SUNS} lights that cast shadows, in the table's order; lights past them
40
+ * are unshadowed. It starts a voxel of the hit's cascade off the surface along `normal`, outside the field's
41
+ * half-voxel expand, and heads for a point of the light's disk drawn as the path tracer draws it
42
+ * (`cone_sample_direction`), from `seed` and the light's place among the shadowed: a caller that integrates
43
+ * many hits over a seed that differs between them integrates the penumbra. The light is seen whole if the ray
44
+ * misses within `t_max`, and not at all if it hits or spends its steps. A surface turned from a light traces no
45
+ * ray toward it; the light keeps its place among the shadowed all the same.
46
+ *
47
+ * @type {CodeChunk}
48
+ */
49
+ export const chunk_probe_clipmap_sun_irradiance = CodeChunk.from(
50
+ //language=WGSL
51
+ `
52
+ fn probe_clipmap_sun_irradiance(position: vec3<f32>, normal: vec3<f32>, cascade: u32, seed: vec2<u32>, t_max: f32, cascade_count: u32, atlas_shift: u32) -> vec3<f32> {
53
+ let voxel = brick_levels[cascade].cell_size / ${MESH_SDF_BRICK_VOXELS}.0;
54
+ let lifted = position + voxel * normal;
55
+
56
+ var direct = vec3<f32>(0.0);
57
+ var bits = directional_lights_iteration_mask(&light_data);
58
+ var shadowed = 0u;
59
+
60
+ while (bits != 0u) {
61
+ let index = countTrailingZeros(bits);
62
+
63
+ bits &= ~(1u << index);
64
+
65
+ let light = ${DIRECTIONAL.marshalling_method_read}(&light_data, index);
66
+ let n_dot_l = dot(normal, -light.direction);
67
+
68
+ var visible = 1.0;
69
+
70
+ if ((light.flags & ${LIGHT_FLAGS.CASTS_SHADOW_BIT}u) != 0u && shadowed < ${PROBE_SHADOWED_SUNS}u) {
71
+ // a surface turned from the light takes none of it whatever the shadow, so it traces none;
72
+ // the light keeps its place among the shadowed all the same
73
+ if (n_dot_l > 0.0) {
74
+ // a point of the disk of its own for each light, apart from the caller's other draws
75
+ let hash = pcg3d(vec3<u32>(seed.x, seed.y, 0x3C6EF372u + shadowed));
76
+ let toward = cone_sample_direction(-light.direction, light.disk_radius, vec2<f32>(hash_to_float01(hash.x), hash_to_float01(hash.y)));
77
+ let shadow = brick_clipmap_trace(lifted, toward, 0.0, t_max, cascade_count, atlas_shift);
78
+
79
+ visible = select(0.0, 1.0, shadow.kind == BRICK_TRACE_MISS);
80
+ }
81
+
82
+ shadowed++;
83
+ }
84
+
85
+ direct += light.color * max(n_dot_l, 0.0) * visible;
86
+ }
87
+
88
+ return direct;
89
+ }
90
+ `, [
91
+ chunk_brick_clipmap_trace,
92
+ chunk_cone_sample_direction,
93
+ chunk_pcg3d,
94
+ chunk_hash_to_float01,
95
+ chunk_directional_lights_iteration_mask,
96
+ DIRECTIONAL.chunk_read,
97
+ ]);
98
+
99
+ chunk_probe_clipmap_sun_irradiance.requireResource(LIGHT_DATA_RESOURCE);
100
+ chunk_probe_clipmap_sun_irradiance.requireResource(BRICK_LEVELS_RESOURCE);
101
+
102
+ /**
103
+ * The irradiance a front-face hit in brick cascade `cascade` takes from the local lights, E_loc
104
+ * (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.7):
105
+ *
106
+ * ```wgsl
107
+ * fn probe_clipmap_local_irradiance(cascade: u32, position: vec3<f32>, normal: vec3<f32>, random: vec4<f32>, cascade_count: u32, atlas_shift: u32) -> vec3<f32>
108
+ * ```
109
+ *
110
+ * - One of the point and spot lights of the hit's cell of the world light clusters, built over the bricks'
111
+ * cascades so that every hit has one, at most `IRRADIANCE_CLIPMAP_LIGHT_BUDGET` of each; past them lights are
112
+ * dropped. Each light's unshadowed irradiance is the irradiance clipmap's, at the footprint of a voxel of the
113
+ * hit's cascade, by its cosine at the hit's normal.
114
+ * - One is picked by weighted reservoir sampling over the cell's lights by `random.x`, its weight the luminance
115
+ * of that irradiance, with the number stretched over the candidates as `sample_discrete_wrs` does; it lights
116
+ * the hit by its irradiance over the chance of its pick, w/W. A caller blending many hits averages the picks
117
+ * to the cell's sum.
118
+ * - The picked light's shadow is a ray traced through the brick clipmap: from a voxel off the surface, past the
119
+ * field's half-voxel expand, toward the point of the light's sphere `random.yzw` draws, as the path tracer
120
+ * draws it, stopping short of that point by the light's near clip or a voxel, whichever is more. It sees the
121
+ * light if it misses; a hit, or a march that spends its steps, is no light. A light that casts no shadow
122
+ * traces none.
123
+ *
124
+ * @type {CodeChunk}
125
+ */
126
+ export const chunk_probe_clipmap_local_irradiance = CodeChunk.from(
127
+ //language=WGSL
128
+ `
129
+ fn probe_clipmap_local_irradiance(cascade: u32, position: vec3<f32>, normal: vec3<f32>, random: vec4<f32>, cascade_count: u32, atlas_shift: u32) -> vec3<f32> {
130
+ let level = brick_levels[cascade];
131
+ let voxel = level.cell_size / ${MESH_SDF_BRICK_VOXELS}.0;
132
+ let cell = world_light_cluster_metadata_at(cascade, level, 0.0, position);
133
+ let point_count = min(light_cluster_count_point(cell.counts), ${IRRADIANCE_CLIPMAP_LIGHT_BUDGET}u);
134
+ let spot_count = min(light_cluster_count_spot(cell.counts), ${IRRADIANCE_CLIPMAP_LIGHT_BUDGET}u);
135
+
136
+ // the cell's spot lights follow its point lights
137
+ let spots = cell.offset + light_cluster_count_point(cell.counts);
138
+
139
+ // the reservoir: the weights so far, and the light it holds
140
+ var u = random.x;
141
+ var total = 0.0;
142
+ var picked = vec3<f32>(0.0);
143
+ var picked_weight = 0.0;
144
+ var picked_index = 0u;
145
+ var picked_spot = false;
146
+
147
+ for (var j = 0u; j < point_count + spot_count; j++) {
148
+ let spot = j >= point_count;
149
+ let index = world_cluster_data[select(cell.offset + j, spots + (j - point_count), spot)];
150
+
151
+ var irradiance: vec3<f32>;
152
+
153
+ if (spot) {
154
+ let light = irradiance_clipmap_get_spot_light_info_by_index(&light_data, index, position, voxel);
155
+
156
+ irradiance = light.color * max(dot(normal, light.direction), 0.0);
157
+ } else {
158
+ let light = irradiance_clipmap_get_point_light_info_by_index(&light_data, index, position, voxel);
159
+
160
+ irradiance = light.color * max(dot(normal, light.direction), 0.0);
161
+ }
162
+
163
+ let weight = rgb_to_luminance(irradiance);
164
+
165
+ if (weight <= 0.0) {
166
+ continue;
167
+ }
168
+
169
+ // the light takes the reservoir by its share of the weights so far, and the number is stretched back
170
+ // over [0, 1) from whichever side of the share it fell
171
+ total += weight;
172
+
173
+ let share = weight / total;
174
+
175
+ if (u < share) {
176
+ u = u / share;
177
+ picked = irradiance;
178
+ picked_weight = weight;
179
+ picked_index = index;
180
+ picked_spot = spot;
181
+ } else {
182
+ u = (u - share) / (1.0 - share);
183
+ }
184
+ }
185
+
186
+ if (total <= 0.0) {
187
+ return vec3<f32>(0.0);
188
+ }
189
+
190
+ // the pick's light over the chance of the pick, w / W
191
+ let estimate = picked * (total / picked_weight);
192
+
193
+ var source: vec3<f32>;
194
+ var radius: f32;
195
+ var near_clip: f32;
196
+ var flags: u32;
197
+
198
+ if (picked_spot) {
199
+ let light = ${SPOT.marshalling_method_read}(&light_data, picked_index);
200
+
201
+ source = light.position;
202
+ radius = light.radius;
203
+ near_clip = light.near_clip_distance;
204
+ flags = light.flags;
205
+ } else {
206
+ let light = ${POINT.marshalling_method_read}(&light_data, picked_index);
207
+
208
+ source = light.position.xyz;
209
+ radius = light.radius;
210
+ near_clip = light.near_clip_distance;
211
+ flags = light.flags;
212
+ }
213
+
214
+ if ((flags & ${LIGHT_FLAGS.CASTS_SHADOW_BIT}u) == 0u) {
215
+ return estimate;
216
+ }
217
+
218
+ // from a voxel off the surface, past the half voxel the field's surface may sit off it, to a point of the
219
+ // light, short of it by the light's near clip or by a voxel for the expand at that end
220
+ let lifted = position + normal * voxel;
221
+ let to_light = source + radius * sphere_sample_volume(random.yzw) - lifted;
222
+ let span = length(to_light);
223
+ let reach = span - max(near_clip, voxel);
224
+
225
+ if (reach <= 0.0) {
226
+ return estimate;
227
+ }
228
+
229
+ let shadow = brick_clipmap_trace(lifted, to_light / span, 0.0, reach, cascade_count, atlas_shift);
230
+
231
+ return select(vec3<f32>(0.0), estimate, shadow.kind == BRICK_TRACE_MISS);
232
+ }
233
+ `, [
234
+ chunk_world_light_cluster_lookup_at,
235
+ chunk_light_cluster_counts,
236
+ chunk_irradiance_clipmap_local_light,
237
+ chunk_rgb_to_luminance,
238
+ chunk_brick_clipmap_trace,
239
+ chunk_sphere_sample_volume,
240
+ POINT.chunk_read,
241
+ SPOT.chunk_read,
242
+ ]);
243
+
244
+ chunk_probe_clipmap_local_irradiance.requireResource(LIGHT_DATA_RESOURCE);
245
+ chunk_probe_clipmap_local_irradiance.requireResource(BRICK_LEVELS_RESOURCE);
246
+ chunk_probe_clipmap_local_irradiance.requireResource(WORLD_CLUSTER_DATA_RESOURCE);
@@ -4,21 +4,10 @@
4
4
  * into its flags. It adds ρ_d·E_loc/π to the radiance shade left, ρ_d being the albedo shade left in the
5
5
  * ray's \`albedo\`; the next bounce, E_ind, is the bounce pass's, after it (`shader_probe_clipmap_bounce`).
6
6
  *
7
- * - **E_loc, the local lights**: one of the point and spot lights of the hit's cell of the world light
8
- * clusters, built over the bricks' cascades so that every hit has one, at most
9
- * `IRRADIANCE_CLIPMAP_LIGHT_BUDGET` of each; past them lights are dropped. Each light's unshadowed
10
- * irradiance is the irradiance clipmap's, at the footprint of a voxel of the hit's cascade, by its
11
- * cosine at the hit's normal.
12
- * - One is picked by weighted reservoir sampling over the cell's lights, its weight the luminance of
13
- * that irradiance, with one number stretched over the candidates as `sample_discrete_wrs` does; it
14
- * lights the hit by its irradiance over the chance of its pick, w/W. The probe's blend of its rays
15
- * averages the picks to the cell's sum.
16
- * - The picked light's shadow is a ray traced through the brick clipmap, as the hit's own ray was:
17
- * from a voxel off the surface, past the field's half-voxel expand, toward a point of the light's
18
- * sphere drawn as the path tracer draws it, stopping short of that point by the light's near clip or
19
- * a voxel, whichever is more, for the expand at that end. It sees the light if it misses; a hit, or a
20
- * march that spends its steps, is no light. A light that casts no shadow traces none.
21
- * - The pick and the point are drawn from the ray's slot and direction, fresh every update.
7
+ * - **E_loc, the local lights**: one of the hit's world light cluster cell's point and spot lights, picked by
8
+ * weighted reservoir sampling and shadowed by a ray traced through the brick clipmap
9
+ * (`probe_clipmap_local_irradiance`). The probe's blend of its rays averages the picks to the cell's sum.
10
+ * - The pick and the point are drawn from the ray's slot and direction, fresh every update.
22
11
  *
23
12
  * Its own pass because shade binds nine of a stage's ten storage buffers; apart from the bounce because the
24
13
  * two together would bind twelve storage buffers, and a shadow march is another cost than probe taps
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_light.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js"],"names":[],"mappings":"AAqEA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,yCAFU,aAAa,CA0KpB;8BAnP2B,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_light.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js"],"names":[],"mappings":"AAuDA;;;;;;;;;;;;;;;;GAgBG;AACH,yCAFU,aAAa,CAuDpB;8BA9G2B,kCAAkC"}
@@ -1,20 +1,13 @@
1
- import { MESH_SDF_BRICK_VOXELS } from "../../../geometry/sdf/MESH_SDF.js";
2
- import { chunk_light_cluster_counts } from "../../../light/cluster/chunk_light_cluster_counts.js";
3
1
  import { LIGHT_DATA_RESOURCE } from "../../../light/LIGHT_DATA_RESOURCE.js";
4
- import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
5
- import { LIGHT_FLAGS } from "../../../light/model/io/LIGHT_FLAGS.js";
6
2
  import {
7
- chunk_world_light_cluster_lookup_at,
8
3
  WORLD_CLUSTER_DATA_RESOURCE,
9
4
  WORLD_CLUSTER_LOOKUP_RESOURCE
10
5
  } from "../../../light/world_cluster/chunk_world_light_cluster_lookup.js";
11
- import { chunk_rgb_to_luminance } from "../../../shader/chunk/color/chunk_rgb_to_luminance.js";
12
6
  import { chunk_rgbe9995_decode } from "../../../shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.js";
13
7
  import { chunk_rgbe9995_encode } from "../../../shader/chunk/color/rgbe9995/chunk_rgbe9995_encode.js";
14
8
  import {
15
9
  chunk_uv_octahedral_unit_decode
16
10
  } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
17
- import { chunk_sphere_sample_volume } from "../../../shader/chunk/geometry/sphere/chunk_sphere_sample_volume.js";
18
11
  import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
19
12
  import { RECIPROCAL_PI_DECLARATION } from "../../../shader/chunk/math/RECIPROCAL_PI_DECLARATION.js";
20
13
  import { chunk_hash_to_float01 } from "../../../shader/chunk/random/chunk_hash_to_float01.js";
@@ -22,18 +15,13 @@ import { chunk_pcg4d } from "../../../shader/chunk/random/pcg/chunk_pcg4d.js";
22
15
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
23
16
  import { ComputeShader } from "../../../shader/ComputeShader.js";
24
17
  import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
25
- import {
26
- chunk_irradiance_clipmap_local_light
27
- } from "../../../volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.js";
28
- import { IRRADIANCE_CLIPMAP_LIGHT_BUDGET } from "../../../volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js";
29
18
  import { BRICK_TRACE_HIT } from "../brick/BRICK_CLIPMAP.js";
30
19
  import {
31
20
  BRICK_ATLAS_TEXTURE_RESOURCE,
32
21
  BRICK_LEVELS_RESOURCE,
33
22
  BRICK_MAP_TEXTURE_RESOURCE,
34
23
  BRICK_OCCUPANCY_TEXTURE_RESOURCE,
35
- BRICK_SAMPLER_RESOURCE,
36
- chunk_brick_clipmap_trace
24
+ BRICK_SAMPLER_RESOURCE
37
25
  } from "../brick/chunk_brick_clipmap_trace.js";
38
26
  import {
39
27
  chunk_probe_clipmap,
@@ -42,12 +30,10 @@ import {
42
30
  PROBE_RAYS_WRITE_RESOURCE,
43
31
  PROBE_TRACE_READ_RESOURCE
44
32
  } from "./chunk_probe_clipmap.js";
33
+ import { chunk_probe_clipmap_local_irradiance } from "./chunk_probe_clipmap_hit_light.js";
45
34
  import { PROBE_THREAD_WORKGROUP_SIZE } from "./PROBE_CLIPMAP.js";
46
35
  import { PROBE_TRACE_SETTINGS } from "./shader_probe_clipmap_trace.js";
47
36
 
48
- const POINT = LIGHT_DATABASE_SPEC.get('light_point');
49
- const SPOT = LIGHT_DATABASE_SPEC.get('light_spot');
50
-
51
37
  const resources = new ShaderResourceSetDescriptor();
52
38
 
53
39
  resources.setImmediate("settings", PROBE_TRACE_SETTINGS);
@@ -73,21 +59,10 @@ resources.createGroup()
73
59
  * into its flags. It adds ρ_d·E_loc/π to the radiance shade left, ρ_d being the albedo shade left in the
74
60
  * ray's \`albedo\`; the next bounce, E_ind, is the bounce pass's, after it (`shader_probe_clipmap_bounce`).
75
61
  *
76
- * - **E_loc, the local lights**: one of the point and spot lights of the hit's cell of the world light
77
- * clusters, built over the bricks' cascades so that every hit has one, at most
78
- * `IRRADIANCE_CLIPMAP_LIGHT_BUDGET` of each; past them lights are dropped. Each light's unshadowed
79
- * irradiance is the irradiance clipmap's, at the footprint of a voxel of the hit's cascade, by its
80
- * cosine at the hit's normal.
81
- * - One is picked by weighted reservoir sampling over the cell's lights, its weight the luminance of
82
- * that irradiance, with one number stretched over the candidates as `sample_discrete_wrs` does; it
83
- * lights the hit by its irradiance over the chance of its pick, w/W. The probe's blend of its rays
84
- * averages the picks to the cell's sum.
85
- * - The picked light's shadow is a ray traced through the brick clipmap, as the hit's own ray was:
86
- * from a voxel off the surface, past the field's half-voxel expand, toward a point of the light's
87
- * sphere drawn as the path tracer draws it, stopping short of that point by the light's near clip or
88
- * a voxel, whichever is more, for the expand at that end. It sees the light if it misses; a hit, or a
89
- * march that spends its steps, is no light. A light that casts no shadow traces none.
90
- * - The pick and the point are drawn from the ray's slot and direction, fresh every update.
62
+ * - **E_loc, the local lights**: one of the hit's world light cluster cell's point and spot lights, picked by
63
+ * weighted reservoir sampling and shadowed by a ray traced through the brick clipmap
64
+ * (`probe_clipmap_local_irradiance`). The probe's blend of its rays averages the picks to the cell's sum.
65
+ * - The pick and the point are drawn from the ray's slot and direction, fresh every update.
91
66
  *
92
67
  * Its own pass because shade binds nine of a stage's ten storage buffers; apart from the bounce because the
93
68
  * two together would bind twelve storage buffers, and a shadow march is another cost than probe taps
@@ -101,114 +76,6 @@ export const shader_probe_clipmap_light = ComputeShader.from({
101
76
  body: CodeChunk.from(
102
77
  //language=WGSL
103
78
  `
104
- // E_loc at a front-face hit in brick cascade \`cascade\`: one of its world cluster cell's point and spot lights,
105
- // picked by \`random.x\` in proportion to its light at the hit and over the chance of its pick, shadowed by a ray
106
- // toward the point of the light's sphere \`random.yzw\` draws
107
- fn probe_clipmap_local_irradiance(cascade: u32, position: vec3<f32>, normal: vec3<f32>, random: vec4<f32>) -> vec3<f32> {
108
- let level = brick_levels[cascade];
109
- let voxel = level.cell_size / ${MESH_SDF_BRICK_VOXELS}.0;
110
- let cell = world_light_cluster_metadata_at(cascade, level, 0.0, position);
111
- let point_count = min(light_cluster_count_point(cell.counts), ${IRRADIANCE_CLIPMAP_LIGHT_BUDGET}u);
112
- let spot_count = min(light_cluster_count_spot(cell.counts), ${IRRADIANCE_CLIPMAP_LIGHT_BUDGET}u);
113
-
114
- // the cell's spot lights follow its point lights
115
- let spots = cell.offset + light_cluster_count_point(cell.counts);
116
-
117
- // the reservoir: the weights so far, and the light it holds
118
- var u = random.x;
119
- var total = 0.0;
120
- var picked = vec3<f32>(0.0);
121
- var picked_weight = 0.0;
122
- var picked_index = 0u;
123
- var picked_spot = false;
124
-
125
- for (var j = 0u; j < point_count + spot_count; j++) {
126
- let spot = j >= point_count;
127
- let index = world_cluster_data[select(cell.offset + j, spots + (j - point_count), spot)];
128
-
129
- var irradiance: vec3<f32>;
130
-
131
- if (spot) {
132
- let light = irradiance_clipmap_get_spot_light_info_by_index(&light_data, index, position, voxel);
133
-
134
- irradiance = light.color * max(dot(normal, light.direction), 0.0);
135
- } else {
136
- let light = irradiance_clipmap_get_point_light_info_by_index(&light_data, index, position, voxel);
137
-
138
- irradiance = light.color * max(dot(normal, light.direction), 0.0);
139
- }
140
-
141
- let weight = rgb_to_luminance(irradiance);
142
-
143
- if (weight <= 0.0) {
144
- continue;
145
- }
146
-
147
- // the light takes the reservoir by its share of the weights so far, and the number is stretched back
148
- // over [0, 1) from whichever side of the share it fell
149
- total += weight;
150
-
151
- let share = weight / total;
152
-
153
- if (u < share) {
154
- u = u / share;
155
- picked = irradiance;
156
- picked_weight = weight;
157
- picked_index = index;
158
- picked_spot = spot;
159
- } else {
160
- u = (u - share) / (1.0 - share);
161
- }
162
- }
163
-
164
- if (total <= 0.0) {
165
- return vec3<f32>(0.0);
166
- }
167
-
168
- // the pick's light over the chance of the pick, w / W
169
- let estimate = picked * (total / picked_weight);
170
-
171
- var source: vec3<f32>;
172
- var radius: f32;
173
- var near_clip: f32;
174
- var flags: u32;
175
-
176
- if (picked_spot) {
177
- let light = ${SPOT.marshalling_method_read}(&light_data, picked_index);
178
-
179
- source = light.position;
180
- radius = light.radius;
181
- near_clip = light.near_clip_distance;
182
- flags = light.flags;
183
- } else {
184
- let light = ${POINT.marshalling_method_read}(&light_data, picked_index);
185
-
186
- source = light.position.xyz;
187
- radius = light.radius;
188
- near_clip = light.near_clip_distance;
189
- flags = light.flags;
190
- }
191
-
192
- if ((flags & ${LIGHT_FLAGS.CASTS_SHADOW_BIT}u) == 0u) {
193
- return estimate;
194
- }
195
-
196
- // from a voxel off the surface, past the half voxel the field's surface may sit off it, to a point of the
197
- // light, short of it by the light's near clip or by a voxel for the expand at that end
198
- let lifted = position + normal * voxel;
199
- let to_light = source + radius * sphere_sample_volume(random.yzw) - lifted;
200
- let span = length(to_light);
201
- let reach = span - max(near_clip, voxel);
202
-
203
- if (reach <= 0.0) {
204
- return estimate;
205
- }
206
-
207
- let shadow = brick_clipmap_trace(lifted, to_light / span, 0.0, reach, settings.brick_cascade_count, settings.brick_atlas_shift);
208
-
209
- return select(vec3<f32>(0.0), estimate, shadow.kind == BRICK_TRACE_MISS);
210
- }
211
-
212
79
  @compute @workgroup_size(${PROBE_THREAD_WORKGROUP_SIZE})
213
80
  fn main(
214
81
  @builtin(workgroup_id) workgroup_id: vec3<u32>,
@@ -236,7 +103,7 @@ fn main(
236
103
  let random = vec4<f32>(hash_to_float01(hash.x), hash_to_float01(hash.y), hash_to_float01(hash.z), hash_to_float01(hash.w));
237
104
 
238
105
  // E/π of the local lights
239
- let e = probe_clipmap_local_irradiance((record.flags >> PROBE_RAY_CASCADE_SHIFT) & PROBE_RAY_CASCADE_MASK, position, normal, random) * RECIPROCAL_PI;
106
+ let e = probe_clipmap_local_irradiance((record.flags >> PROBE_RAY_CASCADE_SHIFT) & PROBE_RAY_CASCADE_MASK, position, normal, random, settings.brick_cascade_count, settings.brick_atlas_shift) * RECIPROCAL_PI;
240
107
 
241
108
  if (all(e == vec3<f32>(0.0))) {
242
109
  return;
@@ -250,16 +117,9 @@ fn main(
250
117
  chunk_folded_workgroup_index,
251
118
  chunk_uv_octahedral_unit_decode,
252
119
  RECIPROCAL_PI_DECLARATION,
253
- chunk_world_light_cluster_lookup_at,
254
- chunk_light_cluster_counts,
255
- chunk_irradiance_clipmap_local_light,
256
- chunk_rgb_to_luminance,
257
- chunk_brick_clipmap_trace,
120
+ chunk_probe_clipmap_local_irradiance,
258
121
  chunk_pcg4d,
259
122
  chunk_hash_to_float01,
260
- chunk_sphere_sample_volume,
261
- POINT.chunk_read,
262
- SPOT.chunk_read,
263
123
  chunk_rgbe9995_decode,
264
124
  chunk_rgbe9995_encode,
265
125
  ]),
@@ -18,15 +18,10 @@ export const PROBE_TRACE_SETTINGS: WebGPUStruct;
18
18
  * rays of a round and kind are stratified inside it over the updates of that kind it takes them on.
19
19
  * - **Origin**: a point of a small ball around the probe where relocation left it, `probe_origins`, one a
20
20
  * ray (`probe_clipmap_ray_origin`); t_min one voxel of the brick cascade there.
21
- * - **Direct light**: a hit off a front face takes E_dir = Σ colour·max(0, n·l)·visibility over the
22
- * directional lights (§8.7). The visibility is a shadow ray, traced through the brick clipmap as the
23
- * ray itself was, toward each of the first {@link PROBE_SHADOWED_SUNS} lights that cast shadows, in the
24
- * table's order; lights past them are unshadowed at hits. It starts a voxel off the hit along its
25
- * normal, outside the half-voxel expand, and heads for a point of the light's disk drawn as the path
26
- * tracer draws it (`cone_sample_direction`), from the ray's slot and direction, so that the probe's
27
- * blend of its rays integrates the penumbra. The light is seen whole if the ray misses, and not at all
28
- * if it hits or spends its steps: what the march could not answer is no light, not all of it. A
29
- * surface turned from a light traces no ray toward it, since the light gives it nothing.
21
+ * - **Direct light**: a hit off a front face takes E_dir over the directional lights, shadowed by rays
22
+ * traced through the brick clipmap as the ray itself was (`probe_clipmap_sun_irradiance`, §8.7). Each
23
+ * light's point of its disk is drawn from the ray's slot and direction, so that the probe's blend of its
24
+ * rays integrates the penumbra.
30
25
  * - **Back face**: a hit whose field's gradient is along the ray, so it came from inside a solid.
31
26
  *
32
27
  * Writes the ray's `PROBE_RAY_STRUCT`, with E_dir as its light, which shade turns into the ray's
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_trace.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js"],"names":[],"mappings":"AAkDA;;GAEG;AACH,mCAFU,YAAY,CAiBG;AAsBzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,yCAFU,aAAa,CAuJpB;6BAzP0B,sCAAsC;8BAHrC,kCAAkC"}
1
+ {"version":3,"file":"shader_probe_clipmap_trace.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js"],"names":[],"mappings":"AAyCA;;GAEG;AACH,mCAFU,YAAY,CAiBG;AAsBzB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,yCAFU,aAAa,CAoHpB;6BAhN0B,sCAAsC;8BAHrC,kCAAkC"}