@woosh/meep-engine 3.67.0 → 3.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/package.json +1 -1
  2. package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
  3. package/src/engine/graphics3/GraphicsEngine.js +4 -9
  4. package/src/engine/graphics3/load_cube_environment.js +3 -3
  5. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  6. package/src/shade/playground/probe_clipmap/index.html +43 -0
  7. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  8. package/src/shade/playground/probe_clipmap/main.js +29 -0
  9. package/src/shade/renderer/Renderer.d.ts +7 -0
  10. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  11. package/src/shade/renderer/Renderer.js +213 -15
  12. package/src/shade/renderer/ShadeIndirectLightingMode.d.ts +1 -0
  13. package/src/shade/renderer/ShadeIndirectLightingMode.js +9 -0
  14. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +22 -0
  15. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +1 -0
  16. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js +160 -0
  17. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts +45 -0
  18. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts.map +1 -0
  19. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.js +57 -0
  20. package/src/shade/renderer/atmosphere/GPUSky.d.ts +23 -8
  21. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  22. package/src/shade/renderer/atmosphere/GPUSky.js +91 -34
  23. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts +17 -0
  24. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts.map +1 -1
  25. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.js +55 -25
  26. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts +164 -0
  27. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts.map +1 -0
  28. package/src/shade/renderer/atmosphere/SceneAtmosphere.js +308 -0
  29. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts +3 -12
  30. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts.map +1 -1
  31. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.js +52 -89
  32. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts +14 -0
  33. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts.map +1 -0
  34. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.js +103 -0
  35. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts +10 -4
  36. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts.map +1 -1
  37. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js +95 -57
  38. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts +10 -14
  39. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts.map +1 -1
  40. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js +97 -69
  41. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts +17 -0
  42. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts.map +1 -1
  43. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.js +117 -48
  44. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts +8 -0
  45. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts.map +1 -1
  46. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.js +65 -35
  47. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts +2 -1
  48. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts.map +1 -1
  49. package/src/shade/renderer/atmosphere/compute_mie_absorption.js +6 -6
  50. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts +41 -0
  51. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts.map +1 -0
  52. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.js +123 -0
  53. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
  54. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +21 -64
  55. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts +6 -2
  56. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
  57. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +55 -179
  58. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts +7 -0
  59. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts.map +1 -0
  60. package/src/shade/renderer/atmosphere/shader_sky_view_lut.js +111 -0
  61. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts +0 -1
  62. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts.map +1 -1
  63. package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +68 -79
  64. package/src/shade/renderer/deferred/shader_background.js +1 -1
  65. package/src/shade/renderer/deferred/shader_background_sky.d.ts +5 -0
  66. package/src/shade/renderer/deferred/shader_background_sky.d.ts.map +1 -0
  67. package/src/shade/renderer/deferred/shader_background_sky.js +130 -0
  68. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +2 -1
  69. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -1
  70. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +6 -2
  71. package/src/shade/renderer/extension/ViewTextures.d.ts +3 -2
  72. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  73. package/src/shade/renderer/extension/ViewTextures.js +3 -2
  74. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  75. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  76. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  77. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  78. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  79. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +1 -1
  80. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +20 -1
  81. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  82. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +29 -0
  83. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts +47 -0
  84. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts.map +1 -0
  85. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js +246 -0
  86. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +4 -15
  87. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  88. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +8 -148
  89. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +4 -9
  90. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  91. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +9 -58
  92. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +142 -0
  93. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -0
  94. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +938 -0
  95. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +192 -0
  96. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -0
  97. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +231 -0
  98. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +11 -0
  99. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts.map +1 -0
  100. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +25 -0
  101. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +110 -0
  102. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -0
  103. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +197 -0
  104. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +150 -0
  105. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -0
  106. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +408 -0
  107. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +23 -0
  108. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts.map +1 -0
  109. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +63 -0
  110. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts +24 -0
  111. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts.map +1 -0
  112. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.js +61 -0
  113. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +39 -0
  114. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -0
  115. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +126 -0
  116. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +21 -0
  117. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts.map +1 -0
  118. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +74 -0
  119. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts +20 -0
  120. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts.map +1 -0
  121. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.js +26 -0
  122. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts +24 -0
  123. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts.map +1 -0
  124. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.js +57 -0
  125. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +22 -0
  126. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts.map +1 -0
  127. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +53 -0
  128. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +62 -0
  129. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -0
  130. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +156 -0
  131. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts +18 -0
  132. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts.map +1 -0
  133. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.js +50 -0
  134. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +21 -0
  135. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -0
  136. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +54 -0
  137. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +67 -0
  138. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -0
  139. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +509 -0
  140. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts +20 -0
  141. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts.map +1 -0
  142. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.js +128 -0
  143. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +62 -0
  144. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -0
  145. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +478 -0
  146. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +69 -0
  147. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -0
  148. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +457 -0
  149. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +27 -0
  150. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -0
  151. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +219 -0
  152. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +22 -0
  153. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts.map +1 -0
  154. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +151 -0
  155. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +66 -0
  156. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts.map +1 -0
  157. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +301 -0
  158. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +59 -0
  159. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -0
  160. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +364 -0
  161. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +40 -0
  162. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -0
  163. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +275 -0
  164. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -1
  165. package/src/shade/renderer/grass/blade/GPUGrassBlades.js +17 -2
  166. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +18 -8
  167. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -1
  168. package/src/shade/renderer/grass/blade/grass_blade_resolve.js +114 -32
  169. package/src/shade/renderer/light/GPULightCollection.d.ts +1 -1
  170. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  171. package/src/shade/renderer/light/GPULightCollection.js +213 -80
  172. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.d.ts +1 -2
  173. package/src/shade/renderer/light/environment/chunk_sample_environment_color.d.ts.map +1 -0
  174. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.js +3 -4
  175. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  176. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -1
  177. package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js +1 -1
  178. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +1 -1
  179. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +1 -1
  180. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +1 -1
  181. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +1 -1
  182. package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.js +1 -1
  183. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  184. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +2 -0
  185. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +2 -0
  186. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +6 -0
  187. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
  188. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +9 -1
  189. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.d.ts.map +1 -1
  190. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.js +4 -3
  191. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts +17 -0
  192. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts.map +1 -0
  193. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.js +16 -0
  194. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts +21 -0
  195. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts.map +1 -0
  196. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.js +30 -0
  197. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -5
  198. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  199. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +19 -17
  200. package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.js +2 -0
  201. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  202. package/src/shade/renderer/scene/GPUSceneContext.js +2 -1
  203. package/src/shade/renderer/scene/Scene.d.ts +9 -2
  204. package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
  205. package/src/shade/renderer/scene/Scene.js +10 -2
  206. package/src/shade/renderer/shader/ImageShader.d.ts +24 -12
  207. package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
  208. package/src/shade/renderer/shader/ImageShader.js +11 -8
  209. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts +3 -1
  210. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts.map +1 -1
  211. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js +11 -3
  212. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts +2 -11
  213. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts.map +1 -1
  214. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js +23 -32
  215. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts +6 -0
  216. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts.map +1 -1
  217. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js +14 -2
  218. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.d.ts.map +1 -1
  219. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js +4 -2
  220. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.d.ts.map +1 -1
  221. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js +11 -3
  222. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts.map +1 -1
  223. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js +68 -69
  224. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts +4 -1
  225. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts.map +1 -1
  226. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js +46 -39
  227. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.d.ts.map +1 -1
  228. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js +5 -3
  229. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +18 -10
  230. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -1
  231. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +30 -27
  232. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts +14 -0
  233. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts.map +1 -0
  234. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.js +30 -0
  235. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts +21 -0
  236. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts.map +1 -0
  237. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js +60 -0
  238. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.d.ts → io/chunk_light_get_sun.d.ts} +3 -6
  239. package/src/shade/renderer/shader/chunk/light/io/chunk_light_get_sun.d.ts.map +1 -0
  240. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.js → io/chunk_light_get_sun.js} +6 -26
  241. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.js +1 -1
  242. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +3 -1
  243. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  244. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -2
  245. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  246. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +743 -739
  247. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +2 -0
  248. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  249. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +19 -17
  250. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
  251. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +5 -3
  252. package/src/shade/renderer/water/chunk_water_gi.js +2 -0
  253. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  254. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  255. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts +0 -2
  256. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +0 -1
  257. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +0 -45
  258. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts +0 -2
  259. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +0 -1
  260. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +0 -17
  261. package/src/engine/graphics/sh3/sky/hosek/README.md +0 -4
  262. package/src/engine/graphics/sh3/sky/hosek/data.d.ts +0 -17
  263. package/src/engine/graphics/sh3/sky/hosek/data.d.ts.map +0 -1
  264. package/src/engine/graphics/sh3/sky/hosek/data.js +0 -3744
  265. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts +0 -2
  266. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts.map +0 -1
  267. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +0 -71
  268. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts +0 -26
  269. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts.map +0 -1
  270. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.js +0 -70
  271. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +0 -22
  272. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +0 -1
  273. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +0 -388
  274. package/src/engine/graphics3/make_default_environment.d.ts +0 -15
  275. package/src/engine/graphics3/make_default_environment.d.ts.map +0 -1
  276. package/src/engine/graphics3/make_default_environment.js +0 -111
  277. package/src/shade/renderer/atmosphere/MIE_G.d.ts +0 -6
  278. package/src/shade/renderer/atmosphere/MIE_G.d.ts.map +0 -1
  279. package/src/shade/renderer/atmosphere/MIE_G.js +0 -5
  280. package/src/shade/renderer/atmosphere/chunk_sample_environment_color.d.ts.map +0 -1
  281. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts +0 -4
  282. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts.map +0 -1
  283. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.js +0 -44
  284. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +0 -2
  285. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +0 -1
  286. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.js +0 -43
  287. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts +0 -3
  288. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts.map +0 -1
  289. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.js +0 -6
  290. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts +0 -3
  291. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts.map +0 -1
  292. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.js +0 -18
  293. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts +0 -14
  294. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts.map +0 -1
  295. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.js +0 -86
  296. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts +0 -8
  297. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts.map +0 -1
  298. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.js +0 -125
  299. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts +0 -3
  300. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts.map +0 -1
  301. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.js +0 -17
  302. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts +0 -3
  303. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts.map +0 -1
  304. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.js +0 -38
  305. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts +0 -16
  306. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts.map +0 -1
  307. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.js +0 -28
  308. package/src/shade/renderer/shader/chunk/light/sky/chunk_sample_sky_color.d.ts.map +0 -1
  309. package/src/shade/renderer/view/GPUViewSkyContext.d.ts +0 -26
  310. package/src/shade/renderer/view/GPUViewSkyContext.d.ts.map +0 -1
  311. package/src/shade/renderer/view/GPUViewSkyContext.js +0 -170
