@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,21 @@
1
+ /**
2
+ * A pixel's texel of the velocity buffer (`VELOCITY_FORMAT`), from its surface point now and where that point stood a
3
+ * frame ago:
4
+ *
5
+ * ```wgsl
6
+ * fn velocity_texel(pixel: vec2<f32>, depth: f32, before: vec4<f32>, size: vec2<f32>) -> vec4<f32>
7
+ * ```
8
+ *
9
+ * - `pixel`: the pixel's centre, in the view's internal pixels; `size`: the view's size in them.
10
+ * - `depth`: the point's clip w this frame.
11
+ * - `before`: the point a frame ago, in last frame's clip space.
12
+ *
13
+ * Both clip spaces are the un-jittered projections' (`view_velocity_matrices`). The texel's z is the clip w now less
14
+ * then, which a perspective projection makes the view depth; under an orthographic one, whose w is always one, it is
15
+ * zero.
16
+ *
17
+ * @type {CodeChunk}
18
+ */
19
+ export const chunk_velocity_texel: CodeChunk;
20
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
21
+ //# sourceMappingURL=chunk_velocity_texel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_velocity_texel.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/velocity/chunk_velocity_texel.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,mCAFU,SAAS,CAWhB;0BA7BuB,oCAAoC"}
@@ -0,0 +1,30 @@
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+
3
+ /**
4
+ * A pixel's texel of the velocity buffer (`VELOCITY_FORMAT`), from its surface point now and where that point stood a
5
+ * frame ago:
6
+ *
7
+ * ```wgsl
8
+ * fn velocity_texel(pixel: vec2<f32>, depth: f32, before: vec4<f32>, size: vec2<f32>) -> vec4<f32>
9
+ * ```
10
+ *
11
+ * - `pixel`: the pixel's centre, in the view's internal pixels; `size`: the view's size in them.
12
+ * - `depth`: the point's clip w this frame.
13
+ * - `before`: the point a frame ago, in last frame's clip space.
14
+ *
15
+ * Both clip spaces are the un-jittered projections' (`view_velocity_matrices`). The texel's z is the clip w now less
16
+ * then, which a perspective projection makes the view depth; under an orthographic one, whose w is always one, it is
17
+ * zero.
18
+ *
19
+ * @type {CodeChunk}
20
+ */
21
+ export const chunk_velocity_texel = CodeChunk.from(
22
+ //language=WGSL
23
+ `
24
+ fn velocity_texel(pixel: vec2<f32>, depth: f32, before: vec4<f32>, size: vec2<f32>) -> vec4<f32> {
25
+ let ndc = before.xy / before.w;
26
+ let previous = vec2<f32>((ndc.x + 1.0) * 0.5 * size.x, (1.0 - ndc.y) * 0.5 * size.y);
27
+
28
+ return vec4<f32>(pixel - previous, depth - before.w, 0.0);
29
+ }
30
+ `);
@@ -27,10 +27,12 @@ export function enquire_per_object_velocity_pipelines(enquiry: PipelineEnquiry):
27
27
  * per-vertex skin deformation (the limb-ghosting case Stage 1
28
28
  * couldn't address) on top of the per-object motion.
29
29
  *
30
- * The skinned and rigid foreground branches both produce
31
- * pixel-space deltas in the same units, so downstream consumers
32
- * (TAA, motion blur) just see velocity — no skinning-awareness
33
- * needed at any layer above this pass.
30
+ * The skinned and rigid foreground branches both produce the
31
+ * velocity buffer's texel (`VELOCITY_FORMAT`: pixel deltas and the
32
+ * view depth moved through), so downstream consumers (TAA, motion
33
+ * blur, the screen probes) just see velocity — no
34
+ * skinning-awareness needed at any layer above this pass. The
35
+ * background's depth delta is zero.
34
36
  *
35
37
  * Un-jittered matrices are CPU-built from
36
38
  * `camera.projection_matrix × camera.view_matrix` — viewport
@@ -51,7 +53,7 @@ export function enquire_per_object_velocity_pipelines(enquiry: PipelineEnquiry):
51
53
  * placeholders and the shader forces the rigid path.
