@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
@@ -1 +1 @@
1
- {"version":3,"file":"GPUSceneContext.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/GPUSceneContext.js"],"names":[],"mappings":"AA4EA;;;;;;;;;GASG;AACH;IAEI;;;;;;;OAOG;IACH,iCAFW,eAAe,QASzB;IA4KD;;;;OAIG;IACH,sBAHW,eAAe,SACf,KAAK,EAyCf;IAtND;;;OAGG;IACH,aAFU,MAAM,CAEE;IAElB;;OAEG;IACH,YAFU,kBAAkB,CAEjB;IAEX;;OAEG;IACH,WAFU,kBAAkB,CAElB;IAGV;;OAEG;IACH,sBAFU,cAAc,CAEH;IASrB;;;OAGG;IACH,mBAEC;IAOD,uCAEC;IAOD;;;;;OAKG;IACH,yBAEC;IAUD;;;;;OAKG;IACH,kBAEC;IAQD;;;OAGG;IACH,iCAEC;IAOD;;;OAGG;IACH,8CAEC;IAOD;;;OAGG;IACH,8CAEC;IA2ID;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,gDAEC;IAED;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,+CAEC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAH0C,SAAS,GAAxC,oBAAoB;QAClB,yBAAyB,CA4DrC;IAED;;OAEG;IACH,6CAEC;IAYD;;;;;OAKG;IACH,gEAEC;IAED;;;OAGG;IACH,kCAEC;IAED;;;;;OAKG;IACH,uCAEC;IAED;;;;;;;;;;;OAWG;IACH,uCAUC;IAED,+BAUC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,yBAEC;IAED;;;;;OAKG;IACH,sCAMC;IAOD;;;;;;;OAOG;IACH,8EAEC;IA6BD;;;;;OAKG;IACH,cAsEC;IAED;;;;;OAKG;IACH,YAFW,eAAe,QA4BzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAHW,sBAAsB,cACtB,MAAM,QAuBhB;IAUD;;;;;;;;;;;OAWG;IACH,oBAHW,UAAU,GACR,MAAM,CAQlB;IAoCD;;;;;;;OAOG;IACH,gBAuBC;IAwCL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;;CAN1C;8BAr3BY,OAAO,0CAA0C,EAAE,eAAe;8BAClE,OAAO,uBAAuB,EAAE,eAAe;iCAC/C,OAAO,mCAAmC,EAAE,kBAAkB;iCAC9D,OAAO,mCAAmC,EAAE,kBAAkB;4BAC9D,OAAO,8BAA8B,EAAE,aAAa;8BACpD,OAAO,iDAAiD,EAAE,eAAe;yBACzE,OAAO,2DAA2D,EAAE,UAAU;+BA5B5D,iDAAiD;sBAM1D,YAAY;oCAFE,uCAAuC;6BAC9C,yBAAyB;uBAH/B,yBAAyB;mCACb,gCAAgC;oCAF/B,mDAAmD;kDAMrC,wCAAwC;0CAlBhD,0DAA0D;8BAItE,8CAA8C;iCAF3C,iDAAiD;+BAInD,2CAA2C;qCADrC,qDAAqD;oCAItD,qCAAqC;4BAC7C,gCAAgC;uCASrB,iDAAiD;6BAQ3D,wBAAwB;wCADb,mCAAmC;uCAlBpC,wCAAwC"}
1
+ {"version":3,"file":"GPUSceneContext.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/GPUSceneContext.js"],"names":[],"mappings":"AA4EA;;;;;;;;;GASG;AACH;IAEI;;;;;;;OAOG;IACH,iCAFW,eAAe,QAUzB;IA4KD;;;;OAIG;IACH,sBAHW,eAAe,SACf,KAAK,EAyCf;IAtND;;;OAGG;IACH,aAFU,MAAM,CAEE;IAElB;;OAEG;IACH,YAFU,kBAAkB,CAEjB;IAEX;;OAEG;IACH,WAFU,kBAAkB,CAElB;IAGV;;OAEG;IACH,sBAFU,cAAc,CAEH;IASrB;;;OAGG;IACH,mBAEC;IAOD,uCAEC;IAOD;;;;;OAKG;IACH,yBAEC;IAUD;;;;;OAKG;IACH,kBAEC;IAQD;;;OAGG;IACH,iCAEC;IAOD;;;OAGG;IACH,8CAEC;IAOD;;;OAGG;IACH,8CAEC;IA2ID;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,gDAEC;IAED;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,+CAEC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAH0C,SAAS,GAAxC,oBAAoB;QAClB,yBAAyB,CA4DrC;IAED;;OAEG;IACH,6CAEC;IAYD;;;;;OAKG;IACH,gEAEC;IAED;;;OAGG;IACH,kCAEC;IAED;;;;;OAKG;IACH,uCAEC;IAED;;;;;;;;;;;OAWG;IACH,uCAUC;IAED,+BAUC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,yBAEC;IAED;;;;;OAKG;IACH,sCAMC;IAOD;;;;;;;OAOG;IACH,8EAEC;IA6BD;;;;;OAKG;IACH,cAsEC;IAED;;;;;OAKG;IACH,YAFW,eAAe,QA4BzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAHW,sBAAsB,cACtB,MAAM,QAuBhB;IAUD;;;;;;;;;;;OAWG;IACH,oBAHW,UAAU,GACR,MAAM,CAQlB;IAoCD;;;;;;;OAOG;IACH,gBAuBC;IAwCL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;;CAN1C;8BAt3BY,OAAO,0CAA0C,EAAE,eAAe;8BAClE,OAAO,uBAAuB,EAAE,eAAe;iCAC/C,OAAO,mCAAmC,EAAE,kBAAkB;iCAC9D,OAAO,mCAAmC,EAAE,kBAAkB;4BAC9D,OAAO,8BAA8B,EAAE,aAAa;8BACpD,OAAO,iDAAiD,EAAE,eAAe;yBACzE,OAAO,2DAA2D,EAAE,UAAU;+BA5B5D,iDAAiD;sBAM1D,YAAY;oCAFE,uCAAuC;6BAC9C,yBAAyB;uBAH/B,yBAAyB;mCACb,gCAAgC;oCAF/B,mDAAmD;kDAMrC,wCAAwC;0CAlBhD,0DAA0D;8BAItE,8CAA8C;iCAF3C,iDAAiD;+BAInD,2CAA2C;qCADrC,qDAAqD;oCAItD,qCAAqC;4BAC7C,gCAAgC;uCASrB,iDAAiD;6BAQ3D,wBAAwB;wCADb,mCAAmC;uCAlBpC,wCAAwC"}
@@ -98,6 +98,7 @@ export class GPUSceneContext {
98
98
  GPUDatabase.enquirePipelines(enquiry);
99
99
  GPUAnimationManager.enquirePipelines(enquiry);
100
100
  enquiry.compute.push(shader_refresh_all_mesh_bounds.pipeline);
101
+ GPUSky.enquirePipelines(enquiry);
101
102
  GPULightCollection.enquirePipelines(enquiry);
102
103
  GPUInstancesAccelerationStructure.enquirePipelines(enquiry);
103
104
  GPUSceneVolumetrics.enquirePipelines(enquiry);
@@ -314,7 +315,7 @@ export class GPUSceneContext {
314
315
 
315
316
  this.#wind = new GPUSceneWind(device);
316
317
 
317
- this.#sky = new GPUSky(graphics);
318
+ this.#sky = new GPUSky(graphics, scene.atmosphere);
318
319
 
319
320
  this.#animation_manager = new GPUAnimationManager(device, `GPUSceneContext[${this.id}]/Animation`, this);
320
321
  }
@@ -2,8 +2,8 @@
2
2
  * @typedef {import("../../../engine/ecs/EntityComponentDataset.js").EntityComponentDataset} EntityComponentDataset
3
3
  */
4
4
  /**
5
- * A scene: the dataset whose entities are what it draws and poses, and the three things that are
6
- * not entities — its lights' collection, a light probe volume, volumetrics.
5
+ * A scene: the dataset whose entities are what it draws and poses, and the things that are
6
+ * not entities — its lights' collection, atmosphere, a light probe volume, volumetrics.
7
7
  *
8
8
  * Everything drawn is an entity of {@link dataset} holding a row of the scene's GPU database
9
9
  * (`GPUSceneContext.rows`), at `entity + 1`. A game's systems take rows as components appear; a
@@ -27,6 +27,12 @@ export class Scene {
27
27
  * @type {LightCollection}
28
28
  */
29
29
  lights: LightCollection;
30
+ /**
31
+ * Physical Hillaire (2020) sky and atmosphere configuration.
32
+ *
33
+ * @type {SceneAtmosphere}
34
+ */
35
+ atmosphere: SceneAtmosphere;
30
36
  /**
31
37
  *
32
38
  * @type {LightProbeVolume}
@@ -45,6 +51,7 @@ export class Scene {
45
51
  }
46
52
  export type EntityComponentDataset = import("../../../engine/ecs/EntityComponentDataset.js").EntityComponentDataset;
47
53
  import { LightCollection } from "../light/LightCollection.js";
54
+ import { SceneAtmosphere } from "../atmosphere/SceneAtmosphere.js";
48
55
  import { LightProbeVolume } from "../global_illumination/lpv/LightProbeVolume.js";
49
56
  import { SceneVolumetrics } from "../volumetrics/SceneVolumetrics.js";
50
57
  //# sourceMappingURL=Scene.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/Scene.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;OAOG;IACH,SAFU,sBAAsB,GAAC,IAAI,CAEtB;IAEf;;;;;OAKG;IACH,QAFU,eAAe,CAEM;IAE/B;;;OAGG;IACH,oBAFU,gBAAgB,CAEkB;IAE5C;;;OAGG;IACH,aAFU,gBAAgB,CAEW;IAGzC;;;OAGG;IACH,kBAFU,OAAO,CAEM;CANtB;qCA1CY,OAAO,+CAA+C,EAAE,sBAAsB;gCAJ3D,6BAA6B;iCAD5B,gDAAgD;iCAEhD,oCAAoC"}
1
+ {"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/Scene.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;OAOG;IACH,SAFU,sBAAsB,GAAC,IAAI,CAEtB;IAEf;;;;;OAKG;IACH,QAFU,eAAe,CAEM;IAE/B;;;;OAIG;IACH,YAFU,eAAe,CAEU;IAEnC;;;OAGG;IACH,oBAFU,gBAAgB,CAEkB;IAE5C;;;OAGG;IACH,aAFU,gBAAgB,CAEW;IAGzC;;;OAGG;IACH,kBAFU,OAAO,CAEM;CANtB;qCAjDY,OAAO,+CAA+C,EAAE,sBAAsB;gCAJ3D,6BAA6B;gCAF7B,kCAAkC;iCACjC,gDAAgD;iCAEhD,oCAAoC"}
@@ -1,3 +1,4 @@
1
+ import { SceneAtmosphere } from "../atmosphere/SceneAtmosphere.js";
1
2
  import { LightProbeVolume } from "../global_illumination/lpv/LightProbeVolume.js";
2
3
  import { LightCollection } from "../light/LightCollection.js";
3
4
  import { SceneVolumetrics } from "../volumetrics/SceneVolumetrics.js";
@@ -7,8 +8,8 @@ import { SceneVolumetrics } from "../volumetrics/SceneVolumetrics.js";
7
8
  */
8
9
 
9
10
  /**
10
- * A scene: the dataset whose entities are what it draws and poses, and the three things that are
11
- * not entities — its lights' collection, a light probe volume, volumetrics.
11
+ * A scene: the dataset whose entities are what it draws and poses, and the things that are
12
+ * not entities — its lights' collection, atmosphere, a light probe volume, volumetrics.
12
13
  *
13
14
  * Everything drawn is an entity of {@link dataset} holding a row of the scene's GPU database
14
15
  * (`GPUSceneContext.rows`), at `entity + 1`. A game's systems take rows as components appear; a
@@ -34,6 +35,13 @@ export class Scene {
34
35
  */
35
36
  lights = new LightCollection();
36
37
 
38
+ /**
39
+ * Physical Hillaire (2020) sky and atmosphere configuration.
40
+ *
41
+ * @type {SceneAtmosphere}
42
+ */
43
+ atmosphere = new SceneAtmosphere();
44
+
37
45
  /**
38
46
  *
39
47
  * @type {LightProbeVolume}
@@ -6,14 +6,16 @@ export class ImageShader {
6
6
  * Utility constructor, matching general Shade API
7
7
  * @param {Object} options
8
8
  * @param {ShaderDescriptor} options.descriptor
9
- * @param {ColorTargetState[]} options.targets
10
- * @param {DepthStencilState} [options.depthStencil]
9
+ * @param {(GPUColorTargetState|{clearValue?:number[]})[]} options.targets
10
+ * @param {GPUDepthStencilState} [options.depthStencil]
11
11
  * @returns {ImageShader}
12
12
  */
13
13
  static from({ descriptor, targets, depthStencil, }: {
14
14
  descriptor: ShaderDescriptor;
15
- targets: ColorTargetState[];
16
- depthStencil?: DepthStencilState;
15
+ targets: (GPUColorTargetState | {
16
+ clearValue?: number[];
17
+ })[];
18
+ depthStencil?: GPUDepthStencilState;
17
19
  }): ImageShader;
18
20
  constructor({ descriptor, targets, depthStencil, }: {
19
21
  descriptor: any;
@@ -24,7 +26,7 @@ export class ImageShader {
24
26
  *
25
27
  * @returns {ShaderDescriptor}
26
28
  */
27
- get descriptor(): ShaderDescriptor;
29
+ get descriptor(): import("./ShaderDescriptor.js").ShaderDescriptor;
28
30
  /**
29
31
  * Optional clear values for each target
30
32
  * @type {number[][]}
@@ -62,16 +64,26 @@ export class ImageShader {
62
64
  /**
63
65
  * Note the absence of depth target, image shader is a full-screen pass, so depth is not used.
64
66
  *
65
- * @param {ShadeGPUCommandContext} encoder
66
- * @param {Object} [bindings] data bindings. It's optional, but in 99.99% of use cases you will want to specify this.
67
- * @param {GPURenderPassColorAttachment[]} [colorAttachments] where to draw, these are fragment shader outputs.
68
- * @param {GPURenderPassDepthStencilAttachment} [depthStencilAttachment]
69
- * @param {GPUTextureFormat[]} [color_formats] optional, if specified will be used to rewrite the pipeline for compatibility
70
- * @param {number[]} [viewport] [x0, y0, width, height ]
67
+ * @param {Object} options
68
+ * @param {ShadeGPUCommandContext} options.encoder
69
+ * @param {Object} [options.bindings] data bindings. It's optional, but in 99.99% of use cases you will want to specify this.
70
+ * @param {GPURenderPassColorAttachment[]} [options.colorAttachments] where to draw, these are fragment shader outputs.
71
+ * @param {GPURenderPassDepthStencilAttachment} [options.depthStencilAttachment]
72
+ * @param {GPUTextureFormat[]} [options.color_formats] optional, if specified will be used to rewrite the pipeline for compatibility
73
+ * @param {number[]} [options.viewport] [x0, y0, width, height ]
71
74
  */
72
- draw({ encoder, bindings, colorAttachments, depthStencilAttachment, color_formats, viewport }: ShadeGPUCommandContext): void;
75
+ draw({ encoder, bindings, colorAttachments, depthStencilAttachment, color_formats, viewport }: {
76
+ encoder: ShadeGPUCommandContext;
77
+ bindings?: any;
78
+ colorAttachments?: GPURenderPassColorAttachment[];
79
+ depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
80
+ color_formats?: GPUTextureFormat[];
81
+ viewport?: number[];
82
+ }): void;
73
83
  #private;
74
84
  }
75
85
  export type RenderPipelineDescriptor = import("../../descriptor/pipeline/render/RenderPipelineDescriptor.js").RenderPipelineDescriptor;
86
+ export type ShadeGPUCommandContext = import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
76
87
  export type ShaderSwitchSet = import("./compiler/ShaderSwitchSet.js").ShaderSwitchSet;
88
+ export type ShaderDescriptor = import("./ShaderDescriptor.js").ShaderDescriptor;
77
89
  //# sourceMappingURL=ImageShader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImageShader.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/shader/ImageShader.js"],"names":[],"mappings":"AAaA;;GAEG;AACH;IAiLI;;;;;;;OAOG;IACH;QALqC,UAAU;QACR,OAAO,EAAnC,kBAAkB;QACU,YAAY;QACtC,WAAW,CAavB;IA9ED;;;;OAwDC;IAxKD;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,cAFU,MAAM,EAAE,EAAE,CAEF;IAelB;;;OAGG;IACH,gHAEC;IAED;;;;;;;;OAQG;IACH,4BAHW,kBAAkB,GAChB,wBAAwB,CAIpC;IAED;;;OAGG;IACH,6BAEC;IAoBD;;;;;;;OAOG;IACH,aAHW,eAAe,GACb,WAAW,CA8BvB;IAkFD;;;;;;;;;OASG;IACH,6HA0EC;;CACJ;uCApSY,OAAO,8DAA8D,EAAE,wBAAwB;8BAC/F,OAAO,+BAA+B,EAAE,eAAe"}
1
+ {"version":3,"file":"ImageShader.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/shader/ImageShader.js"],"names":[],"mappings":"AAeA;;GAEG;AACH;IAiLI;;;;;;;OAOG;IACH;QALqC,UAAU,EAApC,gBAAgB;QACwC,OAAO,EAA/D,CAAC,sBAAoB;YAAC,UAAU,CAAC,EAAC,MAAM,EAAE,CAAA;SAAC,CAAC,EAAE;QACf,YAAY;QACzC,WAAW,CAavB;IA9ED;;;;OAwDC;IAxKD;;;OAGG;IACH,mEAEC;IAED;;;OAGG;IACH,cAFU,MAAM,EAAE,EAAE,CAEF;IAelB;;;OAGG;IACH,gHAEC;IAED;;;;;;;;OAQG;IACH,4BAHW,kBAAkB,GAChB,wBAAwB,CAIpC;IAED;;;OAGG;IACH,6BAEC;IAoBD;;;;;;;OAOG;IACH,aAHW,eAAe,GACb,WAAW,CA8BvB;IAkFD;;;;;;;;;;OAUG;IACH;QAP2C,OAAO,EAAvC,sBAAsB;QACL,QAAQ;QACgB,gBAAgB,GAAzD,8BAA8B;QACgB,sBAAsB;QACvC,aAAa,GAA1C,kBAAkB;QACC,QAAQ,GAA3B,MAAM,EAAE;aA4ElB;;CACJ;uCAvSY,OAAO,8DAA8D,EAAE,wBAAwB;qCAC/F,OAAO,wCAAwC,EAAE,sBAAsB;8BACvE,OAAO,+BAA+B,EAAE,eAAe;+BACvD,OAAO,uBAAuB,EAAE,gBAAgB"}
@@ -6,7 +6,9 @@ import { create_full_quad_pipeline_descriptor } from "./fullscreen/create_full_q
6
6
 
7
7
  /**
8
8
  * @typedef {import("../../descriptor/pipeline/render/RenderPipelineDescriptor.js").RenderPipelineDescriptor} RenderPipelineDescriptor
9
+ * @typedef {import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext} ShadeGPUCommandContext
9
10
  * @typedef {import("./compiler/ShaderSwitchSet.js").ShaderSwitchSet} ShaderSwitchSet
11
+ * @typedef {import("./ShaderDescriptor.js").ShaderDescriptor} ShaderDescriptor
10
12
  */
11
13
 
12
14
  const VALIDATION_ENABLED = true;
@@ -195,8 +197,8 @@ export class ImageShader {
195
197
  * Utility constructor, matching general Shade API
196
198
  * @param {Object} options
197
199
  * @param {ShaderDescriptor} options.descriptor
198
- * @param {ColorTargetState[]} options.targets
199
- * @param {DepthStencilState} [options.depthStencil]
200
+ * @param {(GPUColorTargetState|{clearValue?:number[]})[]} options.targets
201
+ * @param {GPUDepthStencilState} [options.depthStencil]
200
202
  * @returns {ImageShader}
201
203
  */
202
204
  static from({
@@ -215,12 +217,13 @@ export class ImageShader {
215
217
  /**
216
218
  * Note the absence of depth target, image shader is a full-screen pass, so depth is not used.
217
219
  *
218
- * @param {ShadeGPUCommandContext} encoder
219
- * @param {Object} [bindings] data bindings. It's optional, but in 99.99% of use cases you will want to specify this.
220
- * @param {GPURenderPassColorAttachment[]} [colorAttachments] where to draw, these are fragment shader outputs.
221
- * @param {GPURenderPassDepthStencilAttachment} [depthStencilAttachment]
222
- * @param {GPUTextureFormat[]} [color_formats] optional, if specified will be used to rewrite the pipeline for compatibility
223
- * @param {number[]} [viewport] [x0, y0, width, height ]
220
+ * @param {Object} options
221
+ * @param {ShadeGPUCommandContext} options.encoder
222
+ * @param {Object} [options.bindings] data bindings. It's optional, but in 99.99% of use cases you will want to specify this.
223
+ * @param {GPURenderPassColorAttachment[]} [options.colorAttachments] where to draw, these are fragment shader outputs.
224
+ * @param {GPURenderPassDepthStencilAttachment} [options.depthStencilAttachment]
225
+ * @param {GPUTextureFormat[]} [options.color_formats] optional, if specified will be used to rewrite the pipeline for compatibility
226
+ * @param {number[]} [options.viewport] [x0, y0, width, height ]
224
227
  */
225
228
  draw({
226
229
  encoder,
@@ -1,5 +1,7 @@
1
1
  /**
2
- * This is more of atmosphere "width" or "thickness", as it's relative to the surface
2
+ * Default Earth atmosphere shell thickness above `PLANET_RADIUS` in GPU atmosphere units
3
+ * ($\text{km}$), derived from physical metres via {@link ATMOSPHERE_UNIT_SCALE_DECLARATION}.
4
+ *
3
5
  * @type {CodeChunk}
4
6
  */
5
7
  export const ATMOSPHERE_HEIGHT_DECLARATION: CodeChunk;
@@ -1 +1 @@
1
- {"version":3,"file":"ATMOSPHERE_HEIGHT_DECLARATION.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,4CAFU,SAAS,CAKjB;0BATwB,6BAA6B"}
1
+ {"version":3,"file":"ATMOSPHERE_HEIGHT_DECLARATION.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,4CAFU,SAAS,CAUjB;0BAhBwB,6BAA6B"}
@@ -1,10 +1,18 @@
1
+ import { ATMOSPHERE_UNIT_SCALE_DECLARATION } from "../../../atmosphere/ATMOSPHERE_UNIT_SCALE.js";
1
2
  import { CodeChunk } from "../../compiler/CodeChunk.js";
2
3
 
3
4
  /**
4
- * This is more of atmosphere "width" or "thickness", as it's relative to the surface
5
+ * Default Earth atmosphere shell thickness above `PLANET_RADIUS` in GPU atmosphere units
6
+ * ($\text{km}$), derived from physical metres via {@link ATMOSPHERE_UNIT_SCALE_DECLARATION}.
7
+ *
5
8
  * @type {CodeChunk}
6
9
  */
7
10
  export const ATMOSPHERE_HEIGHT_DECLARATION = CodeChunk.from(
8
- //language=WGSL
9
- `const ATMOSPHERE_HEIGHT = 100000;`
11
+ //language=WGSL
12
+ `
13
+ const ATMOSPHERE_HEIGHT_METERS: f32 = 100000.0;
14
+ const ATMOSPHERE_HEIGHT: f32 = ATMOSPHERE_HEIGHT_METERS * METERS_TO_ATMOSPHERE_UNITS;
15
+ `, [
16
+ ATMOSPHERE_UNIT_SCALE_DECLARATION,
17
+ ]
10
18
  );
@@ -1,15 +1,6 @@
1
1
  /**
2
- * The two sphere radii the atmosphere is bounded by, as f32.
3
- *
4
- * `PLANET_RADIUS` and `ATMOSPHERE_HEIGHT` carry no type suffix, so they are AbstractInt.
5
- * That converts silently wherever it is used directly in an f32 expression, but binding one
6
- * to an un-annotated `let` materialises it to i32 — which then neither mixes with f32 nor
7
- * holds the square of a planetary radius, since 6478000^2 is four orders of magnitude past
8
- * what an i32 can represent. Anything that needs a radius as a value rather than as a term
9
- * takes it from here.
10
- *
11
- * The squares are what the ray/sphere quadratics actually want, and as module-scope consts
12
- * they are folded once rather than recomputed per invocation.
2
+ * The two concentric sphere radii bounding the default Earth atmosphere, in GPU atmosphere units
3
+ * ($\text{km}$, see `ATMOSPHERE_UNIT_SCALE_DECLARATION`).
13
4
  *
14
5
  * @type {CodeChunk}
15
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ATMOSPHERE_RADII_DECLARATION.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,2CAFU,SAAS,CAcjB;0BA/BwB,6BAA6B"}
1
+ {"version":3,"file":"ATMOSPHERE_RADII_DECLARATION.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,2CAFU,SAAS,CAcjB;0BAtBwB,6BAA6B"}
@@ -1,32 +1,23 @@
1
- import { CodeChunk } from "../../compiler/CodeChunk.js";
2
- import { ATMOSPHERE_HEIGHT_DECLARATION } from "./ATMOSPHERE_HEIGHT_DECLARATION.js";
3
- import { PLANET_RADIUS_DECLARATION } from "./PLANET_RADIUS_DECLARATION.js";
4
-
5
- /**
6
- * The two sphere radii the atmosphere is bounded by, as f32.
7
- *
8
- * `PLANET_RADIUS` and `ATMOSPHERE_HEIGHT` carry no type suffix, so they are AbstractInt.
9
- * That converts silently wherever it is used directly in an f32 expression, but binding one
10
- * to an un-annotated `let` materialises it to i32 — which then neither mixes with f32 nor
11
- * holds the square of a planetary radius, since 6478000^2 is four orders of magnitude past
12
- * what an i32 can represent. Anything that needs a radius as a value rather than as a term
13
- * takes it from here.
14
- *
15
- * The squares are what the ray/sphere quadratics actually want, and as module-scope consts
16
- * they are folded once rather than recomputed per invocation.
17
- *
18
- * @type {CodeChunk}
19
- */
20
- export const ATMOSPHERE_RADII_DECLARATION = CodeChunk.from(
21
- //language=WGSL
22
- `
23
- const ATMOSPHERE_GROUND_RADIUS = f32(PLANET_RADIUS);
24
- const ATMOSPHERE_TOP_RADIUS = f32(PLANET_RADIUS) + f32(ATMOSPHERE_HEIGHT);
25
-
26
- const ATMOSPHERE_GROUND_RADIUS_SQUARED = ATMOSPHERE_GROUND_RADIUS * ATMOSPHERE_GROUND_RADIUS;
27
- const ATMOSPHERE_TOP_RADIUS_SQUARED = ATMOSPHERE_TOP_RADIUS * ATMOSPHERE_TOP_RADIUS;
28
- `, [
29
- PLANET_RADIUS_DECLARATION,
30
- ATMOSPHERE_HEIGHT_DECLARATION,
31
- ]
32
- );
1
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
2
+ import { ATMOSPHERE_HEIGHT_DECLARATION } from "./ATMOSPHERE_HEIGHT_DECLARATION.js";
3
+ import { PLANET_RADIUS_DECLARATION } from "./PLANET_RADIUS_DECLARATION.js";
4
+
5
+ /**
6
+ * The two concentric sphere radii bounding the default Earth atmosphere, in GPU atmosphere units
7
+ * ($\text{km}$, see `ATMOSPHERE_UNIT_SCALE_DECLARATION`).
8
+ *
9
+ * @type {CodeChunk}
10
+ */
11
+ export const ATMOSPHERE_RADII_DECLARATION = CodeChunk.from(
12
+ //language=WGSL
13
+ `
14
+ const ATMOSPHERE_GROUND_RADIUS: f32 = PLANET_RADIUS;
15
+ const ATMOSPHERE_TOP_RADIUS: f32 = PLANET_RADIUS + ATMOSPHERE_HEIGHT;
16
+
17
+ const ATMOSPHERE_GROUND_RADIUS_SQUARED: f32 = ATMOSPHERE_GROUND_RADIUS * ATMOSPHERE_GROUND_RADIUS;
18
+ const ATMOSPHERE_TOP_RADIUS_SQUARED: f32 = ATMOSPHERE_TOP_RADIUS * ATMOSPHERE_TOP_RADIUS;
19
+ `, [
20
+ PLANET_RADIUS_DECLARATION,
21
+ ATMOSPHERE_HEIGHT_DECLARATION,
22
+ ]
23
+ );
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Default Earth radius in GPU atmosphere units ($\text{km}$), derived from the physical metre
3
+ * radius via {@link ATMOSPHERE_UNIT_SCALE_DECLARATION}.
4
+ *
5
+ * @type {CodeChunk}
6
+ */
1
7
  export const PLANET_RADIUS_DECLARATION: CodeChunk;
2
8
  import { CodeChunk } from "../../compiler/CodeChunk.js";
3
9
  //# sourceMappingURL=PLANET_RADIUS_DECLARATION.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PLANET_RADIUS_DECLARATION.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js"],"names":[],"mappings":"AAEA,kDAGE;0BALwB,6BAA6B"}
1
+ {"version":3,"file":"PLANET_RADIUS_DECLARATION.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wCAFU,SAAS,CAUjB;0BAhBwB,6BAA6B"}
@@ -1,6 +1,18 @@
1
+ import { ATMOSPHERE_UNIT_SCALE_DECLARATION } from "../../../atmosphere/ATMOSPHERE_UNIT_SCALE.js";
1
2
  import { CodeChunk } from "../../compiler/CodeChunk.js";
2
3
 
4
+ /**
5
+ * Default Earth radius in GPU atmosphere units ($\text{km}$), derived from the physical metre
6
+ * radius via {@link ATMOSPHERE_UNIT_SCALE_DECLARATION}.
7
+ *
8
+ * @type {CodeChunk}
9
+ */
3
10
  export const PLANET_RADIUS_DECLARATION = CodeChunk.from(
4
- //language=WGSL
5
- `const PLANET_RADIUS = 6378000;`
11
+ //language=WGSL
12
+ `
13
+ const PLANET_RADIUS_METERS: f32 = 6378000.0;
14
+ const PLANET_RADIUS: f32 = PLANET_RADIUS_METERS * METERS_TO_ATMOSPHERE_UNITS;
15
+ `, [
16
+ ATMOSPHERE_UNIT_SCALE_DECLARATION,
17
+ ]
6
18
  );
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_atmosphere_height.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js"],"names":[],"mappings":"AAIA,gDAYE;0BAhBwB,6BAA6B"}
1
+ {"version":3,"file":"chunk_atmosphere_height.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js"],"names":[],"mappings":"AAKA,gDAaE;0BAjBwB,6BAA6B"}
@@ -1,3 +1,4 @@
1
+ import { ATMOSPHERE_UNIT_SCALE_DECLARATION } from "../../../atmosphere/ATMOSPHERE_UNIT_SCALE.js";
1
2
  import { CodeChunk } from "../../compiler/CodeChunk.js";
2
3
  import { PLANET_CENTER_DECLARATION } from "./PLANET_CENTER_DECLARATION.js";
3
4
  import { PLANET_RADIUS_DECLARATION } from "./PLANET_RADIUS_DECLARATION.js";
@@ -5,12 +6,13 @@ import { PLANET_RADIUS_DECLARATION } from "./PLANET_RADIUS_DECLARATION.js";
5
6
  export const chunk_atmosphere_height = CodeChunk.from(
6
7
  //language=WGSL
7
8
  `
8
- fn atmosphere_height( position_ws:vec3<f32> ) -> f32
9
+ fn atmosphere_height(position_ws: vec3<f32>) -> f32
9
10
  {
10
- return distance(position_ws, PLANET_CENTER) - PLANET_RADIUS;
11
+ return (distance(position_ws * METERS_TO_ATMOSPHERE_UNITS, PLANET_CENTER) - PLANET_RADIUS) * ATMOSPHERE_UNIT_METERS;
11
12
  }
12
13
  `,
13
14
  [
15
+ ATMOSPHERE_UNIT_SCALE_DECLARATION,
14
16
  PLANET_RADIUS_DECLARATION,
15
17
  PLANET_CENTER_DECLARATION
16
18
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_atmosphere_intersection.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js"],"names":[],"mappings":"AAMA,sDAcO;0BApBmB,6BAA6B"}
1
+ {"version":3,"file":"chunk_atmosphere_intersection.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js"],"names":[],"mappings":"AAOA,sDAqBO;0BA3BmB,6BAA6B"}
@@ -1,3 +1,4 @@
1
+ import { ATMOSPHERE_UNIT_SCALE_DECLARATION } from "../../../atmosphere/ATMOSPHERE_UNIT_SCALE.js";
1
2
  import { CodeChunk } from "../../compiler/CodeChunk.js";
2
3
  import { ATMOSPHERE_HEIGHT_DECLARATION } from "./ATMOSPHERE_HEIGHT_DECLARATION.js";
3
4
  import { chunk_sphere_intersection } from "./chunk_sphere_intersection.js";
@@ -8,12 +9,19 @@ export const chunk_atmosphere_intersection = CodeChunk.from(
8
9
  //language=WGSL
9
10
  `
10
11
  fn atmosphere_intersection (
11
- rayStart:vec3<f32>,
12
- rayDir:vec3<f32>
12
+ rayStart: vec3<f32>,
13
+ rayDir: vec3<f32>
13
14
  ) -> vec2<f32> {
14
- return sphere_intersection(rayStart, rayDir, PLANET_CENTER, PLANET_RADIUS + ATMOSPHERE_HEIGHT);
15
+ let hits = sphere_intersection(
16
+ rayStart * METERS_TO_ATMOSPHERE_UNITS,
17
+ rayDir,
18
+ PLANET_CENTER,
19
+ PLANET_RADIUS + ATMOSPHERE_HEIGHT
20
+ );
21
+ return select(hits, hits * ATMOSPHERE_UNIT_METERS, hits >= vec2<f32>(0.0));
15
22
  }
16
23
  `, [
24
+ ATMOSPHERE_UNIT_SCALE_DECLARATION,
17
25
  chunk_sphere_intersection,
18
26
  PLANET_CENTER_DECLARATION,
19
27
  PLANET_RADIUS_DECLARATION,
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_atmosphere_ray_bounds.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,0CAFU,SAAS,CAiDjB;0BApEwB,6BAA6B"}
1
+ {"version":3,"file":"chunk_atmosphere_ray_bounds.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,0CAFU,SAAS,CAgDjB;0BAnEwB,6BAA6B"}
@@ -1,69 +1,68 @@
1
- import { CodeChunk } from "../../compiler/CodeChunk.js";
2
- import { ATMOSPHERE_RADII_DECLARATION } from "./ATMOSPHERE_RADII_DECLARATION.js";
3
-
4
- /**
5
- * How far a ray inside the atmosphere may be marched, and whether it ends on the surface.
6
- *
7
- * The ground and the atmosphere shell are concentric on the planet and the ray is shared, so
8
- * one quadratic setup serves both intersections — only the radius term differs. Calling a
9
- * general sphere-intersection routine twice instead recomputes the ray-origin offset and all
10
- * three dot products for the second sphere, and re-derives a leading coefficient that is 1
11
- * for a unit direction.
12
- *
13
- * `origin_rel` is relative to the planet centre and assumed to be inside the atmosphere and
14
- * at or above the surface, which is what makes the shell's far root the exit point.
15
- * `ray_direction` must be normalised.
16
- *
17
- * `ground_distance` is negative when the ray never meets the surface, which includes looking
18
- * up from above it: both roots are behind the origin there.
19
- *
20
- * @type {CodeChunk}
21
- */
22
- export const chunk_atmosphere_ray_bounds = CodeChunk.from(
23
- //language=WGSL
24
- `
25
- struct AtmosphereRayBounds {
26
- // as far as a march may go: the surface when the ray meets it, the shell otherwise
27
- t_max: f32,
28
- // distance to the surface, negative when there is no hit ahead
29
- ground_distance: f32,
30
- hits_ground: bool,
31
- }
32
-
33
- fn atmosphere_ray_bounds(
34
- origin_rel: vec3<f32>,
35
- ray_direction: vec3<f32>
36
- ) -> AtmosphereRayBounds {
37
-
38
- // ray_direction is a unit vector, so the leading coefficient is 1 and the factors of two
39
- // divide out of both roots
40
- let b = dot(origin_rel, ray_direction);
41
- let r2 = dot(origin_rel, origin_rel);
42
- let b2 = b * b;
43
-
44
- // inside the shell, so its constant term is negative, the discriminant is positive, and
45
- // the far root is where the ray leaves
46
- let atmosphere_distance = -b + sqrt(max(b2 - (r2 - ATMOSPHERE_TOP_RADIUS_SQUARED), 0.0));
47
-
48
- // the ground is the near root, and only when that root is ahead of us
49
- let ground_discriminant = b2 - (r2 - ATMOSPHERE_GROUND_RADIUS_SQUARED);
50
- let ground_distance = select(
51
- -1.0,
52
- -b - sqrt(max(ground_discriminant, 0.0)),
53
- ground_discriminant >= 0.0
54
- );
55
-
56
- let hits_ground = ground_distance > 0.0;
57
-
58
- var result: AtmosphereRayBounds;
59
-
60
- result.t_max = select(atmosphere_distance, ground_distance, hits_ground);
61
- result.ground_distance = ground_distance;
62
- result.hits_ground = hits_ground;
63
-
64
- return result;
65
- }
66
- `, [
67
- ATMOSPHERE_RADII_DECLARATION,
68
- ]
69
- );
1
+ import { CodeChunk } from "../../compiler/CodeChunk.js";
2
+ import { ATMOSPHERE_RADII_DECLARATION } from "./ATMOSPHERE_RADII_DECLARATION.js";
3
+
4
+ /**
5
+ * How far a ray inside the atmosphere may be marched, and whether it ends on the surface.
6
+ *
7
+ * The ground and the atmosphere shell are concentric on the planet and the ray is shared, so
8
+ * one quadratic setup serves both intersections — only the radius term differs. Calling a
9
+ * general sphere-intersection routine twice instead recomputes the ray-origin offset and all
10
+ * three dot products for the second sphere, and re-derives a leading coefficient that is 1
11
+ * for a unit direction.
12
+ *
13
+ * `origin_rel` is relative to the planet centre and assumed to be inside the atmosphere and
14
+ * at or above the surface, which is what makes the shell's far root the exit point.
15
+ * `ray_direction` must be normalised.
16
+ *
17
+ * `ground_distance` is negative when the ray never meets the surface, which includes looking
18
+ * up from above it: both roots are behind the origin there.
19
+ *
20
+ * @type {CodeChunk}
21
+ */
22
+ export const chunk_atmosphere_ray_bounds = CodeChunk.from(
23
+ //language=WGSL
24
+ `
25
+ struct AtmosphereRayBounds {
26
+ // as far as a march may go: the surface when the ray meets it, the shell otherwise
27
+ t_max: f32,
28
+ // distance to the surface, negative when there is no hit ahead
29
+ ground_distance: f32,
30
+ hits_ground: bool,
31
+ }
32
+
33
+ fn atmosphere_ray_bounds(
34
+ origin_rel: vec3<f32>,
35
+ ray_direction: vec3<f32>
36
+ ) -> AtmosphereRayBounds {
37
+
38
+ // ray_direction is a unit vector, so the leading coefficient is 1 and the factors of two
39
+ // divide out of both roots
40
+ let b = dot(origin_rel, ray_direction);
41
+ let r = length(origin_rel);
42
+ let b2 = b * b;
43
+
44
+ // Difference-of-squares factoring (r - R)(r + R) avoids catastrophic f32 cancellation when
45
+ // altitude (r - R) is metres above a 6,378 km planet radius.
46
+ let atmosphere_distance = -b + sqrt(max(b2 - (r - ATMOSPHERE_TOP_RADIUS) * (r + ATMOSPHERE_TOP_RADIUS), 0.0));
47
+
48
+ // the ground is the near root, and only when that root is ahead of us
49
+ let ground_discriminant = b2 - (r - ATMOSPHERE_GROUND_RADIUS) * (r + ATMOSPHERE_GROUND_RADIUS);
50
+ let hits_ground = (b < 0.0) && (ground_discriminant >= 0.0);
51
+ let ground_distance = select(
52
+ -1.0,
53
+ max(-b - sqrt(max(ground_discriminant, 0.0)), 0.0),
54
+ hits_ground
55
+ );
56
+
57
+ var result: AtmosphereRayBounds;
58
+
59
+ result.t_max = select(atmosphere_distance, ground_distance, hits_ground);
60
+ result.ground_distance = ground_distance;
61
+ result.hits_ground = hits_ground;
62
+
63
+ return result;
64
+ }
65
+ `, [
66
+ ATMOSPHERE_RADII_DECLARATION,
67
+ ]
68
+ );
@@ -1,5 +1,8 @@
1
1
  /**
2
- * @see https://www.shadertoy.com/view/slSXRW
2
+ * Integrates direct solar transmittance from `pos` along `sunDir` to the top of the atmosphere,
3
+ * returning zero when the ray intersects the planet sphere.
4
+ *
5
+ * @see "A Scalable and Production Ready Sky and Atmosphere Rendering Technique", Hillaire (2020)
3
6
  * @type {CodeChunk}
4
7
  */
5
8
  export const chunk_get_sun_transmittance: CodeChunk;
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_get_sun_transmittance.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,0CAFU,SAAS,CA+CjB;0BA1DwB,6BAA6B"}
1
+ {"version":3,"file":"chunk_get_sun_transmittance.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,0CAFU,SAAS,CAsDjB;0BA7DwB,6BAA6B"}