@woosh/meep-engine 3.65.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 (350) 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/format/lut/cube/CubeLut.d.ts +38 -0
  7. package/src/format/lut/cube/CubeLut.d.ts.map +1 -0
  8. package/src/format/lut/cube/CubeLut.js +23 -0
  9. package/src/format/lut/cube/cube_read.d.ts +23 -0
  10. package/src/format/lut/cube/cube_read.d.ts.map +1 -0
  11. package/src/format/lut/cube/cube_read.js +199 -0
  12. package/src/format/lut/cube/cube_write.d.ts +15 -0
  13. package/src/format/lut/cube/cube_write.d.ts.map +1 -0
  14. package/src/format/lut/cube/cube_write.js +90 -0
  15. package/src/shade/playground/probe_clipmap/README.md +1 -0
  16. package/src/shade/playground/probe_clipmap/index.html +48 -0
  17. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  18. package/src/shade/playground/probe_clipmap/main.js +36 -0
  19. package/src/shade/renderer/Renderer.d.ts +7 -0
  20. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  21. package/src/shade/renderer/Renderer.js +225 -27
  22. package/src/shade/renderer/ShadeIndirectLightingMode.d.ts +1 -0
  23. package/src/shade/renderer/ShadeIndirectLightingMode.js +9 -0
  24. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +22 -0
  25. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +1 -0
  26. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js +160 -0
  27. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts +45 -0
  28. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts.map +1 -0
  29. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.js +57 -0
  30. package/src/shade/renderer/atmosphere/GPUSky.d.ts +23 -8
  31. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  32. package/src/shade/renderer/atmosphere/GPUSky.js +91 -34
  33. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts +17 -0
  34. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts.map +1 -1
  35. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.js +55 -25
  36. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts +164 -0
  37. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts.map +1 -0
  38. package/src/shade/renderer/atmosphere/SceneAtmosphere.js +308 -0
  39. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts +3 -12
  40. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts.map +1 -1
  41. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.js +52 -89
  42. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts +14 -0
  43. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts.map +1 -0
  44. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.js +103 -0
  45. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts +10 -4
  46. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts.map +1 -1
  47. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js +95 -57
  48. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts +10 -14
  49. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts.map +1 -1
  50. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js +97 -69
  51. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts +17 -0
  52. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts.map +1 -1
  53. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.js +117 -48
  54. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts +8 -0
  55. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts.map +1 -1
  56. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.js +65 -35
  57. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts +2 -1
  58. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts.map +1 -1
  59. package/src/shade/renderer/atmosphere/compute_mie_absorption.js +6 -6
  60. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts +41 -0
  61. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts.map +1 -0
  62. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.js +123 -0
  63. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
  64. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +21 -64
  65. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts +6 -2
  66. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
  67. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +55 -179
  68. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts +7 -0
  69. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts.map +1 -0
  70. package/src/shade/renderer/atmosphere/shader_sky_view_lut.js +111 -0
  71. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts +0 -1
  72. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts.map +1 -1
  73. package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +68 -79
  74. package/src/shade/renderer/deferred/shader_background.js +1 -1
  75. package/src/shade/renderer/deferred/shader_background_sky.d.ts +5 -0
  76. package/src/shade/renderer/deferred/shader_background_sky.d.ts.map +1 -0
  77. package/src/shade/renderer/deferred/shader_background_sky.js +130 -0
  78. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +73 -4
  79. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
  80. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +113 -7
  81. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts +12 -0
  82. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts.map +1 -0
  83. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.js +12 -0
  84. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +15 -1
  85. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -1
  86. package/src/shade/renderer/deferred/tonemap/ToneMapper.js +31 -3
  87. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +26 -0
  88. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -0
  89. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +55 -0
  90. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +2 -2
  91. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -1
  92. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.js +6 -3
  93. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +3 -2
  94. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -1
  95. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.js +7 -3
  96. package/src/shade/renderer/extension/ViewTextures.d.ts +3 -2
  97. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  98. package/src/shade/renderer/extension/ViewTextures.js +3 -2
  99. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  100. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  101. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  102. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  103. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  104. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +1 -1
  105. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +20 -1
  106. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  107. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +29 -0
  108. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts +47 -0
  109. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts.map +1 -0
  110. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js +246 -0
  111. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +4 -15
  112. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  113. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +8 -148
  114. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +4 -9
  115. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  116. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +9 -58
  117. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +142 -0
  118. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -0
  119. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +938 -0
  120. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +192 -0
  121. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -0
  122. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +231 -0
  123. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +11 -0
  124. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts.map +1 -0
  125. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +25 -0
  126. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +110 -0
  127. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -0
  128. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +197 -0
  129. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +150 -0
  130. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -0
  131. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +408 -0
  132. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +23 -0
  133. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts.map +1 -0
  134. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +63 -0
  135. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts +24 -0
  136. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts.map +1 -0
  137. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.js +61 -0
  138. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +39 -0
  139. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -0
  140. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +126 -0
  141. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +21 -0
  142. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts.map +1 -0
  143. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +74 -0
  144. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts +20 -0
  145. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts.map +1 -0
  146. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.js +26 -0
  147. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts +24 -0
  148. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts.map +1 -0
  149. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.js +57 -0
  150. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +22 -0
  151. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts.map +1 -0
  152. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +53 -0
  153. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +62 -0
  154. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -0
  155. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +156 -0
  156. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts +18 -0
  157. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts.map +1 -0
  158. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.js +50 -0
  159. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +21 -0
  160. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -0
  161. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +54 -0
  162. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +67 -0
  163. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -0
  164. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +509 -0
  165. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts +20 -0
  166. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts.map +1 -0
  167. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.js +128 -0
  168. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +62 -0
  169. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -0
  170. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +478 -0
  171. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +69 -0
  172. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -0
  173. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +457 -0
  174. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +27 -0
  175. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -0
  176. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +219 -0
  177. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +22 -0
  178. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts.map +1 -0
  179. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +151 -0
  180. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +66 -0
  181. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts.map +1 -0
  182. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +301 -0
  183. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +59 -0
  184. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -0
  185. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +364 -0
  186. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +40 -0
  187. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -0
  188. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +275 -0
  189. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -1
  190. package/src/shade/renderer/grass/blade/GPUGrassBlades.js +17 -2
  191. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +18 -8
  192. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -1
  193. package/src/shade/renderer/grass/blade/grass_blade_resolve.js +114 -32
  194. package/src/shade/renderer/light/GPULightCollection.d.ts +1 -1
  195. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  196. package/src/shade/renderer/light/GPULightCollection.js +213 -80
  197. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.d.ts +1 -2
  198. package/src/shade/renderer/light/environment/chunk_sample_environment_color.d.ts.map +1 -0
  199. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.js +3 -4
  200. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  201. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -1
  202. package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js +1 -1
  203. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +35 -9
  204. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
  205. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +81 -11
  206. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
  207. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +4 -1
  208. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +1 -1
  209. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +1 -1
  210. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +1 -1
  211. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +1 -1
  212. package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.js +1 -1
  213. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  214. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +2 -0
  215. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +2 -0
  216. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +6 -0
  217. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
  218. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +9 -1
  219. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.d.ts.map +1 -1
  220. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.js +4 -3
  221. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts +17 -0
  222. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts.map +1 -0
  223. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.js +16 -0
  224. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts +21 -0
  225. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts.map +1 -0
  226. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.js +30 -0
  227. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -5
  228. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  229. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +19 -17
  230. package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.js +2 -0
  231. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  232. package/src/shade/renderer/scene/GPUSceneContext.js +2 -1
  233. package/src/shade/renderer/scene/Scene.d.ts +9 -2
  234. package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
  235. package/src/shade/renderer/scene/Scene.js +10 -2
  236. package/src/shade/renderer/shader/ImageShader.d.ts +24 -12
  237. package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
  238. package/src/shade/renderer/shader/ImageShader.js +11 -8
  239. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts +3 -1
  240. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts.map +1 -1
  241. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js +11 -3
  242. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts +2 -11
  243. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts.map +1 -1
  244. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js +23 -32
  245. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts +6 -0
  246. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts.map +1 -1
  247. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js +14 -2
  248. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.d.ts.map +1 -1
  249. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js +4 -2
  250. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.d.ts.map +1 -1
  251. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js +11 -3
  252. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts.map +1 -1
  253. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js +68 -69
  254. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts +4 -1
  255. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts.map +1 -1
  256. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js +46 -39
  257. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.d.ts.map +1 -1
  258. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js +5 -3
  259. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +6 -0
  260. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
  261. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +7 -0
  262. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +4 -4
  263. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -1
  264. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +86 -5
  265. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +73 -0
  266. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -0
  267. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +139 -0
  268. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts +14 -0
  269. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts.map +1 -0
  270. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.js +30 -0
  271. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts +21 -0
  272. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts.map +1 -0
  273. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js +60 -0
  274. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.d.ts → io/chunk_light_get_sun.d.ts} +3 -6
  275. package/src/shade/renderer/shader/chunk/light/io/chunk_light_get_sun.d.ts.map +1 -0
  276. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.js → io/chunk_light_get_sun.js} +6 -26
  277. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.js +1 -1
  278. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +3 -1
  279. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  280. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -2
  281. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  282. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +743 -739
  283. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +2 -0
  284. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  285. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +19 -17
  286. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
  287. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +5 -3
  288. package/src/shade/renderer/water/chunk_water_gi.js +2 -0
  289. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  290. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  291. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts +0 -2
  292. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +0 -1
  293. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +0 -45
  294. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts +0 -2
  295. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +0 -1
  296. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +0 -17
  297. package/src/engine/graphics/sh3/sky/hosek/README.md +0 -4
  298. package/src/engine/graphics/sh3/sky/hosek/data.d.ts +0 -17
  299. package/src/engine/graphics/sh3/sky/hosek/data.d.ts.map +0 -1
  300. package/src/engine/graphics/sh3/sky/hosek/data.js +0 -3744
  301. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts +0 -2
  302. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts.map +0 -1
  303. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +0 -71
  304. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts +0 -26
  305. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts.map +0 -1
  306. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.js +0 -70
  307. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +0 -22
  308. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +0 -1
  309. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +0 -388
  310. package/src/engine/graphics3/make_default_environment.d.ts +0 -15
  311. package/src/engine/graphics3/make_default_environment.d.ts.map +0 -1
  312. package/src/engine/graphics3/make_default_environment.js +0 -111
  313. package/src/shade/renderer/atmosphere/MIE_G.d.ts +0 -6
  314. package/src/shade/renderer/atmosphere/MIE_G.d.ts.map +0 -1
  315. package/src/shade/renderer/atmosphere/MIE_G.js +0 -5
  316. package/src/shade/renderer/atmosphere/chunk_sample_environment_color.d.ts.map +0 -1
  317. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts +0 -4
  318. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts.map +0 -1
  319. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.js +0 -44
  320. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +0 -2
  321. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +0 -1
  322. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.js +0 -43
  323. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts +0 -3
  324. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts.map +0 -1
  325. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.js +0 -6
  326. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts +0 -3
  327. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts.map +0 -1
  328. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.js +0 -18
  329. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts +0 -14
  330. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts.map +0 -1
  331. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.js +0 -86
  332. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts +0 -8
  333. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts.map +0 -1
  334. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.js +0 -125
  335. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts +0 -3
  336. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts.map +0 -1
  337. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.js +0 -17
  338. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts +0 -3
  339. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts.map +0 -1
  340. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.js +0 -38
  341. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts +0 -16
  342. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts.map +0 -1
  343. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.js +0 -28
  344. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts +0 -11
  345. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts.map +0 -1
  346. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.js +0 -56
  347. package/src/shade/renderer/shader/chunk/light/sky/chunk_sample_sky_color.d.ts.map +0 -1
  348. package/src/shade/renderer/view/GPUViewSkyContext.d.ts +0 -26
  349. package/src/shade/renderer/view/GPUViewSkyContext.d.ts.map +0 -1
  350. package/src/shade/renderer/view/GPUViewSkyContext.js +0 -170