52
54
  * @param {number[]} args.resolution
53
55
  * @param {GPUViewContext} args.view
54
- * @returns {number} FrameGraph handle to the velocity texture (rg16float)
56
+ * @returns {number} FrameGraph handle to the velocity texture (`VELOCITY_FORMAT`)
55
57
  */
56
58
  export function graph_add_per_object_velocity({ graph, texture_depth, texture_visibility, buffer_visible_meshlets, buffer_scene_database, buffer_meshlet_metadata, buffer_meshlet_data, buffer_prev_position_offsets, buffer_prev_positions, skinning_active, resolution, view, }: {
57
59
  graph: FrameGraph;
@@ -1 +1 @@
1
- {"version":3,"file":"graph_add_per_object_velocity.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js"],"names":[],"mappings":"AA8QA;;;;GAIG;AACH,+DAFW,eAAe,QAIzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;IAhB4B,KAAK;IACT,aAAa,EAA1B,MAAM;IACO,kBAAkB,EAA/B,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,mBAAmB,EAAhC,MAAM;IACO,4BAA4B,EAAzC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACQ,eAAe,EAA7B,OAAO;IAGQ,UAAU,EAAzB,MAAM,EAAE;IACa,IAAI;IACvB,MAAM,CA+DlB;8BA9VY,OAAO,6CAA6C,EAAE,eAAe"}
1
+ {"version":3,"file":"graph_add_per_object_velocity.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js"],"names":[],"mappings":"AA8QA;;;;GAIG;AACH,+DAFW,eAAe,QAIzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH;IAhB4B,KAAK;IACT,aAAa,EAA1B,MAAM;IACO,kBAAkB,EAA/B,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,mBAAmB,EAAhC,MAAM;IACO,4BAA4B,EAAzC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACQ,eAAe,EAA7B,OAAO;IAGQ,UAAU,EAAzB,MAAM,EAAE;IACa,IAAI;IACvB,MAAM,CA+DlB;8BA9VY,OAAO,6CAA6C,EAAE,eAAe"}
@@ -30,7 +30,9 @@ import { graph_image_pass } from "../../shader/graph/graph_image_pass.js";
30
30
  import { ImageShader } from "../../shader/ImageShader.js";
31
31
  import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
32
32
  import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
33
+ import { chunk_velocity_texel } from "./chunk_velocity_texel.js";
33
34
  import { construct_pixel_reprojection_matrix } from "./construct_pixel_reprojection_matrix.js";
35
+ import { VELOCITY_FORMAT } from "./VELOCITY_BUFFER.js";
34
36
  import { view_velocity_matrices } from "./view_velocity_matrices.js";