@@ -0,0 +1,111 @@
1
+ import { CAMERA_UNIFORM_STRUCT } from "../camera/CAMERA_UNIFORM_STRUCT.js";
2
+ import { chunk_mat4_extract_position } from "../shader/chunk/geometry/mat4/chunk_mat4_extract_position.js";
3
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
4
+ import { ImageShader } from "../shader/ImageShader.js";
5
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
6
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
7
+ import { u32, vec3f } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
8
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
9
+ import { ATMOSPHERE_PARAMETERS_STRUCT } from "./ATMOSPHERE_PARAMETERS_STRUCT.js";
10
+ import { chunk_raymarch_sky_scattering } from "./chunk_raymarch_sky_scattering.js";
11
+ import { chunk_sky_irradiance_lut_encode_uv } from "./chunk_sky_irradiance_lut_encode_uv.js";
12
+ import {
13
+ SKY_LUT_MULTISCATTER_RESOURCE,
14
+ SKY_LUT_SAMPLER_RESOURCE,
15
+ SKY_LUT_TRANSMITTANCE_RESOURCE
16
+ } from "./SAMPLER_SKY_LUT.js";
17
+
18
+ export const SKY_VIEW_LUT_WIDTH = 192;
19
+ export const SKY_VIEW_LUT_HEIGHT = 108;
20
+
21
+ export const SKY_VIEW_LUT_SETTINGS_STRUCT = WebGPUStruct.from({
22
+ sun_direction: vec3f,
23
+ resolution_x: u32,
24
+ sun_irradiance: vec3f,
25
+ resolution_y: u32,
26
+ }, "SkyViewLutSettings");
27
+
28
+ const resources = new ShaderResourceSetDescriptor();
29
+
30
+ resources.setImmediate("settings", SKY_VIEW_LUT_SETTINGS_STRUCT);
31
+
32
+ resources.createGroup()
33
+ .addUniform("camera", CAMERA_UNIFORM_STRUCT)
34
+ .addUniform("atmosphere", ATMOSPHERE_PARAMETERS_STRUCT)
35
+ .add(SKY_LUT_TRANSMITTANCE_RESOURCE)
36
+ .add(SKY_LUT_MULTISCATTER_RESOURCE)
37
+ .add(SKY_LUT_SAMPLER_RESOURCE);
38
+
39
+ /**
40
+ * Per-view $192 \times 108$ horizon-warped Sky-View LUT generator (Hillaire 2020, §5.3).
41
+ *
42
+ * Evaluates scattering in the camera's local planet-up frame where `up = +Y` and the sun lies in
43
+ * the `+X/+Y` half-plane, matching {@link chunk_sky_irradiance_lut_encode_uv}.
44
+ *
45
+ * @type {CodeChunk}
46
+ */
47
+ const body = CodeChunk.from(
48
+ //language=WGSL
49
+ `
50
+ @fragment
51
+ fn main(
52
+ @builtin(position) coord: vec4<f32>,
53
+ ) -> @location(0) vec4<f32> {
54
+ let sun_len_sq = dot(settings.sun_direction, settings.sun_direction);
55
+ if (sun_len_sq <= 1e-12 || all(settings.sun_irradiance <= vec3<f32>(0.0))) {
56
+ return vec4<f32>(0.0, 0.0, 0.0, 1.0);
57
+ }
58
+
59
+ let sun_dir_world = settings.sun_direction * inverseSqrt(sun_len_sq);
60
+
61
+ let view_pos = mat4_extract_position(camera.transform);
62
+ let view_rel_world = atmosphere_clamped_observer_relative(atmosphere, view_pos);
63
+ let observer_radius = length(view_rel_world);
64
+ let up_world = view_rel_world / observer_radius;
65
+
66
+ let resolution = vec2<f32>(f32(settings.resolution_x), f32(settings.resolution_y));
67
+ let decoded = sky_view_lut_decode_texel(
68
+ atmosphere.planet_radius,
69
+ observer_radius,
70
+ floor(coord.xy),
71
+ resolution
72
+ );
73
+
74
+ let sun_cos_zenith = clamp(dot(sun_dir_world, up_world), -1.0, 1.0);
75
+ let sun_sin_zenith = sqrt(max(1.0 - sun_cos_zenith * sun_cos_zenith, 0.0));
76
+ let sun_local = vec3<f32>(sun_sin_zenith, sun_cos_zenith, 0.0);
77
+
78
+ let view_rel_local = vec3<f32>(0.0, observer_radius, 0.0);
79
+ let bounds = atmosphere_ray_bounds_for(atmosphere, view_rel_local, decoded.ray_local);
80
+
81
+ let lum = raymarch_sky_scattering(
82
+ atmosphere,
83
+ view_rel_local,
84
+ decoded.ray_local,
85
+ sun_local,
86
+ bounds.t_max,
87
+ decoded.hits_ground && bounds.hits_ground
88
+ );
89
+
90
+ return vec4<f32>(lum * settings.sun_irradiance, 1.0);
91
+ }
92
+ `, [
93
+ chunk_mat4_extract_position,
94
+ chunk_sky_irradiance_lut_encode_uv,
95
+ chunk_raymarch_sky_scattering,
96
+ ]
97
+ );
98
+
99
+ export const shader_sky_view_lut = new ImageShader({
100
+ descriptor: ShaderDescriptor.from({
101
+ label: "Sky / sky-view LUT",
102
+ resources,
103
+ body,
104
+ }),
105
+ targets: [
106
+ {
107
+ label: "sky_view_lut",
108
+ format: "rgba16float",
109
+ }
110
+ ]
111
+ });
@@ -1,5 +1,4 @@
1
1
  /**
2
- * @see https://www.shadertoy.com/view/slSXRW
3
2
  * @type {ImageShader}
4
3
  */