@@ -0,0 +1,408 @@
1
+ import { chunk_uv_equal_area_sphere } from "../../shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js";
2
+ import { chunk_index_to_grid2d_reciprocal } from "../../shader/chunk/grid/chunk_index_to_grid2d_reciprocal.js";
3
+ import { chunk_stbn_sample_vec2 } from "../../shader/chunk/noise/chunk_stbn_sample_vec2.js";
4
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
5
+ import { ShaderResourceDescriptor } from "../../shader/resource/ShaderResourceDescriptor.js";
6
+ import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
7
+ import { atomic_u32, f32, u32, vec2u, vec3f, vec4f, vec4u } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
8
+ import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
9
+ import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
10
+ import { STBN_VEC2_RESOURCE } from "../../STATIC_GRAPHICS_ENGINE_ASSET_RESOURCES.js";
11
+ import {
12
+ SCREEN_PROBE_DISPATCH_BRICK_RAY_COUNT,
13
+ SCREEN_PROBE_DISPATCH_PROBE_COUNT,
14
+ SCREEN_PROBE_PLANE_WEIGHT_SCALE,
15
+ SCREEN_PROBE_RAY_SLOT_BITS,
16
+ SCREEN_PROBE_TRACE_BACK,
17
+ SCREEN_PROBE_TRACE_FAR,
18
+ SCREEN_PROBE_TRACE_HIT,
19
+ SCREEN_PROBE_TRACE_KIND_MASK,
20
+ SCREEN_PROBE_TRACE_MOVING,
21
+ SCREEN_PROBE_TRACE_NONE,
22
+ SCREEN_PROBE_TRACE_PENDING,
23
+ SCREEN_PROBE_TRACE_SCREEN,
24
+ SCREEN_PROBE_TRACE_SKY,
25
+ SCREEN_PROBE_TRACE_UNRESOLVED
26
+ } from "./SCREEN_PROBE.js";
27
+
28
+ /**
29
+ * What every pass of a frame reads of the frame's probes, a uniform the host writes once a frame.
30
+ * @type {WebGPUStruct}
31
+ */
32
+ export const SCREEN_PROBE_FRAME_STRUCT = WebGPUStruct.from({
33
+ /** the view's pixels, x and y */
34
+ view_size: vec2u,
35
+ /** uniform probes along x and y: a tile of D × D pixels each, the view rounded up */
36
+ tile_count: vec2u,
37
+ /** where the uniform probes stand in their tiles this frame, pixels from the tile's corner */
38
+ jitter: vec2u,
39
+ /** where they stood last frame */
40
+ previous_jitter: vec2u,
41
+ /** last frame's uniform probes along x and y */
42
+ previous_tile_count: vec2u,
43
+ /** 1 / tile_count.x, rounded to f32: a probe's place in the atlas without an integer division */
44
+ tile_count_x_reciprocal: f32,
45
+ /** log2 of D, the pixels between uniform probes */
46
+ downsample_shift: u32,
47
+ /** n, a probe's octahedral texels a side */
48
+ octahedron_resolution: u32,
49
+ /** log2 of n */
50
+ octahedron_shift: u32,
51
+ /** uniform probes, tile_count.x · tile_count.y: the adaptive ones follow them */
52
+ uniform_count: u32,
53
+ /** adaptive probe slots */
54
+ adaptive_capacity: u32,
55
+ /** the most adaptive probes a tile holds, 4^levels − 1 */
56
+ adaptive_tile_capacity: u32,
57
+ /** frames rendered, for noise */
58
+ frame_index: u32,
59
+ /** 1 where last frame's probes, radiance and colour describe this view at this structure, else 0 */
60
+ history: u32,
61
+ /** how far a ray of a probe no world probe serves is traced, metres: across the coarsest brick window */
62
+ brick_t_max: f32,
63
+ /** the brick clipmap's cascades */
64
+ brick_cascade_count: u32,
65
+ /** the brick atlas's footprint as shifts, `GPUBrickClipmap#atlas_shift` */
66
+ brick_atlas_shift: u32,
67
+ /** the most frames the temporal filter averages a pixel over (`ScreenProbeSettings#temporal_frames`) */
68
+ temporal_frames: f32,
69
+ /** 1 where a probe's rays follow its densities (`ScreenProbeSettings#importance_sampling`), else 0 */
70
+ importance_sampling: u32,
71
+ /** 1 where rays are traced through the screen before the bricks (`ScreenProbeSettings#screen_traces`), else 0 */
72
+ screen_traces: u32,
73
+ }, "ScreenProbeFrame");
74
+
75
+ /**
76
+ * A screen probe, 32 bytes: where it stands on the G-buffer, as placement writes it.
77
+ * @type {WebGPUStruct}
78
+ */
79
+ export const SCREEN_PROBE_STRUCT = WebGPUStruct.from({
80
+ /** the surface point it stands on, world metres */
81
+ position: vec3f,
82
+ /** that point's view-space depth, metres; zero where the probe stands on no surface (sky) */
83
+ depth: f32,
84
+ /** the surface's face normal, octahedral, two unorm16: the plane interpolation weighs probes by */
85
+ normal: u32,
86
+ /** its pixel, x in the low half and y in the high */
87
+ pixel: u32,
88
+ /** how far its surface point moved since last frame, metres */
89
+ speed: f32,
90
+ }, "ScreenProbe");
91
+
92
+ /**
93
+ * Where a screen probe's rays leave from in the bricks, where they end their trace and what answers for the rest,
94
+ * 64 bytes: the world-space probes picked at the probe (`probe_clipmap_pick`), its rays' origin, and its reach.
95
+ * @type {WebGPUStruct}
96
+ */
97
+ export const SCREEN_PROBE_PICK_STRUCT = WebGPUStruct.from({
98
+ slots: vec4u,
99
+ /** each slot's share, summing to one; all zero where no world probe weighs anything */
100
+ weights: vec4f,
101
+ /**
102
+ * Where its rays leave from in the bricks, world metres, off its surface point to where the bricks' field reads a
103
+ * voxel of its cascade there; that voxel in w
104
+ */
105
+ origin: vec4f,
106
+ /**
107
+ * How far its rays are traced, metres: `SCREEN_PROBE_REACH_SPACINGS` spacings of the coarsest cascade picked from,
108
+ * or `brick_t_max` where nothing was picked
109
+ */
110
+ reach: f32,
111
+ }, "ScreenProbePick");
112
+
113
+ /**
114
+ * A ray the screen left to the bricks, 28 bytes, through the passes that trace and light it.
115
+ * @type {WebGPUStruct}
116
+ */
117
+ export const SCREEN_PROBE_RAY_STRUCT = WebGPUStruct.from({
118
+ /** its probe, above its slot among the probe's rays (`SCREEN_PROBE_RAY_SLOT_BITS`) */
119
+ ray: u32,
120
+ /** from the screen trace, how far it is known clear; from the bricks, its hit or where the march stopped */
121
+ t: f32,
122
+ /** its direction, the equal-area map's square, two unorm16 */
123
+ direction: u32,
124
+ /** a hit's normal, octahedral, two unorm16 */
125
+ normal: u32,
126
+ /** how it ended (`SCREEN_PROBE_TRACE_*`), and the hit's brick cascade above the kind's bits */
127
+ flags: u32,
128
+ /** a front-face hit's diffuse albedo, `pack4x8unorm`, which the light and bounce passes multiply in; else zero */
129
+ albedo: u32,
130
+ /** the light, RGB9E5: E_dir from the trace at a front-face hit, then the radiance the ray brings back */
131
+ light: u32,
132
+ }, "ScreenProbeRay");
133
+
134
+ /** @type {ShaderResourceDescriptor} */
135
+ export const SCREEN_PROBE_FRAME_RESOURCE = ShaderResourceDescriptor.uniform("screen_probe_frame", SCREEN_PROBE_FRAME_STRUCT);
136
+
137
+ /**
138
+ * The factor the display multiplies radiance by ahead of its tone curve, as the last frame was shown: what the
139
+ * probes' radiance is pre-exposed by, Lumen's `View.PreExposure`.
140
+ * @type {ShaderResourceDescriptor}
141
+ */
142
+ export const SCREEN_PROBE_EXPOSURE_RESOURCE = ShaderResourceDescriptor.uniform("screen_probe_exposure", F32_CONTAINER_STRUCT);
143
+
144
+ /** The exposure last frame's probes' radiance was pre-exposed by. @type {ShaderResourceDescriptor} */
145
+ export const SCREEN_PROBE_EXPOSURE_PREVIOUS_RESOURCE = ShaderResourceDescriptor.uniform("screen_probe_exposure_previous", F32_CONTAINER_STRUCT);
146
+
147
+ /** The frame's probes, uniform then adaptive. @type {ShaderResourceDescriptor} */
148
+ export const SCREEN_PROBES_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probes", WebGPUArray.from(SCREEN_PROBE_STRUCT));
149
+ /** @type {ShaderResourceDescriptor} */
150
+ export const SCREEN_PROBES_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probes", WebGPUArray.from(SCREEN_PROBE_STRUCT), true);
151
+
152
+ /** Last frame's probes, as this frame's lighting density reprojects into. @type {ShaderResourceDescriptor} */
153
+ export const SCREEN_PROBES_PREVIOUS_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probes_previous", WebGPUArray.from(SCREEN_PROBE_STRUCT));
154
+
155
+ /** @type {ShaderResourceDescriptor} */
156
+ export const SCREEN_PROBE_PICKS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_picks", WebGPUArray.from(SCREEN_PROBE_PICK_STRUCT));
157
+ /** @type {ShaderResourceDescriptor} */
158
+ export const SCREEN_PROBE_PICKS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_picks", WebGPUArray.from(SCREEN_PROBE_PICK_STRUCT), true);
159
+
160
+ /** The commands and counts of the frame (`SCREEN_PROBE_DISPATCH_*`), read-only to the passes after the one that writes them. @type {ShaderResourceDescriptor} */
161
+ export const SCREEN_PROBE_DISPATCH_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_dispatch", WebGPUArray.u32);
162
+ /** @type {ShaderResourceDescriptor} */
163
+ export const SCREEN_PROBE_DISPATCH_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_dispatch", WebGPUArray.u32, true);
164
+
165
+ /** The frame's atomic counters (`SCREEN_PROBE_COUNTER_*`). @type {ShaderResourceDescriptor} */
166
+ export const SCREEN_PROBE_COUNTERS_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_counters", WebGPUArray.from(atomic_u32), true);
167
+ /** @type {ShaderResourceDescriptor} */
168
+ export const SCREEN_PROBE_COUNTERS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_counters", WebGPUArray.u32);
169
+
170
+ /** Each tile's count of adaptive probes. @type {ShaderResourceDescriptor} */
171
+ export const SCREEN_PROBE_TILE_COUNTS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_tile_counts", WebGPUArray.u32);
172
+ /** @type {ShaderResourceDescriptor} */
173
+ export const SCREEN_PROBE_TILE_COUNTS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_tile_counts", WebGPUArray.from(atomic_u32), true);
174
+
175
+ /** Each tile's adaptive probes, `adaptive_tile_capacity` slots a tile: the k of probe uniform_count + k. @type {ShaderResourceDescriptor} */
176
+ export const SCREEN_PROBE_TILE_PROBES_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_tile_probes", WebGPUArray.u32);
177
+ /** @type {ShaderResourceDescriptor} */
178
+ export const SCREEN_PROBE_TILE_PROBES_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_tile_probes", WebGPUArray.u32, true);
179
+
180
+ /** The rays the screen left to the bricks. @type {ShaderResourceDescriptor} */
181
+ export const SCREEN_PROBE_RAYS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_rays", WebGPUArray.from(SCREEN_PROBE_RAY_STRUCT));
182
+ /** @type {ShaderResourceDescriptor} */
183
+ export const SCREEN_PROBE_RAYS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_rays", WebGPUArray.from(SCREEN_PROBE_RAY_STRUCT), true);
184
+
185
+ /** Each probe's share of its rays' light that came from something moving relative to it, 0 to 1, as the composite writes it. @type {ShaderResourceDescriptor} */
186
+ export const SCREEN_PROBE_MOVING_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_moving", WebGPUArray.from(f32));
187
+ /** @type {ShaderResourceDescriptor} */
188
+ export const SCREEN_PROBE_MOVING_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_moving", WebGPUArray.from(f32), true);
189
+
190
+ /** Each probe's radiance, `rgba16float`, n² texels a probe in the atlas: rgb the radiance pre-exposed (`screen_probe_exposure`), a the nearest hit of the rays it holds, negative where none landed. @type {ShaderResourceDescriptor} */
191
+ export const SCREEN_PROBE_RADIANCE_READ_RESOURCE = ShaderResourceDescriptor.texture("screen_probe_radiance", "unfilterable-float");
192
+ /** @type {ShaderResourceDescriptor} */
193
+ export const SCREEN_PROBE_RADIANCE_WRITE_RESOURCE = ShaderResourceDescriptor.storageTexture("screen_probe_radiance_out", "rgba16float", "2d", "write-only");
194
+
195
+ /** Each probe's pre-exposed radiance SH3, as the probe clipmap's records hold theirs (`probe_record_sh_encode`). @type {ShaderResourceDescriptor} */
196
+ export const SCREEN_PROBE_SH_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_sh", WebGPUArray.u32);
197
+ /** @type {ShaderResourceDescriptor} */
198
+ export const SCREEN_PROBE_SH_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("screen_probe_sh", WebGPUArray.u32, true);
199
+
200
+ /** Each ray's texel and level, `r32uint`, a texel a ray in the probes' atlas. @type {ShaderResourceDescriptor} */
201
+ export const SCREEN_PROBE_RAY_INFO_READ_RESOURCE = ShaderResourceDescriptor.texture("screen_probe_ray_info", "uint");
202
+ /** @type {ShaderResourceDescriptor} */
203
+ export const SCREEN_PROBE_RAY_INFO_WRITE_RESOURCE = ShaderResourceDescriptor.storageTexture("screen_probe_ray_info", "r32uint", "2d", "write-only");
204
+
205
+ /** Each ray's radiance pre-exposed (`screen_probe_exposure`), `rgba16float`. @type {ShaderResourceDescriptor} */
206
+ export const SCREEN_PROBE_TRACE_RADIANCE_READ_RESOURCE = ShaderResourceDescriptor.texture("screen_probe_trace_radiance", "unfilterable-float");
207
+ /** @type {ShaderResourceDescriptor} */
208
+ export const SCREEN_PROBE_TRACE_RADIANCE_WRITE_RESOURCE = ShaderResourceDescriptor.storageTexture("screen_probe_trace_radiance", "rgba16float", "2d", "write-only");
209
+
210
+ /** Each ray's hit word (`screen_probe_trace_hit_pack`), `r32uint`. @type {ShaderResourceDescriptor} */
211
+ export const SCREEN_PROBE_TRACE_HIT_READ_RESOURCE = ShaderResourceDescriptor.texture("screen_probe_trace_hit", "uint");
212
+ /** @type {ShaderResourceDescriptor} */
213
+ export const SCREEN_PROBE_TRACE_HIT_WRITE_RESOURCE = ShaderResourceDescriptor.storageTexture("screen_probe_trace_hit", "r32uint", "2d", "write-only");
214
+
215
+ /**
216
+ * Probe addressing, the probes' records and their rays' words (Lumen's `LumenScreenProbeCommon.ush`):
217
+ *
218
+ * ```wgsl
219
+ * fn screen_probe_atlas(probe: u32) -> vec2<u32> // the probe's place in the atlas, in probes
220
+ * fn screen_probe_texel(probe: u32, slot: u32) -> vec2<u32> // its slot's texel in an atlas of n² a probe
221
+ * fn screen_probe_pixel_encode(pixel: vec2<u32>) -> u32
222
+ * fn screen_probe_pixel_decode(word: u32) -> vec2<u32>
223
+ * fn screen_probe_tile_of_pixel(pixel: vec2<u32>) -> vec2<u32> // the tile of a pixel placed on this frame's grid
224
+ * fn screen_probe_plane_weight(plane: vec4<f32>, point: vec3<f32>, depth: f32) -> f32
225
+ * fn screen_probe_ray_info_pack(texel: vec2<u32>, level: u32) -> u32
226
+ * fn screen_probe_ray_info_texel(info: u32) -> vec2<u32>
227
+ * fn screen_probe_ray_info_level(info: u32) -> u32 // 1 the probe's n, 0 twice it
228
+ * fn screen_probe_ray_direction(info: u32, jitter: vec2<f32>) -> vec3<f32>
229
+ * fn screen_probe_trace_hit_pack(kind: u32, distance: f32, moving: bool) -> u32
230
+ * fn screen_probe_trace_hit_kind(word: u32) -> u32
231
+ * fn screen_probe_trace_hit_distance(word: u32) -> f32
232
+ * fn screen_probe_texel_wrap(texel: vec2<i32>) -> vec2<u32> // a texel a step outside the octahedron, folded in
233
+ * ```
234
+ *
235
+ * - **The atlas**: probe i at (i mod tile_count.x, i div tile_count.x), the uniform probes on their tiles and the
236
+ * adaptive ones in the rows below, a probe's n² texels at n times its place in every per-ray and per-texel texture.
237
+ * - **The plane weight**: `exp2(−k·(|n·p − d| / depth)²)`, `SCREEN_PROBE_PLANE_WEIGHT_SCALE`, the distance of a point
238
+ * from a receiver's plane over the receiver's depth: Lumen's, with the face normal's plane where Lumen takes the
239
+ * shading normal's, so a normal map does not part probes on one flat surface.
240
+ * - **A ray's info**: the texel at its level's resolution, 2n at level 0 and n at level 1, and the level.
241
+ * - **A ray's direction**: Clarberg's equal-area map at its texel plus the probe's jitter over the level's resolution,
242
+ * so a probe's texels all hold the same solid angle, 4π/n², and a child a quarter of it.
243
+ * - **A hit word**: the kind (`SCREEN_PROBE_TRACE_*`) and moving bit low, the distance as a half float high.
244
+ *
245
+ * @type {CodeChunk}
246
+ */
247
+ export const chunk_screen_probe = CodeChunk.from(
248
+ //language=WGSL
249
+ `
250
+ const SCREEN_PROBE_RAY_SLOT_BITS = ${SCREEN_PROBE_RAY_SLOT_BITS}u;
251
+ const SCREEN_PROBE_RAY_SLOT_MASK = ${(1 << SCREEN_PROBE_RAY_SLOT_BITS) - 1}u;
252
+
253
+ const SCREEN_PROBE_TRACE_PENDING = ${SCREEN_PROBE_TRACE_PENDING}u;
254
+ const SCREEN_PROBE_TRACE_SCREEN = ${SCREEN_PROBE_TRACE_SCREEN}u;
255
+ const SCREEN_PROBE_TRACE_HIT = ${SCREEN_PROBE_TRACE_HIT}u;
256
+ const SCREEN_PROBE_TRACE_BACK = ${SCREEN_PROBE_TRACE_BACK}u;
257
+ const SCREEN_PROBE_TRACE_FAR = ${SCREEN_PROBE_TRACE_FAR}u;
258
+ const SCREEN_PROBE_TRACE_SKY = ${SCREEN_PROBE_TRACE_SKY}u;
259
+ const SCREEN_PROBE_TRACE_UNRESOLVED = ${SCREEN_PROBE_TRACE_UNRESOLVED}u;
260
+ const SCREEN_PROBE_TRACE_NONE = ${SCREEN_PROBE_TRACE_NONE}u;
261
+ const SCREEN_PROBE_TRACE_KIND_MASK = ${SCREEN_PROBE_TRACE_KIND_MASK}u;
262
+ const SCREEN_PROBE_TRACE_MOVING = ${SCREEN_PROBE_TRACE_MOVING}u;
263
+
264
+ fn screen_probe_atlas(probe: u32) -> vec2<u32> {
265
+ return index_to_grid2d_reciprocal(probe, screen_probe_frame.tile_count.x, screen_probe_frame.tile_count_x_reciprocal);
266
+ }
267
+
268
+ fn screen_probe_texel(probe: u32, slot: u32) -> vec2<u32> {
269
+ let n = screen_probe_frame.octahedron_resolution;
270
+ let in_probe = vec2<u32>(slot & (n - 1u), slot >> screen_probe_frame.octahedron_shift);
271
+
272
+ return screen_probe_atlas(probe) * n + in_probe;
273
+ }
274
+
275
+ fn screen_probe_pixel_encode(pixel: vec2<u32>) -> u32 {
276
+ return (pixel.x & 0xFFFFu) | (pixel.y << 16u);
277
+ }
278
+
279
+ fn screen_probe_pixel_decode(word: u32) -> vec2<u32> {
280
+ return vec2<u32>(word & 0xFFFFu, word >> 16u);
281
+ }
282
+
283
+ fn screen_probe_tile_of_pixel(pixel: vec2<u32>) -> vec2<u32> {
284
+ return (pixel - screen_probe_frame.jitter) >> vec2<u32>(screen_probe_frame.downsample_shift);
285
+ }
286
+
287
+ fn screen_probe_plane_weight(plane: vec4<f32>, point: vec3<f32>, depth: f32) -> f32 {
288
+ let relative = abs(dot(plane.xyz, point) - plane.w) / depth;
289
+
290
+ return exp2(-${SCREEN_PROBE_PLANE_WEIGHT_SCALE}.0 * relative * relative);
291
+ }
292
+
293
+ fn screen_probe_ray_info_pack(texel: vec2<u32>, level: u32) -> u32 {
294
+ return texel.x | (texel.y << 8u) | (level << 16u);
295
+ }
296
+
297
+ fn screen_probe_ray_info_texel(info: u32) -> vec2<u32> {
298
+ return vec2<u32>(info & 0xFFu, (info >> 8u) & 0xFFu);
299
+ }
300
+
301
+ fn screen_probe_ray_info_level(info: u32) -> u32 {
302
+ return info >> 16u;
303
+ }
304
+
305
+ fn screen_probe_ray_direction(info: u32, jitter: vec2<f32>) -> vec3<f32> {
306
+ // level 1 is the probe's own n, level 0 twice it
307
+ let size = f32((screen_probe_frame.octahedron_resolution * 2u) >> screen_probe_ray_info_level(info));
308
+
309
+ return uv_equal_area_sphere_decode((vec2<f32>(screen_probe_ray_info_texel(info)) + jitter) / size);
310
+ }
311
+
312
+ fn screen_probe_trace_hit_pack(kind: u32, distance: f32, moving: bool) -> u32 {
313
+ return kind | select(0u, SCREEN_PROBE_TRACE_MOVING, moving) | (pack2x16float(vec2<f32>(0.0, distance)) & 0xFFFF0000u);
314
+ }
315
+
316
+ fn screen_probe_trace_hit_kind(word: u32) -> u32 {
317
+ return word & SCREEN_PROBE_TRACE_KIND_MASK;
318
+ }
319
+
320
+ fn screen_probe_trace_hit_distance(word: u32) -> f32 {
321
+ return unpack2x16float(word).y;
322
+ }
323
+
324
+ fn screen_probe_texel_wrap(texel: vec2<i32>) -> vec2<u32> {
325
+ let n = i32(screen_probe_frame.octahedron_resolution);
326
+
327
+ var t = texel;
328
+
329
+ // a step past an edge of the octahedral square lands on the mirrored side of the same edge
330
+ if (t.x < 0 || t.x >= n) {
331
+ t = vec2<i32>(select(t.x, -1 - t.x, t.x < 0), n - 1 - t.y);
332
+ t.x = select(t.x, 2 * n - 1 - t.x, t.x >= n);
333
+ }
334
+
335
+ if (t.y < 0 || t.y >= n) {
336
+ t = vec2<i32>(n - 1 - t.x, select(t.y, -1 - t.y, t.y < 0));
337
+ t.y = select(t.y, 2 * n - 1 - t.y, t.y >= n);
338
+ }
339
+
340
+ return vec2<u32>(clamp(t, vec2<i32>(0), vec2<i32>(n - 1)));
341
+ }
342
+ `, [
343
+ SCREEN_PROBE_FRAME_STRUCT.declaration_chunk,
344
+ SCREEN_PROBE_STRUCT.declaration_chunk,
345
+ SCREEN_PROBE_PICK_STRUCT.declaration_chunk,
346
+ SCREEN_PROBE_RAY_STRUCT.declaration_chunk,
347
+ chunk_index_to_grid2d_reciprocal,
348
+ chunk_uv_equal_area_sphere,
349
+ ]);
350
+
351
+ chunk_screen_probe.requireResource(SCREEN_PROBE_FRAME_RESOURCE);
352
+
353
+ /**
354
+ * Where in its texel each of a probe's rays falls this frame, the same for every texel of the probe:
355
+ *
356
+ * ```wgsl
357
+ * fn screen_probe_noise_tile(probe: u32, pixel: vec2<u32>) -> vec2<u32> // the tile whose noise a probe draws
358
+ * fn screen_probe_ray_jitter(tile: vec2<u32>) -> vec2<f32>
359
+ * ```
360
+ *
361
+ * The spatio-temporal blue noise at the probe's tile and the frame (Lumen's per-tile blue noise), shared by the
362
+ * tile's probes: neighbouring probes' jitters are spread apart, and a probe's spread over the frames the temporal
363
+ * filter averages. A uniform probe's tile is its place in the atlas; an adaptive probe's, the tile its pixel stands
364
+ * in (`pixel`, its record's), as Lumen keys a probe's noise by its screen tile. Every pass that places a probe's
365
+ * rays or reads them back by direction takes the tile from here.
366
+ *
367
+ * @type {CodeChunk}
368
+ */
369
+ export const chunk_screen_probe_ray_jitter = CodeChunk.from(
370
+ //language=WGSL
371
+ `
372
+ fn screen_probe_noise_tile(probe: u32, pixel: vec2<u32>) -> vec2<u32> {
373
+ return select(screen_probe_tile_of_pixel(pixel), screen_probe_atlas(probe), probe < screen_probe_frame.uniform_count);
374
+ }
375
+
376
+ fn screen_probe_ray_jitter(tile: vec2<u32>) -> vec2<f32> {
377
+ return stbn_sample_vec2(vec3<u32>(tile, screen_probe_frame.frame_index));
378
+ }
379
+ `, [
380
+ chunk_screen_probe,
381
+ chunk_stbn_sample_vec2,
382
+ ]);
383
+
384
+ chunk_screen_probe_ray_jitter.requireResource(STBN_VEC2_RESOURCE);
385
+
386
+ /**
387
+ * The frame's counts, from the pass that writes the commands:
388
+ *
389
+ * ```wgsl
390
+ * fn screen_probe_count() -> u32 // the frame's probes, uniform and adaptive
391
+ * fn screen_probe_brick_ray_count() -> u32 // the rays the screen left to the bricks, held to their list's slots
392
+ * ```
393
+ *
394
+ * @type {CodeChunk}
395
+ */
396
+ export const chunk_screen_probe_counts = CodeChunk.from(
397
+ //language=WGSL
398
+ `
399
+ fn screen_probe_count() -> u32 {
400
+ return screen_probe_dispatch[${SCREEN_PROBE_DISPATCH_PROBE_COUNT}u];
401
+ }
402
+
403
+ fn screen_probe_brick_ray_count() -> u32 {
404
+ return screen_probe_dispatch[${SCREEN_PROBE_DISPATCH_BRICK_RAY_COUNT}u];
405
+ }
406
+ `);
407
+
408
+ chunk_screen_probe_counts.requireResource(SCREEN_PROBE_DISPATCH_READ_RESOURCE);
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A probe's BRDF density, and whether a texel of its octahedron keeps its ray whatever its light:
3
+ *
4
+ * ```wgsl
5
+ * struct ScreenProbeBRDF { low: vec4<f32>, high: vec4<f32>, last: f32 } // SH3: coefficients 0–3, 4–7 and 8
6
+ * fn screen_probe_brdf_density(brdf: ScreenProbeBRDF, direction: vec3<f32>) -> f32
7
+ * fn screen_probe_brdf_keeps(brdf: ScreenProbeBRDF, texel: vec2<u32>, n: u32) -> bool
8
+ * ```
9
+ *
10
+ * - **The density** at a direction: `max(0, Σ brdf·Y(ω))`, the mean of the probe's pixels' clamped cosine lobes there.
11
+ * - **A texel keeps its ray** where any of its directions reaches `SCREEN_PROBE_MIN_PDF`: its density at nine points,
12
+ * its corners, the middles of its edges and its centre, the most of a smooth function over the small patch the
13
+ * texel is. Lumen tests the centre alone. A surface's horizon runs through texel centres wherever the surface faces
14
+ * the equal-area map's pole, ±z, and a lobe's density there is 0.094, under the minimum, though the texel's upper
15
+ * half reaches cosines of 0.4 and more: those texels gave their rays away, taking 7.3% of the surface's irradiance
16
+ * at n = 8 (29% at 4, 2% at 16) and none of a surface facing ±x or ±y. A texel no point of which reaches the
17
+ * minimum lies below the lobes' horizon, where they weigh almost nothing.
18
+ *
19
+ * @type {CodeChunk}
20
+ */
21
+ export const chunk_screen_probe_brdf_density: CodeChunk;
22
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
23
+ //# sourceMappingURL=chunk_screen_probe_brdf_density.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_brdf_density.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAFU,SAAS,CAuCZ;0BA5DmB,oCAAoC"}
@@ -0,0 +1,63 @@
1
+ import { chunk_uv_equal_area_sphere } from "../../shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js";
2
+ import { chunk_sh3_basis_at } from "../../shader/chunk/spherical_harmonics/chunk_sh3_basis_at.js";
3
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
4
+ import { SCREEN_PROBE_MIN_PDF } from "./SCREEN_PROBE.js";
5
+
6
+ /**
7
+ * A probe's BRDF density, and whether a texel of its octahedron keeps its ray whatever its light:
8
+ *
9
+ * ```wgsl
10
+ * struct ScreenProbeBRDF { low: vec4<f32>, high: vec4<f32>, last: f32 } // SH3: coefficients 0–3, 4–7 and 8
11
+ * fn screen_probe_brdf_density(brdf: ScreenProbeBRDF, direction: vec3<f32>) -> f32
12
+ * fn screen_probe_brdf_keeps(brdf: ScreenProbeBRDF, texel: vec2<u32>, n: u32) -> bool
13
+ * ```
14
+ *
15
+ * - **The density** at a direction: `max(0, Σ brdf·Y(ω))`, the mean of the probe's pixels' clamped cosine lobes there.
16
+ * - **A texel keeps its ray** where any of its directions reaches `SCREEN_PROBE_MIN_PDF`: its density at nine points,
17
+ * its corners, the middles of its edges and its centre, the most of a smooth function over the small patch the
18
+ * texel is. Lumen tests the centre alone. A surface's horizon runs through texel centres wherever the surface faces
19
+ * the equal-area map's pole, ±z, and a lobe's density there is 0.094, under the minimum, though the texel's upper
20
+ * half reaches cosines of 0.4 and more: those texels gave their rays away, taking 7.3% of the surface's irradiance
21
+ * at n = 8 (29% at 4, 2% at 16) and none of a surface facing ±x or ±y. A texel no point of which reaches the
22
+ * minimum lies below the lobes' horizon, where they weigh almost nothing.
23
+ *
24
+ * @type {CodeChunk}
25
+ */
26
+ export const chunk_screen_probe_brdf_density = CodeChunk.from(
27
+ //language=WGSL
28
+ `
29
+ struct ScreenProbeBRDF {
30
+ low: vec4<f32>,
31
+ high: vec4<f32>,
32
+ last: f32,
33
+ }
34
+
35
+ fn screen_probe_brdf_density(brdf: ScreenProbeBRDF, direction: vec3<f32>) -> f32 {
36
+ let basis = sh3_basis_at(direction);
37
+
38
+ return max(
39
+ dot(brdf.low, vec4<f32>(basis[0], basis[1], basis[2], basis[3]))
40
+ + dot(brdf.high, vec4<f32>(basis[4], basis[5], basis[6], basis[7]))
41
+ + brdf.last * basis[8],
42
+ 0.0,
43
+ );
44
+ }
45
+
46
+ fn screen_probe_brdf_keeps(brdf: ScreenProbeBRDF, texel: vec2<u32>, n: u32) -> bool {
47
+ let corner = vec2<f32>(texel);
48
+ let size = 1.0 / f32(n);
49
+
50
+ var most = 0.0;
51
+
52
+ for (var k = 0u; k < 9u; k++) {
53
+ let at = (corner + 0.5 * vec2<f32>(f32(k % 3u), f32(k / 3u))) * size;
54
+
55
+ most = max(most, screen_probe_brdf_density(brdf, uv_equal_area_sphere_decode(at)));
56
+ }
57
+
58
+ return most >= ${SCREEN_PROBE_MIN_PDF};
59
+ }
60
+ `, [
61
+ chunk_sh3_basis_at,
62
+ chunk_uv_equal_area_sphere,
63
+ ]);
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Where a screen probe's rays leave from in the bricks:
3
+ *
4
+ * ```wgsl
5
+ * fn screen_probe_brick_origin(position: vec3<f32>, normal: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> vec4<f32>
6
+ * ```
7
+ *
8
+ * `position` is the probe's surface point and `normal` its face normal; `atlas_shift` is the brick atlas's footprint,
9
+ * as `brick_clipmap_distance` takes it. Returns the origin, and in w a voxel of the brick cascade at the surface point
10
+ * (the finest window holding it).
11
+ *
12
+ * - **The lift**: the point a voxel out along the face normal, as a hit's shadow rays leave theirs: past the half voxel
13
+ * the bricks' trace counts as a hit, where the bricks' surface is the G-buffer's.
14
+ * - **The push**: while the bricks' field there (`brick_clipmap_distance`) reads less than the voxel, along its slope
15
+ * (`brick_clipmap_gradient`) by what it lacks, `q += ∇d·(voxel − d)`, at most `SCREEN_PROBE_ORIGIN_STEPS` times, as
16
+ * the probe clipmap relocates its probes. The bricks hold a coarser surface than the G-buffer's, up to a voxel of the
17
+ * mesh field they were built from off it, and a ray that leaves from inside their hit band hits the solid it starts
18
+ * in. A field with no slope, as deep in a solid past its band, moves nothing.
19
+ *
20
+ * @type {CodeChunk}
21
+ */
22
+ export const chunk_screen_probe_brick_origin: CodeChunk;
23
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
24
+ //# sourceMappingURL=chunk_screen_probe_brick_origin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_brick_origin.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,8CAFU,SAAS,CAgCZ;0BA3DmB,oCAAoC"}
@@ -0,0 +1,61 @@
1
+ import { MESH_SDF_BRICK_VOXELS } from "../../geometry/sdf/MESH_SDF.js";
2
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
+ import {
4
+ chunk_brick_clipmap_distance,
5
+ chunk_brick_clipmap_gradient,
6
+ chunk_brick_clipmap_window
7
+ } from "../probe_clipmap/brick/chunk_brick_clipmap_trace.js";
8
+ import { SCREEN_PROBE_ORIGIN_STEPS } from "./SCREEN_PROBE.js";
9
+
10
+ /**
11
+ * Where a screen probe's rays leave from in the bricks:
12
+ *
13
+ * ```wgsl
14
+ * fn screen_probe_brick_origin(position: vec3<f32>, normal: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> vec4<f32>
15
+ * ```
16
+ *
17
+ * `position` is the probe's surface point and `normal` its face normal; `atlas_shift` is the brick atlas's footprint,
18
+ * as `brick_clipmap_distance` takes it. Returns the origin, and in w a voxel of the brick cascade at the surface point
19
+ * (the finest window holding it).
20
+ *
21
+ * - **The lift**: the point a voxel out along the face normal, as a hit's shadow rays leave theirs: past the half voxel
22
+ * the bricks' trace counts as a hit, where the bricks' surface is the G-buffer's.
23
+ * - **The push**: while the bricks' field there (`brick_clipmap_distance`) reads less than the voxel, along its slope
24
+ * (`brick_clipmap_gradient`) by what it lacks, `q += ∇d·(voxel − d)`, at most `SCREEN_PROBE_ORIGIN_STEPS` times, as
25
+ * the probe clipmap relocates its probes. The bricks hold a coarser surface than the G-buffer's, up to a voxel of the
26
+ * mesh field they were built from off it, and a ray that leaves from inside their hit band hits the solid it starts
27
+ * in. A field with no slope, as deep in a solid past its band, moves nothing.
28
+ *
29
+ * @type {CodeChunk}
30
+ */
31
+ export const chunk_screen_probe_brick_origin = CodeChunk.from(
32
+ //language=WGSL
33
+ `
34
+ fn screen_probe_brick_origin(position: vec3<f32>, normal: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> vec4<f32> {
35
+ let voxel = brick_levels[min(brick_clipmap_start(position, cascade_count), cascade_count - 1u)].cell_size / ${MESH_SDF_BRICK_VOXELS}.0;
36
+
37
+ var origin = position + normal * voxel;
38
+
39
+ for (var step = 0u; step < ${SCREEN_PROBE_ORIGIN_STEPS}u; step++) {
40
+ let distance = brick_clipmap_distance(origin, cascade_count, atlas_shift);
41
+
42
+ if (distance >= voxel) {
43
+ break;
44
+ }
45
+
46
+ let gradient = brick_clipmap_gradient(origin, cascade_count, atlas_shift);
47
+
48
+ if (all(gradient == vec3<f32>(0.0))) {
49
+ break;
50
+ }
51
+
52
+ origin += gradient * (voxel - distance);
53
+ }
54
+
55
+ return vec4<f32>(origin, voxel);
56
+ }
57
+ `, [
58
+ chunk_brick_clipmap_window,
59
+ chunk_brick_clipmap_distance,
60
+ chunk_brick_clipmap_gradient,
61
+ ]);
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Which probes light a point on the screen, and by how much (Lumen's `CalculateUpsampleInterpolationWeights`):
3
+ *
4
+ * ```wgsl
5
+ * struct ScreenProbeSample { probes: vec4<u32>, weights: vec4<f32> }
6
+ * fn screen_probe_interpolate(pixel: vec2<u32>, offset: vec2<f32>, position: vec3<f32>, depth: f32, normal: vec3<f32>) -> ScreenProbeSample
7
+ * ```
8
+ *
9
+ * `pixel` is the point's pixel, `offset` a shift of the lookup in pixels (the integration's jitter, zero for
10
+ * placement), `position` and `depth` the point's world position and view depth, `normal` its face normal.
11
+ *
12
+ * - **The uniform corners**: the four uniform probes around the pixel, its place less the frame's jitter, by bilinear
13
+ * weights over a tile widened by a pixel each side, `(p − D·tile + 1) / (D + 2)` an axis, so no corner's weight is
14
+ * ever exactly one or zero. The place is held to the grid: past the last row or column of probes a pixel takes the
15
+ * weights of one standing on them, so no weight is extrapolated. (Lumen holds it to the view and extrapolates there,
16
+ * by up to (D − 1) / (D + 2) of a tile; its integration then skips the negative corners it normalised by.) Each is
17
+ * multiplied by the corner's plane weight from the point's plane (`screen_probe_plane_weight`); a corner on no
18
+ * surface weighs nothing.
19
+ * - **Adaptive probes**: a corner weighing no more than `SCREEN_PROBE_WEIGHT_EPSILON` looks among its tile's adaptive
20
+ * probes for one weighing more: its plane weight times `1 − min(|dx|, |dy|) / D`, the pixels between it and the
21
+ * point. The heaviest takes the corner's place.
22
+ * - The weights are as found, not normalised: their sum says how well the probes cover the point
23
+ * (`screen_probe_covers`).
24
+ *
25
+ * The includer defines how a tile's count of adaptive probes is read, as its pass binds the counts:
26
+ *
27
+ * ```wgsl
28
+ * fn screen_probe_tile_adaptive_count(tile: u32) -> u32
29
+ * ```
30
+ *
31
+ * Reads the four uniform corners' records and, for a corner that fails, the records of its tile's adaptive probes:
32
+ * at most `adaptive_tile_capacity`, the tile's points of the adaptive grids. Each corner is taken by name: an index
33
+ * into the result's vectors would put them in local memory.
34
+ *
35
+ * @type {CodeChunk}
36
+ */
37
+ export const chunk_screen_probe_interpolate: CodeChunk;
38
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
39
+ //# sourceMappingURL=chunk_screen_probe_interpolate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_interpolate.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,6CAFU,SAAS,CAgFZ;0BA1HmB,oCAAoC"}