35
37
  import {
36
38
  construct_reprojection_matrix_rotation_only,
@@ -92,7 +94,7 @@ fn read_prev_position(base: u32, vertex_index: u32) -> vec3<f32> {
92
94
  @fragment
93
95
  fn main(
94
96
  @builtin(position) coord: vec4<f32>,
95
- ) -> @location(0) vec2<f32> {
97
+ ) -> @location(0) vec4<f32> {
96
98
 
97
99
  let cur_px = coord.xy;
98
100
  let texel = vec2<u32>(cur_px);
@@ -103,12 +105,13 @@ fn main(
103
105
  // Visibility-buffer clears leave VISIBILITY_NONE on sky
104
106
  // pixels, where reverse-Z depth is always 0.0. Passing 0.0
105
107
  // directly avoids a tDepth textureLoad on every background pixel.
108
+ // The sky stands infinitely far, so it has no depth to move through.
106
109
  if visibility_word == VISIBILITY_NONE {
107
110
  let position_previous = v3_matrix4_project(
108
111
  vec3<f32>(cur_px, 0.0),
109
112
  mReprojectionRotation
110
113
  );
111
- return cur_px - position_previous.xy;
114
+ return vec4<f32>(cur_px - position_previous.xy, 0.0, 0.0);
112
115
  }
113
116
 
114
117
  // ── Reconstruct world-space position for this pixel ─────────
@@ -233,15 +236,11 @@ fn main(
233
236
  prev_world = prev_world_h.xyz / prev_world_h.w;
234
237
  }
235
238
 
236
- // ── Project to previous frame, compute pixel delta ──────────
237
- let prev_clip = mViewProjPrevious * vec4<f32>(prev_world, 1.0);
238
- let prev_ndc = prev_clip.xyz / prev_clip.w;
239
- let prev_px = vec2<f32>(
240
- (prev_ndc.x + 1.0) * 0.5 * res.x,
241
- (1.0 - prev_ndc.y) * 0.5 * res.y,
242
- );
243
-
244
- return cur_px - prev_px;
239
+ // ── Project to previous frame: the pixel and depth deltas ───
240
+ //
241
+ // This frame's clip w, the point's view depth, is the reciprocal of
242
+ // the w its unprojection came out with.
243
+ return velocity_texel(cur_px, 1.0 / cur_world_h.w, mViewProjPrevious * vec4<f32>(prev_world, 1.0), res);
245
244
  }
246
245
  `, [
247
246
  chunk_v3_matrix4_project,
@@ -251,6 +250,7 @@ fn main(
251
250
  chunk_read_meshlet_vertex_position,
252
251
  MESHLET_METADATA_STRUCT.declaration_chunk,
253
252
  chunk_visibility_decode,
253
+ chunk_velocity_texel,
254
254
  ]
255
255
  );
256
256
 
@@ -261,7 +261,7 @@ const shader = new ImageShader({
261
261
  body
262
262
  }),
263
263
  targets: [{
264
- format: "rg16float",
264
+ format: VELOCITY_FORMAT,
265
265
  }]
266
266
  });
267
267
 
@@ -300,10 +300,12 @@ export function enquire_per_object_velocity_pipelines(enquiry) {
300
300
  * per-vertex skin deformation (the limb-ghosting case Stage 1
301
301
  * couldn't address) on top of the per-object motion.
302
302
  *
303
- * The skinned and rigid foreground branches both produce
304
- * pixel-space deltas in the same units, so downstream consumers
305
- * (TAA, motion blur) just see velocity — no skinning-awareness
306
- * needed at any layer above this pass.
303
+ * The skinned and rigid foreground branches both produce the
304
+ * velocity buffer's texel (`VELOCITY_FORMAT`: pixel deltas and the
305
+ * view depth moved through), so downstream consumers (TAA, motion
306
+ * blur, the screen probes) just see velocity — no
307
+ * skinning-awareness needed at any layer above this pass. The
308
+ * background's depth delta is zero.
307
309
  *
308
310
  * Un-jittered matrices are CPU-built from
309
311
  * `camera.projection_matrix × camera.view_matrix` — viewport
@@ -324,7 +326,7 @@ export function enquire_per_object_velocity_pipelines(enquiry) {
324
326
  * placeholders and the shader forces the rigid path.
325
327
  * @param {number[]} args.resolution
326
328
  * @param {GPUViewContext} args.view
327
- * @returns {number} FrameGraph handle to the velocity texture (rg16float)
329
+ * @returns {number} FrameGraph handle to the velocity texture (`VELOCITY_FORMAT`)
328
330
  */
329
331
  export function graph_add_per_object_velocity({
330
332
  graph,
@@ -35,3 +35,5 @@ chunk_forward_sample_indirect.add(ShadeIndirectLightingMode.IBL, chunk_forward_s
35
35
  chunk_forward_sample_indirect.add(ShadeIndirectLightingMode.Brick4, chunk_forward_sample_indirect_brick4);
36
36
  chunk_forward_sample_indirect.add(ShadeIndirectLightingMode.LPV, chunk_forward_sample_indirect_environment);
37
37
  chunk_forward_sample_indirect.add(ShadeIndirectLightingMode.ProbeClipmap, chunk_forward_sample_indirect_probe_clipmap);
38
+ // the screen probes light only the deferred opaque surfaces: every other reader takes the world-space probes
39
+ chunk_forward_sample_indirect.add(ShadeIndirectLightingMode.ScreenProbes, chunk_forward_sample_indirect_probe_clipmap);
@@ -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,