@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,126 @@
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+ import {
3
+ chunk_screen_probe,
4
+ SCREEN_PROBE_TILE_PROBES_READ_RESOURCE,
5
+ SCREEN_PROBES_READ_RESOURCE
6
+ } from "./chunk_screen_probe.js";
7
+ import { SCREEN_PROBE_WEIGHT_EPSILON } from "./SCREEN_PROBE.js";
8
+
9
+ /**
10
+ * Which probes light a point on the screen, and by how much (Lumen's `CalculateUpsampleInterpolationWeights`):
11
+ *
12
+ * ```wgsl
13
+ * struct ScreenProbeSample { probes: vec4<u32>, weights: vec4<f32> }
14
+ * fn screen_probe_interpolate(pixel: vec2<u32>, offset: vec2<f32>, position: vec3<f32>, depth: f32, normal: vec3<f32>) -> ScreenProbeSample
15
+ * ```
16
+ *
17
+ * `pixel` is the point's pixel, `offset` a shift of the lookup in pixels (the integration's jitter, zero for
18
+ * placement), `position` and `depth` the point's world position and view depth, `normal` its face normal.
19
+ *
20
+ * - **The uniform corners**: the four uniform probes around the pixel, its place less the frame's jitter, by bilinear
21
+ * weights over a tile widened by a pixel each side, `(p − D·tile + 1) / (D + 2)` an axis, so no corner's weight is
22
+ * ever exactly one or zero. The place is held to the grid: past the last row or column of probes a pixel takes the
23
+ * weights of one standing on them, so no weight is extrapolated. (Lumen holds it to the view and extrapolates there,
24
+ * by up to (D − 1) / (D + 2) of a tile; its integration then skips the negative corners it normalised by.) Each is
25
+ * multiplied by the corner's plane weight from the point's plane (`screen_probe_plane_weight`); a corner on no
26
+ * surface weighs nothing.
27
+ * - **Adaptive probes**: a corner weighing no more than `SCREEN_PROBE_WEIGHT_EPSILON` looks among its tile's adaptive
28
+ * probes for one weighing more: its plane weight times `1 − min(|dx|, |dy|) / D`, the pixels between it and the
29
+ * point. The heaviest takes the corner's place.
30
+ * - The weights are as found, not normalised: their sum says how well the probes cover the point
31
+ * (`screen_probe_covers`).
32
+ *
33
+ * The includer defines how a tile's count of adaptive probes is read, as its pass binds the counts:
34
+ *
35
+ * ```wgsl
36
+ * fn screen_probe_tile_adaptive_count(tile: u32) -> u32
37
+ * ```
38
+ *
39
+ * Reads the four uniform corners' records and, for a corner that fails, the records of its tile's adaptive probes:
40
+ * at most `adaptive_tile_capacity`, the tile's points of the adaptive grids. Each corner is taken by name: an index
41
+ * into the result's vectors would put them in local memory.
42
+ *
43
+ * @type {CodeChunk}
44
+ */
45
+ export const chunk_screen_probe_interpolate = CodeChunk.from(
46
+ //language=WGSL
47
+ `
48
+ struct ScreenProbeSample {
49
+ probes: vec4<u32>,
50
+ weights: vec4<f32>,
51
+ }
52
+
53
+ struct ScreenProbeCorner {
54
+ probe: u32,
55
+ weight: f32,
56
+ }
57
+
58
+ fn screen_probe_corner_weight(probe: u32, plane: vec4<f32>, depth: f32) -> f32 {
59
+ let record = screen_probes[probe];
60
+
61
+ return select(0.0, screen_probe_plane_weight(plane, record.position, depth), record.depth > 0.0);
62
+ }
63
+
64
+ // a uniform corner, or the heaviest of its tile's adaptive probes where it weighs no more than the epsilon
65
+ fn screen_probe_corner(tile: vec2<u32>, axes: f32, pixel: vec2<u32>, plane: vec4<f32>, depth: f32) -> ScreenProbeCorner {
66
+ let frame = screen_probe_frame;
67
+
68
+ // a uniform probe's index is its tile's
69
+ let tile_index = tile.y * frame.tile_count.x + tile.x;
70
+
71
+ var corner = ScreenProbeCorner(tile_index, axes * screen_probe_corner_weight(tile_index, plane, depth));
72
+
73
+ if (corner.weight > ${SCREEN_PROBE_WEIGHT_EPSILON}) {
74
+ return corner;
75
+ }
76
+
77
+ let span = f32(1u << frame.downsample_shift);
78
+ let count = min(screen_probe_tile_adaptive_count(tile_index), frame.adaptive_tile_capacity);
79
+
80
+ for (var i = 0u; i < count; i++) {
81
+ let probe = frame.uniform_count + screen_probe_tile_probes[tile_index * frame.adaptive_tile_capacity + i];
82
+ let record = screen_probes[probe];
83
+
84
+ let gap = abs(vec2<f32>(screen_probe_pixel_decode(record.pixel)) - vec2<f32>(pixel));
85
+ let weight = select(0.0, screen_probe_plane_weight(plane, record.position, depth), record.depth > 0.0)
86
+ * (1.0 - saturate(min(gap.x, gap.y) / span));
87
+
88
+ if (weight > corner.weight) {
89
+ corner = ScreenProbeCorner(probe, weight);
90
+ }
91
+ }
92
+
93
+ return corner;
94
+ }
95
+
96
+ fn screen_probe_interpolate(pixel: vec2<u32>, offset: vec2<f32>, position: vec3<f32>, depth: f32, normal: vec3<f32>) -> ScreenProbeSample {
97
+ let frame = screen_probe_frame;
98
+ let shift = vec2<u32>(frame.downsample_shift);
99
+ let tiles = frame.tile_count;
100
+ let last = tiles - 1u;
101
+
102
+ // the lookup on the uniform grid: the pixel less the probes' place in their tiles, held between the outermost probes
103
+ let lookup = clamp(vec2<f32>(pixel) - vec2<f32>(frame.jitter) + offset, vec2<f32>(0.0), vec2<f32>(last << shift));
104
+ let coord = vec2<u32>(lookup);
105
+ let tile00 = min(coord >> shift, max(tiles, vec2<u32>(2u)) - 2u);
106
+
107
+ let span = f32(1u << frame.downsample_shift);
108
+ let b = (vec2<f32>(coord - (tile00 << shift)) + 1.0) / (span + 2.0);
109
+ let plane = vec4<f32>(normal, dot(normal, position));
110
+
111
+ let c00 = screen_probe_corner(tile00, (1.0 - b.x) * (1.0 - b.y), pixel, plane, depth);
112
+ let c10 = screen_probe_corner(min(tile00 + vec2<u32>(1u, 0u), last), b.x * (1.0 - b.y), pixel, plane, depth);
113
+ let c01 = screen_probe_corner(min(tile00 + vec2<u32>(0u, 1u), last), (1.0 - b.x) * b.y, pixel, plane, depth);
114
+ let c11 = screen_probe_corner(min(tile00 + vec2<u32>(1u, 1u), last), b.x * b.y, pixel, plane, depth);
115
+
116
+ return ScreenProbeSample(
117
+ vec4<u32>(c00.probe, c10.probe, c01.probe, c11.probe),
118
+ vec4<f32>(c00.weight, c10.weight, c01.weight, c11.weight),
119
+ );
120
+ }
121
+ `, [
122
+ chunk_screen_probe,
123
+ ]);
124
+
125
+ chunk_screen_probe_interpolate.requireResource(SCREEN_PROBES_READ_RESOURCE);
126
+ chunk_screen_probe_interpolate.requireResource(SCREEN_PROBE_TILE_PROBES_READ_RESOURCE);
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Last frame's probes a probe's lighting density takes its history from (Lumen's `PROBE_RADIANCE_HISTORY`):
3
+ *
4
+ * ```wgsl
5
+ * const SCREEN_PROBE_HISTORY_NONE = 0xFFFFFFFFu;
6
+ * fn screen_probe_lighting_history(record: ScreenProbe) -> vec4<u32> // last frame's grid, y · previous_tile_count.x + x
7
+ * ```
8
+ *
9
+ * Where the probe's surface point stood last frame (`screen_probe_point_before`: the velocity buffer, the surface's
10
+ * own motion with the camera's, as Lumen's `GetHistoryScreenPosition`); last frame's four uniform probes around its
11
+ * place then, on last frame's grid and jitter, in the order (0, 0), (1, 0), (0, 1), (1, 1). Each that stood on the
12
+ * plane the surface stood in then, through that point, its plane weight past `SCREEN_PROBE_BRDF_PIXEL_WEIGHT` of the
13
+ * depth then, is its place in last frame's grid; any other, and all four where there is no history or the point was
14
+ * off last frame's screen, is `SCREEN_PROBE_HISTORY_NONE`. Lumen weighs them against this frame's plane here, and
15
+ * against last frame's in its temporal filter; last frame's keeps the history of a surface moving along its normal.
16
+ *
17
+ * @type {CodeChunk}
18
+ */
19
+ export const chunk_screen_probe_lighting_history: CodeChunk;
20
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
21
+ //# sourceMappingURL=chunk_screen_probe_lighting_history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_lighting_history.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;GAiBG;AACH,kDAFU,SAAS,CAiDZ;0BAtEmB,oCAAoC"}
@@ -0,0 +1,74 @@
1
+ import { chunk_uv_octahedral_unit_decode } from "../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
2
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
+ import { chunk_screen_probe, SCREEN_PROBES_PREVIOUS_RESOURCE } from "./chunk_screen_probe.js";
4
+ import { chunk_screen_probe_point_before } from "./chunk_screen_probe_surface.js";
5
+ import { SCREEN_PROBE_BRDF_PIXEL_WEIGHT } from "./SCREEN_PROBE.js";
6
+
7
+ /**
8
+ * Last frame's probes a probe's lighting density takes its history from (Lumen's `PROBE_RADIANCE_HISTORY`):
9
+ *
10
+ * ```wgsl
11
+ * const SCREEN_PROBE_HISTORY_NONE = 0xFFFFFFFFu;
12
+ * fn screen_probe_lighting_history(record: ScreenProbe) -> vec4<u32> // last frame's grid, y · previous_tile_count.x + x
13
+ * ```
14
+ *
15
+ * Where the probe's surface point stood last frame (`screen_probe_point_before`: the velocity buffer, the surface's
16
+ * own motion with the camera's, as Lumen's `GetHistoryScreenPosition`); last frame's four uniform probes around its
17
+ * place then, on last frame's grid and jitter, in the order (0, 0), (1, 0), (0, 1), (1, 1). Each that stood on the
18
+ * plane the surface stood in then, through that point, its plane weight past `SCREEN_PROBE_BRDF_PIXEL_WEIGHT` of the
19
+ * depth then, is its place in last frame's grid; any other, and all four where there is no history or the point was
20
+ * off last frame's screen, is `SCREEN_PROBE_HISTORY_NONE`. Lumen weighs them against this frame's plane here, and
21
+ * against last frame's in its temporal filter; last frame's keeps the history of a surface moving along its normal.
22
+ *
23
+ * @type {CodeChunk}
24
+ */
25
+ export const chunk_screen_probe_lighting_history = CodeChunk.from(
26
+ //language=WGSL
27
+ `
28
+ const SCREEN_PROBE_HISTORY_NONE = 0xFFFFFFFFu;
29
+
30
+ fn screen_probe_lighting_history_probe(tile: vec2<i32>, plane: vec4<f32>, depth: f32) -> u32 {
31
+ let frame = screen_probe_frame;
32
+ let clamped = vec2<u32>(clamp(tile, vec2<i32>(0), vec2<i32>(frame.previous_tile_count) - 1));
33
+ let index = clamped.y * frame.previous_tile_count.x + clamped.x;
34
+ let previous = screen_probes_previous[index];
35
+
36
+ if (previous.depth <= 0.0 || screen_probe_plane_weight(plane, previous.position, depth) <= ${SCREEN_PROBE_BRDF_PIXEL_WEIGHT}) {
37
+ return SCREEN_PROBE_HISTORY_NONE;
38
+ }
39
+
40
+ return index;
41
+ }
42
+
43
+ fn screen_probe_lighting_history(record: ScreenProbe) -> vec4<u32> {
44
+ let frame = screen_probe_frame;
45
+
46
+ if (frame.history == 0u) {
47
+ return vec4<u32>(SCREEN_PROBE_HISTORY_NONE);
48
+ }
49
+
50
+ let before = screen_probe_point_before(screen_probe_pixel_decode(record.pixel), record.depth);
51
+
52
+ if (any(before.place < vec2<f32>(0.0)) || any(before.place > vec2<f32>(frame.view_size)) || before.depth <= 0.0) {
53
+ return vec4<u32>(SCREEN_PROBE_HISTORY_NONE);
54
+ }
55
+
56
+ let normal = uv_octahedral_unit_decode(unpack2x16unorm(record.normal));
57
+ let plane = vec4<f32>(normal, dot(normal, before.position));
58
+ let tile = (before.place - vec2<f32>(frame.previous_jitter)) / f32(1u << frame.downsample_shift);
59
+ let t0 = vec2<i32>(floor(tile));
60
+
61
+ return vec4<u32>(
62
+ screen_probe_lighting_history_probe(t0, plane, before.depth),
63
+ screen_probe_lighting_history_probe(t0 + vec2<i32>(1, 0), plane, before.depth),
64
+ screen_probe_lighting_history_probe(t0 + vec2<i32>(0, 1), plane, before.depth),
65
+ screen_probe_lighting_history_probe(t0 + vec2<i32>(1, 1), plane, before.depth),
66
+ );
67
+ }
68
+ `, [
69
+ chunk_screen_probe,
70
+ chunk_screen_probe_point_before,
71
+ chunk_uv_octahedral_unit_decode,
72
+ ]);
73
+
74
+ chunk_screen_probe_lighting_history.requireResource(SCREEN_PROBES_PREVIOUS_RESOURCE);
@@ -0,0 +1,20 @@
1
+ /**
2
+ * How far along its ray a screen trace got, in metres, from its place on the segment it marched in screen space:
3
+ *
4
+ * ```wgsl
5
+ * fn screen_probe_march_distance(t: f32, segment: f32, w_start: f32, w_end: f32) -> f32
6
+ * ```
7
+ *
8
+ * `t` is the place, 0 at the segment's start and 1 at its end, `segment` the segment's length in metres, `w_start` and
9
+ * `w_end` the clip-space w of its two ends, both positive.
10
+ *
11
+ * Screen space is the segment's perspective projection, along which 1/w runs evenly and metres do not: the point s
12
+ * metres along projects to `t = (s / w(s)) / (segment / w_end)`, so `s = segment·t·w_start / (t·w_start + (1 − t)·w_end)`.
13
+ * A ray receding from the camera is further along on the screen than in metres, one approaching it less. The
14
+ * denominator is at least the smaller w.
15
+ *
16
+ * @type {CodeChunk}
17
+ */
18
+ export const chunk_screen_probe_march_distance: CodeChunk;
19
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
20
+ //# sourceMappingURL=chunk_screen_probe_march_distance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_march_distance.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,gDAFU,SAAS,CAQhB;0BAzBuB,oCAAoC"}
@@ -0,0 +1,26 @@
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+
3
+ /**
4
+ * How far along its ray a screen trace got, in metres, from its place on the segment it marched in screen space:
5
+ *
6
+ * ```wgsl
7
+ * fn screen_probe_march_distance(t: f32, segment: f32, w_start: f32, w_end: f32) -> f32
8
+ * ```
9
+ *
10
+ * `t` is the place, 0 at the segment's start and 1 at its end, `segment` the segment's length in metres, `w_start` and
11
+ * `w_end` the clip-space w of its two ends, both positive.
12
+ *
13
+ * Screen space is the segment's perspective projection, along which 1/w runs evenly and metres do not: the point s
14
+ * metres along projects to `t = (s / w(s)) / (segment / w_end)`, so `s = segment·t·w_start / (t·w_start + (1 − t)·w_end)`.
15
+ * A ray receding from the camera is further along on the screen than in metres, one approaching it less. The
16
+ * denominator is at least the smaller w.
17
+ *
18
+ * @type {CodeChunk}
19
+ */
20
+ export const chunk_screen_probe_march_distance = CodeChunk.from(
21
+ //language=WGSL
22
+ `
23
+ fn screen_probe_march_distance(t: f32, segment: f32, w_start: f32, w_end: f32) -> f32 {
24
+ return segment * t * w_start / (t * w_start + (1.0 - t) * w_end);
25
+ }
26
+ `);
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A probe's rays in the order the reassignment takes them, sorted in the workgroup's memory:
3
+ *
4
+ * ```wgsl
5
+ * var<workgroup> screen_probe_sort: array<vec2<u32>, 2 · 16²> // (info, key): the rays, then the sorted ones
6
+ * fn screen_probe_ray_sort(lane: u32, lanes: u32, count: u32) // the first count sorted, then copied after them
7
+ * ```
8
+ *
9
+ * - **The order**: ascending by key, then by info (`sort_pair_less`). The caller's key is the density's bits, which
10
+ * order as the density does once it is held off −0; a level-one ray's info orders as its texel's index, so ties fall
11
+ * in index order and the order is total.
12
+ * - **The sort**: the engine's bitonic network (`sort_bitonic_comparator`), in place over the first `count`, a power of
13
+ * two (the probe's n²): each of its log₂count·(log₂count + 1)/2 steps is `count / 2` comparators shared by the `lanes`
14
+ * lanes from the caller's `lane`, with a barrier after it. `sort_bitonic_workgroup` runs the same network over the
15
+ * radix sort's 256-thread tiles; this is its loop at any workgroup's width. The sorted rays are then copied to
16
+ * `[count, 2·count)`, where the reassignment builds the probe's rays.
17
+ * - Every lane of the workgroup calls it, from uniform control flow, with the same `lanes` and `count`; the rays stand
18
+ * in the first `count` before the call, and a barrier has passed since they were written.
19
+ *
20
+ * @type {CodeChunk}
21
+ */
22
+ export const chunk_screen_probe_ray_sort: CodeChunk;
23
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
24
+ //# sourceMappingURL=chunk_screen_probe_ray_sort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_ray_sort.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,0CAFU,SAAS,CAiCZ;0BAvDmB,oCAAoC"}
@@ -0,0 +1,57 @@
1
+ import { chunk_sort_bitonic_comparator } from "../../gpu_primitive/sort/chunk_sort_bitonic_comparator.js";
2
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
+ import { SCREEN_PROBE_OCTAHEDRON_LIMIT } from "./SCREEN_PROBE.js";
4
+
5
+ /**
6
+ * A probe's rays in the order the reassignment takes them, sorted in the workgroup's memory:
7
+ *
8
+ * ```wgsl
9
+ * var<workgroup> screen_probe_sort: array<vec2<u32>, 2 · 16²> // (info, key): the rays, then the sorted ones
10
+ * fn screen_probe_ray_sort(lane: u32, lanes: u32, count: u32) // the first count sorted, then copied after them
11
+ * ```
12
+ *
13
+ * - **The order**: ascending by key, then by info (`sort_pair_less`). The caller's key is the density's bits, which
14
+ * order as the density does once it is held off −0; a level-one ray's info orders as its texel's index, so ties fall
15
+ * in index order and the order is total.
16
+ * - **The sort**: the engine's bitonic network (`sort_bitonic_comparator`), in place over the first `count`, a power of
17
+ * two (the probe's n²): each of its log₂count·(log₂count + 1)/2 steps is `count / 2` comparators shared by the `lanes`
18
+ * lanes from the caller's `lane`, with a barrier after it. `sort_bitonic_workgroup` runs the same network over the
19
+ * radix sort's 256-thread tiles; this is its loop at any workgroup's width. The sorted rays are then copied to
20
+ * `[count, 2·count)`, where the reassignment builds the probe's rays.
21
+ * - Every lane of the workgroup calls it, from uniform control flow, with the same `lanes` and `count`; the rays stand
22
+ * in the first `count` before the call, and a barrier has passed since they were written.
23
+ *
24
+ * @type {CodeChunk}
25
+ */
26
+ export const chunk_screen_probe_ray_sort = CodeChunk.from(
27
+ //language=WGSL
28
+ `
29
+ var<workgroup> screen_probe_sort: array<vec2<u32>, ${2 * SCREEN_PROBE_OCTAHEDRON_LIMIT * SCREEN_PROBE_OCTAHEDRON_LIMIT}>;
30
+
31
+ fn screen_probe_ray_sort(lane: u32, lanes: u32, count: u32) {
32
+ for (var block = 2u; block <= count; block <<= 1u) {
33
+ for (var stride = block >> 1u; stride > 0u; stride >>= 1u) {
34
+ for (var pair = lane; pair < (count >> 1u); pair += lanes) {
35
+ let slots = sort_bitonic_comparator(pair, block, stride);
36
+ let low = screen_probe_sort[slots.x];
37
+ let high = screen_probe_sort[slots.y];
38
+
39
+ if (sort_pair_less(high.y, high.x, low.y, low.x)) {
40
+ screen_probe_sort[slots.x] = high;
41
+ screen_probe_sort[slots.y] = low;
42
+ }
43
+ }
44
+
45
+ workgroupBarrier();
46
+ }
47
+ }
48
+
49
+ for (var t = lane; t < count; t += lanes) {
50
+ screen_probe_sort[count + t] = screen_probe_sort[t];
51
+ }
52
+
53
+ workgroupBarrier();
54
+ }
55
+ `, [
56
+ chunk_sort_bitonic_comparator,
57
+ ]);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A screen trace's march through the depth buffer's hierarchy, and whether it stopped on a surface:
3
+ *
4
+ * ```wgsl
5
+ * struct ScreenProbeScreenMarch { reached: vec3<f32>, t: f32, hit: bool }
6
+ * fn screen_probe_screen_march(start: vec3<f32>, span: vec3<f32>, size: vec2<f32>) -> ScreenProbeScreenMarch
7
+ * ```
8
+ *
9
+ * `start` is the segment's start and `span` its run to the end, in UV and device depth; `size` is the view's pixels.
10
+ * The march is `ffx_sssr_hierarchical_raymarch` from the full-resolution level, `SCREEN_PROBE_SCREEN_TRACE_STEPS`
11
+ * steps at most. `reached` is where it stopped, `t` its place on the segment held to [0, 1].
12
+ *
13
+ * `hit` is whether it converged, short of the segment's end: went below the full-resolution level's surface, Lumen's
14
+ * `MipLevel < BaseMipLevel`. A march that spent its steps, left the screen or reached the sky stopped where it was,
15
+ * on no surface, though the march's `valid_hit` reports one that did so on the full-resolution level; one converging
16
+ * on its very last step is taken for one that spent them, and left to what traces the ray on.
17
+ *
18
+ * @type {CodeChunk}
19
+ */
20
+ export const chunk_screen_probe_screen_march: CodeChunk;
21
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
22
+ //# sourceMappingURL=chunk_screen_probe_screen_march.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_screen_march.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;GAkBG;AACH,8CAFU,SAAS,CA4BZ;0BAhDmB,oCAAoC"}
@@ -0,0 +1,53 @@
1
+ import { chunk_is_background } from "../../shader/chunk/depth/chunk_is_background.js";
2
+ import {
3
+ chunk_ffx_sssr_hierarchical_raymarch
4
+ } from "../../shader/chunk/screen_space/chunk_ffx_sssr_hierarchical_raymarch.js";
5
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
6
+ import { SCREEN_PROBE_SCREEN_TRACE_STEPS } from "./SCREEN_PROBE.js";
7
+
8
+ /**
9
+ * A screen trace's march through the depth buffer's hierarchy, and whether it stopped on a surface:
10
+ *
11
+ * ```wgsl
12
+ * struct ScreenProbeScreenMarch { reached: vec3<f32>, t: f32, hit: bool }
13
+ * fn screen_probe_screen_march(start: vec3<f32>, span: vec3<f32>, size: vec2<f32>) -> ScreenProbeScreenMarch
14
+ * ```
15
+ *
16
+ * `start` is the segment's start and `span` its run to the end, in UV and device depth; `size` is the view's pixels.
17
+ * The march is `ffx_sssr_hierarchical_raymarch` from the full-resolution level, `SCREEN_PROBE_SCREEN_TRACE_STEPS`
18
+ * steps at most. `reached` is where it stopped, `t` its place on the segment held to [0, 1].
19
+ *
20
+ * `hit` is whether it converged, short of the segment's end: went below the full-resolution level's surface, Lumen's
21
+ * `MipLevel < BaseMipLevel`. A march that spent its steps, left the screen or reached the sky stopped where it was,
22
+ * on no surface, though the march's `valid_hit` reports one that did so on the full-resolution level; one converging
23
+ * on its very last step is taken for one that spent them, and left to what traces the ray on.
24
+ *
25
+ * @type {CodeChunk}
26
+ */
27
+ export const chunk_screen_probe_screen_march = CodeChunk.from(
28
+ //language=WGSL
29
+ `
30
+ struct ScreenProbeScreenMarch {
31
+ reached: vec3<f32>,
32
+ t: f32,
33
+ hit: bool,
34
+ }
35
+
36
+ fn screen_probe_screen_march(start: vec3<f32>, span: vec3<f32>, size: vec2<f32>) -> ScreenProbeScreenMarch {
37
+ var converged: bool;
38
+ var steps: u32;
39
+
40
+ let reached = ffx_sssr_hierarchical_raymarch(start, span, size, 0, ${SCREEN_PROBE_SCREEN_TRACE_STEPS}u, &converged, &steps);
41
+
42
+ // the march's place along the segment, 1 at its end
43
+ let t = saturate(dot(reached - start, span) / max(dot(span, span), 1e-20));
44
+
45
+ let on_screen = all(reached.xy >= vec2<f32>(0.0)) && all(reached.xy <= vec2<f32>(1.0));
46
+ let hit = converged && steps < ${SCREEN_PROBE_SCREEN_TRACE_STEPS}u && on_screen && !is_background(reached.z) && t < 1.0;
47
+
48
+ return ScreenProbeScreenMarch(reached, t, hit);
49
+ }
50
+ `, [
51
+ chunk_ffx_sssr_hierarchical_raymarch,
52
+ chunk_is_background,
53
+ ]);
@@ -0,0 +1,62 @@
1
+ /** The view's camera this frame. @type {ShaderResourceDescriptor} */
2
+ export const SCREEN_PROBE_CAMERA_RESOURCE: ShaderResourceDescriptor;
3
+ /** The view's camera last frame. @type {ShaderResourceDescriptor} */
4
+ export const SCREEN_PROBE_CAMERA_PREVIOUS_RESOURCE: ShaderResourceDescriptor;
5
+ /** The frame's reverse-Z depth. @type {ShaderResourceDescriptor} */
6
+ export const SCREEN_PROBE_DEPTH_RESOURCE: ShaderResourceDescriptor;
7
+ /** The G-buffer's PBR target, for the face normal it holds. @type {ShaderResourceDescriptor} */
8
+ export const SCREEN_PROBE_PBR_RESOURCE: ShaderResourceDescriptor;
9
+ /** The frame's motion, `VELOCITY_FORMAT`: internal pixels from last frame's place to this one's, and the view depth moved through. @type {ShaderResourceDescriptor} */
10
+ export const SCREEN_PROBE_VELOCITY_RESOURCE: ShaderResourceDescriptor;
11
+ /**
12
+ * Where a pixel's surface point stood last frame, by the velocity buffer:
13
+ *
14
+ * ```wgsl
15
+ * struct ScreenProbePointBefore { place: vec2<f32>, depth: f32, position: vec3<f32> }
16
+ * fn screen_probe_point_before(pixel: vec2<u32>, depth: f32) -> ScreenProbePointBefore // depth: its view depth now
17
+ * ```
18
+ *
19
+ * - `place`: its place on last frame's screen, internal pixels: the pixel's centre less its motion across the view;
20
+ * - `depth`: its view depth then, its depth now less the depth it moved through;
21
+ * - `position`: the world point those show through last frame's camera, where the point stood.
22
+ *
23
+ * The camera's motion and the surface's own together, as the velocity buffer holds them; up to the jitter between
24
+ * the two frames' projections. Off last frame's screen, or with no depth then, `position` means nothing.
25
+ *
26
+ * @type {CodeChunk}
27
+ */
28
+ export const chunk_screen_probe_point_before: CodeChunk;
29
+ /**
30
+ * How fast a pixel's surface point moves of itself, apart from the camera (Lumen's probe and hit world velocity, as a
31
+ * length):
32
+ *
33
+ * ```wgsl
34
+ * fn screen_probe_object_speed(pixel: vec2<u32>, position: vec3<f32>, depth: f32) -> f32 // metres a frame
35
+ * ```
36
+ *
37
+ * The velocity buffer holds a pixel's motion since last frame, the camera's and the surface's own together: the
38
+ * point's place on last frame's screen and its view depth then. Last frame's camera takes those back to the world,
39
+ * where the point stood a frame ago; how far that is from where it stands now is its own motion, across the view and
40
+ * along it. A still surface reads zero under any camera motion, up to the jitter between the two frames' projections.
41
+ *
42
+ * @type {CodeChunk}
43
+ */
44
+ export const chunk_screen_probe_object_speed: CodeChunk;
45
+ /**
46
+ * The record of a probe standing on a pixel of the G-buffer (Lumen's `GetScreenProbeMaterial` and
47
+ * `WriteDownsampledProbeMaterial`):
48
+ *
49
+ * ```wgsl
50
+ * fn screen_probe_surface_at(pixel: vec2<u32>) -> ScreenProbe
51
+ * ```
52
+ *
53
+ * The pixel's surface point from its depth at its centre, its view depth, the face normal of the triangle it shows
54
+ * (the plane, where the shading normal would carry the normal map), and its own speed
55
+ * (`screen_probe_object_speed`). A pixel of the sky gives a record of depth zero: no probe.
56
+ *
57
+ * @type {CodeChunk}
58
+ */
59
+ export const chunk_screen_probe_surface: CodeChunk;
60
+ import { ShaderResourceDescriptor } from "../../shader/resource/ShaderResourceDescriptor.js";
61
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
62
+ //# sourceMappingURL=chunk_screen_probe_surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_screen_probe_surface.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js"],"names":[],"mappings":"AAeA,qEAAqE;AACrE,2CADyC,wBAAwB,CAC6C;AAE9G,qEAAqE;AACrE,oDADyC,wBAAwB,CAC+D;AAEhI,oEAAoE;AACpE,0CADwC,wBAAwB,CACsB;AAEtF,gGAAgG;AAChG,wCADoE,wBAAwB,CACV;AAElF,uKAAuK;AACvK,6CAD2I,wBAAwB,CACvE;AAE5F;;;;;;;;;;;;;;;;GAgBG;AACH,8CAFU,SAAS,CA8BZ;AAKP;;;;;;;;;;;;;;GAcG;AACH,8CAFU,SAAS,CAUZ;AAEP;;;;;;;;;;;;;GAaG;AACH,yCAFU,SAAS,CAkCZ;yCA3IkC,mDAAmD;0BADlE,oCAAoC"}