5
4
  export const shader_transmittance_lut: ImageShader;
@@ -1 +1 @@
1
- {"version":3,"file":"shader_transmittance_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/shader_transmittance_lut.js"],"names":[],"mappings":"AAgEA;;;GAGG;AACH,uCAFU,WAAW,CAWlB;4BAtEyB,0BAA0B"}
1
+ {"version":3,"file":"shader_transmittance_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/shader_transmittance_lut.js"],"names":[],"mappings":"AAuDA;;GAEG;AACH,uCAFU,WAAW,CAWlB;4BAhEyB,0BAA0B"}
@@ -1,79 +1,68 @@
1
- import { u32, vec2u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
- import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
3
- import { ATMOSPHERE_HEIGHT_DECLARATION } from "../shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js";
4
- import { chunk_get_sun_transmittance } from "../shader/chunk/atmosphere/chunk_get_sun_transmittance.js";
5
- import { chunk_safe_acos } from "../shader/chunk/math/chunk_safe_acos.js";
6
- import { chunk_sky_lut_texel_to_unit } from "./chunk_sky_lut_texel_to_unit.js";
7
- import { CodeChunk } from "../shader/compiler/CodeChunk.js";
8
- import { ImageShader } from "../shader/ImageShader.js";
9
- import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
10
- import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
11
-
12
- const TRANSMITTANCE_LUT_SETTINGS_STRUCT = WebGPUStruct.from({
13
- // how many ray-marching steps to take per pixel of LUT, more steps = higher accuracy but lower performance
14
- steps: u32,
15
- // size of the target being written, which a fragment shader cannot ask for. Needed to
16
- // know which point of the parameter range each texel stands for -- see
17
- // chunk_sky_lut_texel_to_unit. Pass the dimensions of the texture actually being drawn
18
- // into: a mismatch silently skews the whole LUT.
19
- resolution: vec2u,
20
- });
21
-
22
- const resources = new ShaderResourceSetDescriptor();
23
-
24
- // per-pass, 16 bytes, read-only: immediate data rather than a uniform buffer
25
- resources.setImmediate("settings", TRANSMITTANCE_LUT_SETTINGS_STRUCT);
26
-
27
- /**
28
- * @see https://www.shadertoy.com/view/slSXRW
29
- * @type {CodeChunk}
30
- */
31
- const body = CodeChunk.from(
32
- //language=WGSL
33
- `
34
-
35
- @fragment
36
- fn main(
37
- @builtin(position) coord: vec4<f32>,
38
- ) -> @location(0) vec4<f32> {
39
-
40
- // coord.xy is the fragment centre, so flooring it gives this texel's index. The point of
41
- // each range the texel stands for then comes from sky_lut_texel_to_unit, whose inverse
42
- // sky_lut_uv every lookup goes through -- a generator that skipped it would write a LUT
43
- // addressed half a texel off at both ends.
44
- let unit = sky_lut_texel_to_unit(floor(coord.xy), vec2<f32>(settings.resolution));
45
-
46
- let sunCosTheta = 2.0*unit.x - 1.0;
47
- let sunTheta = safe_acos(sunCosTheta);
48
-
49
- let height = ATMOSPHERE_HEIGHT*unit.y;
50
-
51
- let pos = vec3(0.0, height, 0.0);
52
- let sunDir = normalize(vec3(0.0, sunCosTheta, -sin(sunTheta)));
53
-
54
- return vec4(get_sun_transmittance(pos, sunDir, f32(settings.steps)), 1.0);
55
-
56
- }
57
- `, [
58
- chunk_get_sun_transmittance,
59
- chunk_safe_acos,
60
- chunk_sky_lut_texel_to_unit,
61
- ATMOSPHERE_HEIGHT_DECLARATION,
62
- ]
63
- );
64
-
65
- /**
66
- * @see https://www.shadertoy.com/view/slSXRW
67
- * @type {ImageShader}
68
- */
69
- export const shader_transmittance_lut = new ImageShader({
70
- descriptor: ShaderDescriptor.from({
71
- label: "Sky / transmittance LUT",
72
- resources,
73
- body
74
- }),
75
- targets: [{
76
- format: "rgba16float",
77
- }]
78
- });
79
-
1
+ import { chunk_get_sun_transmittance } from "../shader/chunk/atmosphere/chunk_get_sun_transmittance.js";
2
+ import { chunk_safe_acos } from "../shader/chunk/math/chunk_safe_acos.js";
3
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
4
+ import { ImageShader } from "../shader/ImageShader.js";
5
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
6
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
7
+ import { u32, vec2u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
8
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
9
+ import { ATMOSPHERE_PARAMETERS_STRUCT } from "./ATMOSPHERE_PARAMETERS_STRUCT.js";
10
+ import { chunk_sky_lut_texel_to_unit } from "./chunk_sky_lut_texel_to_unit.js";
11
+
12
+ const TRANSMITTANCE_LUT_SETTINGS_STRUCT = WebGPUStruct.from({
13
+ steps: u32,
14
+ resolution: vec2u,
15
+ }, "TransmittanceLutSettings");
16
+
17
+ const resources = new ShaderResourceSetDescriptor();
18
+
19
+ resources.setImmediate("settings", TRANSMITTANCE_LUT_SETTINGS_STRUCT);
20
+ resources.createGroup()
21
+ .addUniform("atmosphere", ATMOSPHERE_PARAMETERS_STRUCT);
22
+
23
+ /**
24
+ * Transmittance LUT generator (`256×64` `rgba16float`), parameterised by `(sunCosTheta, altitude)`
25
+ * and driven by the scene's {@link ATMOSPHERE_PARAMETERS_STRUCT} uniform.
26
+ *
27
+ * @see "A Scalable and Production Ready Sky and Atmosphere Rendering Technique", Hillaire (2020)
28
+ * @type {CodeChunk}
29
+ */
30
+ const body = CodeChunk.from(
31
+ //language=WGSL
32
+ `
33
+ @fragment
34
+ fn main(
35
+ @builtin(position) coord: vec4<f32>,
36
+ ) -> @location(0) vec4<f32> {
37
+ let unit = sky_lut_texel_to_unit(floor(coord.xy), vec2<f32>(settings.resolution));
38
+
39
+ let sunCosTheta = 2.0 * unit.x - 1.0;
40
+ let sunTheta = safe_acos(sunCosTheta);
41
+
42
+ let height = atmosphere.atmosphere_height * unit.y;
43
+
44
+ let origin_rel = vec3<f32>(0.0, atmosphere.planet_radius + height, 0.0);
45
+ let sunDir = normalize(vec3<f32>(0.0, sunCosTheta, -sin(sunTheta)));
46
+
47
+ return vec4<f32>(get_sun_transmittance_rel_for(atmosphere, origin_rel, sunDir, f32(settings.steps)), 1.0);
48
+ }
49
+ `, [
50
+ chunk_get_sun_transmittance,
51
+ chunk_safe_acos,
52
+ chunk_sky_lut_texel_to_unit,
53
+ ]
54
+ );
55
+
56
+ /**
57
+ * @type {ImageShader}
58
+ */
59
+ export const shader_transmittance_lut = new ImageShader({
60
+ descriptor: ShaderDescriptor.from({
61
+ label: "Sky / transmittance LUT",
62
+ resources,
63
+ body
64
+ }),
65
+ targets: [{
66
+ format: "rgba16float",
67
+ }]
68
+ });
@@ -1,6 +1,6 @@
1
1
  import { SamplerDescriptor } from "../../descriptor/texture/SamplerDescriptor.js";
2
2
  import { CAMERA_UNIFORM_STRUCT } from "../camera/CAMERA_UNIFORM_STRUCT.js";
3
- import { chunk_sample_environment_color } from "../atmosphere/chunk_sample_environment_color.js";
3
+ import { chunk_sample_environment_color } from "../light/environment/chunk_sample_environment_color.js";
4
4
  import { chunk_uv_to_ndc } from "../shader/chunk/texture/chunk_uv_to_ndc.js";
5
5
  import { CodeChunk } from "../shader/compiler/CodeChunk.js";
6
6
  import { ImageShader } from "../shader/ImageShader.js";
@@ -0,0 +1,5 @@
1
+ export const SKY_BACKGROUND_SETTINGS_STRUCT: WebGPUStruct;
2
+ export const shader_background_sky: ImageShader;
3
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
4
+ import { ImageShader } from "../shader/ImageShader.js";
5
+ //# sourceMappingURL=shader_background_sky.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_background_sky.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/deferred/shader_background_sky.js"],"names":[],"mappings":"AAeA,0DAK4B;AA6F5B,gDAgBG;6BApH0B,gCAAgC;4BAJjC,0BAA0B"}
@@ -0,0 +1,130 @@
1
+ import { ATMOSPHERE_PARAMETERS_STRUCT } from "../atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js";
2
+ import { chunk_sample_transmittance_lut_params_for } from "../atmosphere/chunk_sample_transmittance_lut.js";
3
+ import { chunk_sky_irradiance_lut_encode_uv } from "../atmosphere/chunk_sky_irradiance_lut_encode_uv.js";
4
+ import { SKY_LUT_SAMPLER_RESOURCE, SKY_LUT_TRANSMITTANCE_RESOURCE } from "../atmosphere/SAMPLER_SKY_LUT.js";
5
+ import { CAMERA_UNIFORM_STRUCT } from "../camera/CAMERA_UNIFORM_STRUCT.js";
6
+ import { chunk_mat4_extract_position } from "../shader/chunk/geometry/mat4/chunk_mat4_extract_position.js";
7
+ import { PI_DECLARATION } from "../shader/chunk/math/PI_DECLARATION.js";
8
+ import { chunk_uv_to_ndc } from "../shader/chunk/texture/chunk_uv_to_ndc.js";
9
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
10
+ import { ImageShader } from "../shader/ImageShader.js";
11
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
12
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
13
+ import { f32, u32, vec3f } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
14
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
15
+
16
+ export const SKY_BACKGROUND_SETTINGS_STRUCT = WebGPUStruct.from({
17
+ sun_direction: vec3f,
18
+ sun_disk_radius: f32,
19
+ sun_irradiance: vec3f,
20
+ sun_has_disc: u32,
21
+ }, "SkyBackgroundSettings");
22
+
23
+ const resources = new ShaderResourceSetDescriptor();
24
+
25
+ resources.setImmediate("settings", SKY_BACKGROUND_SETTINGS_STRUCT);
26
+
27
+ resources.createGroup()
28
+ .addUniform("camera", CAMERA_UNIFORM_STRUCT)
29
+ .addUniform("atmosphere", ATMOSPHERE_PARAMETERS_STRUCT)
30
+ .addTexture("tSkyViewLut", "float")
31
+ .add(SKY_LUT_TRANSMITTANCE_RESOURCE)
32
+ .add(SKY_LUT_SAMPLER_RESOURCE);
33
+
34
+ /**
35
+ * Full-screen atmospheric sky background shader sampling Hillaire's $192 \times 108$ Sky-View LUT
36
+ * and compositing a transmittance-attenuated, limb-darkened solar disc when the ray misses the
37
+ * planet sphere.
38
+ *
39
+ * @type {CodeChunk}
40
+ */
41
+ const body = CodeChunk.from(
42
+ //language=WGSL
43
+ `
44
+ // Clamp pre-bloom f16 sky-disc radiance well inside rgba16float range (max 65504) to prevent Inf/NaN.
45
+ const MAX_SOLAR_DISC_RADIANCE = 16384.0;
46
+
47
+ @fragment
48
+ fn main(
49
+ @builtin(position) coord: vec4<f32>,
50
+ @location(0) uv: vec2<f32>,
51
+ ) -> @location(0) vec4<f32> {
52
+ let clip_pos = vec4<f32>(uv_to_ndc(uv), 0.0, 1.0);
53
+ let world_dir_h = camera.view_projection_matrix_inverse * clip_pos;
54
+ let view_direction = normalize(world_dir_h.xyz);
55
+ let view_position = mat4_extract_position(camera.transform);
56
+
57
+ let sun_len_sq = dot(settings.sun_direction, settings.sun_direction);
58
+ if (sun_len_sq <= 1e-12 || all(settings.sun_irradiance <= vec3<f32>(0.0))) {
59
+ return vec4<f32>(0.0, 0.0, 0.0, 1.0);
60
+ }
61
+ let sun_dir = settings.sun_direction * inverseSqrt(sun_len_sq);
62
+
63
+ let lut_res = vec2<f32>(textureDimensions(tSkyViewLut));
64
+ let sky_uv = sky_view_lut_uv_for(atmosphere, view_position, view_direction, sun_dir, lut_res);
65
+ var result = textureSampleLevel(tSkyViewLut, sSkyLut, sky_uv, 0.0).rgb;
66
+
67
+ if (settings.sun_has_disc != 0u && settings.sun_disk_radius > 0.0) {
68
+ let view_rel = atmosphere_clamped_observer_relative(atmosphere, view_position);
69
+ let bounds = atmosphere_ray_bounds_for(atmosphere, view_rel, view_direction);
70
+
71
+ if (!bounds.hits_ground) {
72
+ let angular_radius = max(settings.sun_disk_radius, 0.0045);
73
+ let cos_outer = cos(angular_radius * 1.06);
74
+ let cos_inner = cos(angular_radius * 0.88);
75
+ let cos_angle = dot(view_direction, sun_dir);
76
+ let disc_mask = smoothstep(cos_outer, cos_inner, cos_angle);
77
+
78
+ if (disc_mask > 0.0) {
79
+ let cos_radius = cos(angular_radius);
80
+ let mu = sqrt(saturate((cos_angle - cos_outer) / max(1.0 - cos_outer, 1e-6)));
81
+ // Eddington solar limb darkening (mean over disc = 0.8)
82
+ let limb = (0.4 + 0.6 * mu) * (1.0 / 0.8);
83
+ let solid_angle = max(2.0 * PI * (1.0 - cos_radius), 1e-6);
84
+
85
+ let observer_radius = length(view_rel);
86
+ let up = view_rel / observer_radius;
87
+ let altitude = observer_radius - atmosphere.planet_radius;
88
+ let sun_transmittance = sample_transmittance_lut_params_for(
89
+ atmosphere,
90
+ altitude,
91
+ dot(view_direction, up)
92
+ );
93
+
94
+ let raw_disc_radiance = (settings.sun_irradiance / solid_angle) * limb * sun_transmittance;
95
+ let max_channel = max(max(raw_disc_radiance.r, raw_disc_radiance.g), max(raw_disc_radiance.b, 1e-6));
96
+ let disc_radiance = raw_disc_radiance * min(1.0, MAX_SOLAR_DISC_RADIANCE / max_channel);
97
+
98
+ result += disc_radiance * disc_mask;
99
+ }
100
+ }
101
+ }
102
+
103
+ return vec4<f32>(result, 1.0);
104
+ }
105
+ `, [
106
+ PI_DECLARATION,
107
+ chunk_uv_to_ndc,
108
+ chunk_mat4_extract_position,
109
+ chunk_sky_irradiance_lut_encode_uv,
110
+ chunk_sample_transmittance_lut_params_for,
111
+ ]
112
+ );
113
+
114
+ export const shader_background_sky = ImageShader.from({
115
+ descriptor: ShaderDescriptor.from({
116
+ label: "Scene Background / Atmosphere Sky",
117
+ resources,
118
+ body
119
+ }),
120
+ depthStencil: {
121
+ format: "depth32float",
122
+ depthCompare: "equal"
123
+ },
124
+ targets: [
125
+ {
126
+ label: "shaded",
127
+ format: "rgba16float"
128
+ }
129
+ ]
130
+ });
@@ -13,7 +13,8 @@ export const TONEMAP_ADAPTATION_RESOURCE: ShaderResourceDescriptor;
13
13
  * ```
14
14
  *
15
15
  * - `false`, the default: the colour as it is.
16
- * - `true`: the colour through `apply_purkinje_shift` at the view's adaptation, {@link TONEMAP_ADAPTATION_RESOURCE}.
16
+ * - `true`: the colour through `apply_purkinje_shift` at the view's adaptation, {@link TONEMAP_ADAPTATION_RESOURCE},
17
+ * across CIE 191's mesopic range.
17
18
  *
18
19
  * The shift is linear in the colour, so the function may be applied ahead of the exposure or after it.
19
20
  *
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_tonemap_purkinje.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,0CAFU,wBAAwB,CAE8E;AAEhH;;;;;;;;;;;;;GAaG;AACH,qCAFU,eAAe,CAE0D;yCA1B1C,mDAAmD;gCAD5D,0CAA0C"}
1
+ {"version":3,"file":"chunk_tonemap_purkinje.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,0CAFU,wBAAwB,CAE8E;AAEhH;;;;;;;;;;;;;;GAcG;AACH,qCAFU,eAAe,CAE0D;yCA3B1C,mDAAmD;gCAD5D,0CAA0C"}
@@ -21,7 +21,8 @@ export const TONEMAP_ADAPTATION_RESOURCE = ShaderResourceDescriptor.uniform("ada
21
21
  * ```
22
22
  *
23
23
  * - `false`, the default: the colour as it is.
24
- * - `true`: the colour through `apply_purkinje_shift` at the view's adaptation, {@link TONEMAP_ADAPTATION_RESOURCE}.
24
+ * - `true`: the colour through `apply_purkinje_shift` at the view's adaptation, {@link TONEMAP_ADAPTATION_RESOURCE},
25
+ * across CIE 191's mesopic range.
25
26
  *
26
27
  * The shift is linear in the colour, so the function may be applied ahead of the exposure or after it.
27
28
  *
@@ -41,7 +42,10 @@ const shifted = CodeChunk.from(
41
42
  //language=WGSL
42
43
  `
43
44
  fn tonemap_purkinje(color: vec3<f32>) -> vec3<f32> {
44
- return apply_purkinje_shift(color, adaptation.value);
45
+ return apply_purkinje_shift(
46
+ color,
47
+ purkinje_rod_share(adaptation.value, PURKINJE_MESOPIC_MIN_NITS, PURKINJE_MESOPIC_MAX_NITS)
48
+ );
45
49
  }
46
50
  `, [chunk_apply_purkinje_shift]);
47
51
 
@@ -41,8 +41,9 @@ export class ViewTextures extends FrameRecord {
41
41
  get visible_meshlets(): number;
42
42
  set velocity(handle: number);
43
43
  /**
44
- * How far each pixel's surface moved on screen since the last frame: `rg16float`, in pixels, this
45
- * frame's place less last frame's, free of the sub-pixel jitter. The renderer fills it from depth and
44
+ * How far each pixel's surface moved since the last frame, `VELOCITY_FORMAT`: in xy the pixels from last
45
+ * frame's place to this frame's, in z the view depth now less then, free of the sub-pixel jitter
46
+ * (`chunk_velocity_texel` makes the texel). The renderer fills it from depth and
46
47
  * {@link visibility} before {@link FramePhase.AfterGBuffer}; an extension that draws surfaces the
47
48
  * visibility buffer cannot describe writes their pixels' motion over it at that phase and publishes
48
49
  * the handle it wrote. What is published later than that phase reaches nothing the renderer runs.
@@ -1 +1 @@
1
- {"version":3,"file":"ViewTextures.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/extension/ViewTextures.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH;IAOI,0CAKC;IASD,0BAEC;IATD;;OAEG;IACH,oBAEC;IAgBD,mCAEC;IAZD;;;;;OAKG;IACH,6BAEC;IAiBD,+BAEC;IAbD;;;;;;OAMG;IACH,yBAEC;IAiBD,qCAEC;IAbD;;;;;;OAMG;IACH,+BAEC;IAmBD,6BAEC;IAfD;;;;;;;;OAQG;IACH,uBAEC;;CAKJ;4BA/F2B,kBAAkB"}
1
+ {"version":3,"file":"ViewTextures.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/extension/ViewTextures.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH;IAOI,0CAKC;IASD,0BAEC;IATD;;OAEG;IACH,oBAEC;IAgBD,mCAEC;IAZD;;;;;OAKG;IACH,6BAEC;IAiBD,+BAEC;IAbD;;;;;;OAMG;IACH,yBAEC;IAiBD,qCAEC;IAbD;;;;;;OAMG;IACH,+BAEC;IAoBD,6BAEC;IAhBD;;;;;;;;;OASG;IACH,uBAEC;;CAKJ;4BAhG2B,kBAAkB"}
@@ -79,8 +79,9 @@ export class ViewTextures extends FrameRecord {
79
79
  }
80
80
 
81
81
  /**
82
- * How far each pixel's surface moved on screen since the last frame: `rg16float`, in pixels, this
83
- * frame's place less last frame's, free of the sub-pixel jitter. The renderer fills it from depth and
82
+ * How far each pixel's surface moved since the last frame, `VELOCITY_FORMAT`: in xy the pixels from last
83
+ * frame's place to this frame's, in z the view depth now less then, free of the sub-pixel jitter
84
+ * (`chunk_velocity_texel` makes the texel). The renderer fills it from depth and
84
85
  * {@link visibility} before {@link FramePhase.AfterGBuffer}; an extension that draws surfaces the
85
86
  * visibility buffer cannot describe writes their pixels' motion over it at that phase and publishes
86
87
  * the handle it wrote. What is published later than that phase reaches nothing the renderer runs.
@@ -143,7 +143,7 @@ export class GPUFluidCascade {
143
143
  * @param {*} _resources
144
144
  * @param {{encoder: ShadeGPUCommandContext}} context
145
145
  */
146
- static "__#289@#execute_restrict"(record: object, _resources: any, context: {
146
+ static "__#292@#execute_restrict"(record: object, _resources: any, context: {
147
147
  encoder: ShadeGPUCommandContext;
148
148
  }): void;
149
149
  /**
@@ -151,7 +151,7 @@ export class GPUFluidCascade {
151
151
  * @param {*} _resources
152
152
  * @param {{encoder: ShadeGPUCommandContext}} context
153
153
  */
154
- static "__#289@#execute_fill"(record: object, _resources: any, context: {
154
+ static "__#292@#execute_fill"(record: object, _resources: any, context: {
155
155
  encoder: ShadeGPUCommandContext;
156
156
  }): void;
157
157
  /**
@@ -159,7 +159,7 @@ export class GPUFluidCascade {
159
159
  * @param {import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
160
160
  * @param {{encoder: ShadeGPUCommandContext}} context
161
161
  */
162
- static "__#289@#execute"(record: object, resources: import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
162
+ static "__#292@#execute"(record: object, resources: import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
163
163
  encoder: ShadeGPUCommandContext;
164
164
  }): void;
165
165
  /**
@@ -63,7 +63,7 @@ export class GPUFluidCascadeStack {
63
63
  * @param {*} _resources
64
64
  * @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
65
65
  */
66
- static "__#291@#execute_publish"(pass: object, _resources: any, context: {
66
+ static "__#294@#execute_publish"(pass: object, _resources: any, context: {
67
67
  encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
68
68
  }): void;
69
69
  /**
@@ -90,19 +90,19 @@ export class GPUFluidForcing {
90
90
  * @param {number} clear_size bytes cleared from 0 when the pool reuses the buffer
91
91
  * @returns {BufferResourceDescriptor}
92
92
  */
93
- static "__#292@#descriptor"(kept: BufferResourceDescriptor[], role: number, size: number, usage: number, clear_size: number): BufferResourceDescriptor;
93
+ static "__#295@#descriptor"(kept: BufferResourceDescriptor[], role: number, size: number, usage: number, clear_size: number): BufferResourceDescriptor;
94
94
  /**
95
95
  * @param {object} record
96
96
  * @param {FramePassResources} resources
97
97
  * @param {{encoder: ShadeGPUCommandContext}} context
98
98
  */
99
- static "__#292@#execute_extract"(record: object, resources: FramePassResources, context: {
99
+ static "__#295@#execute_extract"(record: object, resources: FramePassResources, context: {
100
100
  encoder: ShadeGPUCommandContext;
101
101
  }): void;
102
- static "__#292@#execute_clear"(record: any, _resources: any, context: any): void;
103
- static "__#292@#execute_query"(record: any, resources: any, context: any): void;
104
- static "__#292@#execute_command"(record: any, resources: any, context: any): void;
105
- static "__#292@#execute_apply"(record: any, resources: any, context: any): void;
102
+ static "__#295@#execute_clear"(record: any, _resources: any, context: any): void;
103
+ static "__#295@#execute_query"(record: any, resources: any, context: any): void;
104
+ static "__#295@#execute_command"(record: any, resources: any, context: any): void;
105
+ static "__#295@#execute_apply"(record: any, resources: any, context: any): void;
106
106
  /**
107
107
  * @param {object} options
108
108
  * @param {GPUDevice} options.device
@@ -41,7 +41,7 @@ export class GPUFluidPressureSolve {
41
41
  * @param {*} _resources
42
42
  * @param {{encoder: ShadeGPUCommandContext}} context
43
43
  */
44
- static "__#288@#execute"(data: {
44
+ static "__#291@#execute"(data: {
45
45
  solve: GPUFluidPressureSolve;
46
46
  arm: number;
47
47
  count: number;
@@ -49,7 +49,7 @@ export class GPUFluidQueries {
49
49
  * @param {import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
50
50
  * @param {{encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
51
51
  */
52
- static "__#293@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
52
+ static "__#296@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
53
53
  encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
54
54
  }): void;
55
55
  /**
@@ -1,7 +1,7 @@
1
1
  import { u32 } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
2
  import { WebGPUArray } from "../../../shader/type/WebGPUArray.js";
3
3
  import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
4
- import { chunk_sample_environment_color } from "../../../atmosphere/chunk_sample_environment_color.js";
4
+ import { chunk_sample_environment_color } from "../../../light/environment/chunk_sample_environment_color.js";
5
5
  import { INDIRECT_MATERIAL_ARRAY_TYPE } from "../../../material/resident/INDIRECT_MATERIAL_ARRAY_TYPE.js";
6
6
  import { chunk_indirect_sample_texture } from "../../../path_tracer/shader/chunk_indirect_sample_texture.js";
7
7
 
@@ -34,7 +34,7 @@ export class GPUProbeClipmapGI {
34
34
  * @param {ProbeClipmapSettings} settings
35
35
  * @returns {boolean} whether it is what the settings' world cache describes, in their frustum's windows
36
36
  */
37
- static "__#214@#world_cache_built_for"(world_cache: GPUProbeClipmap, settings: ProbeClipmapSettings): boolean;
37
+ static "__#215@#world_cache_built_for"(world_cache: GPUProbeClipmap, settings: ProbeClipmapSettings): boolean;
38
38
  /**
39
39
  * @param {GraphicsContext} graphics
40
40
  */
@@ -55,6 +55,24 @@ export class GPUProbeClipmapGI {
55
55
  * @returns {ProbeClipmapSceneHolds|undefined} undefined while the mode is not running
56
56
  */
57
57
  get holds(): ProbeClipmapSceneHolds;
58
+ /**
59
+ * @returns {GPUBrickMaterial|undefined} the bricks' surface material, which a ray's hit reads; undefined while the
60
+ * mode is not running
61
+ */
62
+ get material(): GPUBrickMaterial;
63
+ /**
64
+ * @returns {number} the graph handle of the brick clipmap's last write in this frame's {@link graph_update}, which a
65
+ * pass tracing the bricks after it reads
66
+ */
67
+ get bricks(): number;
68
+ /**
69
+ * @returns {{lookup: number, data: number}} graph handles of the world light clusters this frame's
70
+ * {@link graph_update} built over the bricks' cascades, where a ray's hit finds its local lights
71
+ */
72
+ get clusters(): {
73
+ lookup: number;
74
+ data: number;
75
+ };
58
76
  /**
59
77
  * Take a frame of the mode: make the clipmaps for `view` and the structure `settings` describe,
60
78
  * unless they already are, hold the scene's geometry caches and record their bake. Allocates nothing
@@ -201,4 +219,5 @@ export type BrickProvider = import("./brick/GPUBrickClipmap.js").BrickProvider;
201
219
  import { GPUBrickClipmap } from "./brick/GPUBrickClipmap.js";
202
220
  import { GPUProbeClipmap } from "./probe/GPUProbeClipmap.js";
203
221
  import { ProbeClipmapSceneHolds } from "./ProbeClipmapSceneHolds.js";
222
+ import { GPUBrickMaterial } from "./material/GPUBrickMaterial.js";
204
223
  //# sourceMappingURL=GPUProbeClipmapGI.d.ts.map