@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.
- package/package.json +1 -1
- package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine.js +4 -9
- package/src/engine/graphics3/load_cube_environment.js +3 -3
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/format/lut/cube/CubeLut.d.ts +38 -0
- package/src/format/lut/cube/CubeLut.d.ts.map +1 -0
- package/src/format/lut/cube/CubeLut.js +23 -0
- package/src/format/lut/cube/cube_read.d.ts +23 -0
- package/src/format/lut/cube/cube_read.d.ts.map +1 -0
- package/src/format/lut/cube/cube_read.js +199 -0
- package/src/format/lut/cube/cube_write.d.ts +15 -0
- package/src/format/lut/cube/cube_write.d.ts.map +1 -0
- package/src/format/lut/cube/cube_write.js +90 -0
- package/src/shade/playground/probe_clipmap/README.md +1 -0
- package/src/shade/playground/probe_clipmap/index.html +48 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +36 -0
- package/src/shade/renderer/Renderer.d.ts +7 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +225 -27
- package/src/shade/renderer/ShadeIndirectLightingMode.d.ts +1 -0
- package/src/shade/renderer/ShadeIndirectLightingMode.js +9 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +22 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js +160 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts +45 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.js +57 -0
- package/src/shade/renderer/atmosphere/GPUSky.d.ts +23 -8
- package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/GPUSky.js +91 -34
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts +17 -0
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.js +55 -25
- package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts +164 -0
- package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/SceneAtmosphere.js +308 -0
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts +3 -12
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.js +52 -89
- package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts +14 -0
- package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.js +103 -0
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts +10 -4
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js +95 -57
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts +10 -14
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js +97 -69
- package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts +17 -0
- package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.js +117 -48
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts +8 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.js +65 -35
- package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts +2 -1
- package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/compute_mie_absorption.js +6 -6
- package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts +41 -0
- package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.js +123 -0
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +21 -64
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts +6 -2
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +55 -179
- package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts +7 -0
- package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/shader_sky_view_lut.js +111 -0
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts +0 -1
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +68 -79
- package/src/shade/renderer/deferred/shader_background.js +1 -1
- package/src/shade/renderer/deferred/shader_background_sky.d.ts +5 -0
- package/src/shade/renderer/deferred/shader_background_sky.d.ts.map +1 -0
- package/src/shade/renderer/deferred/shader_background_sky.js +130 -0
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +73 -4
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ColorGrade.js +113 -7
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts +12 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.js +12 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +15 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.js +31 -3
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +26 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +55 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +2 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.js +6 -3
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +3 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.js +7 -3
- package/src/shade/renderer/extension/ViewTextures.d.ts +3 -2
- package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
- package/src/shade/renderer/extension/ViewTextures.js +3 -2
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +20 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +29 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts +47 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js +246 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +4 -15
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +8 -148
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +4 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +9 -58
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +142 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +938 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +192 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +231 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +11 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +25 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +110 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +197 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +150 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +408 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +23 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +63 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts +24 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.js +61 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +39 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +126 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +21 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +74 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts +20 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.js +26 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts +24 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.js +57 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +22 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +53 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +62 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +156 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts +18 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.js +50 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +21 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +54 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +67 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +509 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts +20 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.js +128 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +62 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +478 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +69 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +457 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +27 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +219 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +22 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +151 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +66 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +301 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +59 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +364 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +40 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +275 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -1
- package/src/shade/renderer/grass/blade/GPUGrassBlades.js +17 -2
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +18 -8
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -1
- package/src/shade/renderer/grass/blade/grass_blade_resolve.js +114 -32
- package/src/shade/renderer/light/GPULightCollection.d.ts +1 -1
- package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
- package/src/shade/renderer/light/GPULightCollection.js +213 -80
- package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.d.ts +1 -2
- package/src/shade/renderer/light/environment/chunk_sample_environment_color.d.ts.map +1 -0
- package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.js +3 -4
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -1
- package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js +1 -1
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +35 -9
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +81 -11
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +4 -1
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +1 -1
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +1 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +1 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +1 -1
- package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.js +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +2 -0
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +2 -0
- package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +6 -0
- package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +9 -1
- package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.js +4 -3
- package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts +17 -0
- package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.js +16 -0
- package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts +21 -0
- package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.js +30 -0
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -5
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +19 -17
- package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.js +2 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +2 -1
- package/src/shade/renderer/scene/Scene.d.ts +9 -2
- package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/Scene.js +10 -2
- package/src/shade/renderer/shader/ImageShader.d.ts +24 -12
- package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ImageShader.js +11 -8
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts +3 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js +11 -3
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts +2 -11
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js +23 -32
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js +14 -2
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js +4 -2
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js +11 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js +68 -69
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts +4 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js +46 -39
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js +5 -3
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +7 -0
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +4 -4
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +86 -5
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +73 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +139 -0
- package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.js +30 -0
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js +60 -0
- package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.d.ts → io/chunk_light_get_sun.d.ts} +3 -6
- package/src/shade/renderer/shader/chunk/light/io/chunk_light_get_sun.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.js → io/chunk_light_get_sun.js} +6 -26
- package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.js +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +3 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -2
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +743 -739
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +2 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +19 -17
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +5 -3
- package/src/shade/renderer/water/chunk_water_gi.js +2 -0
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts +0 -2
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +0 -45
- package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts +0 -2
- package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +0 -17
- package/src/engine/graphics/sh3/sky/hosek/README.md +0 -4
- package/src/engine/graphics/sh3/sky/hosek/data.d.ts +0 -17
- package/src/engine/graphics/sh3/sky/hosek/data.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/data.js +0 -3744
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts +0 -2
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +0 -71
- package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts +0 -26
- package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.js +0 -70
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +0 -22
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +0 -388
- package/src/engine/graphics3/make_default_environment.d.ts +0 -15
- package/src/engine/graphics3/make_default_environment.d.ts.map +0 -1
- package/src/engine/graphics3/make_default_environment.js +0 -111
- package/src/shade/renderer/atmosphere/MIE_G.d.ts +0 -6
- package/src/shade/renderer/atmosphere/MIE_G.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/MIE_G.js +0 -5
- package/src/shade/renderer/atmosphere/chunk_sample_environment_color.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts +0 -4
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.js +0 -44
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +0 -2
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.js +0 -43
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.js +0 -6
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.js +0 -18
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts +0 -14
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.js +0 -86
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts +0 -8
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.js +0 -125
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.js +0 -17
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.js +0 -38
- package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts +0 -16
- package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.js +0 -28
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts +0 -11
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.js +0 -56
- package/src/shade/renderer/shader/chunk/light/sky/chunk_sample_sky_color.d.ts.map +0 -1
- package/src/shade/renderer/view/GPUViewSkyContext.d.ts +0 -26
- package/src/shade/renderer/view/GPUViewSkyContext.d.ts.map +0 -1
- package/src/shade/renderer/view/GPUViewSkyContext.js +0 -170
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { v3_quaternion_apply } from "../../../core/geom/vec3/v3_quaternion_apply.js";
|
|
2
|
+
import { TRANSFORM64_ROTATION_OFFSET } from "../../../engine/ecs/transform/Transform64.js";
|
|
3
|
+
import { light_pack_color } from "../light/model/io/light_pack_color.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import("../scene/Scene.js").Scene} Scene
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} AtmosphereSunState
|
|
11
|
+
* @property {Float32Array} sun_direction world-space unit vector pointing **toward** the sun
|
|
12
|
+
* @property {Float32Array} sun_irradiance extraterrestrial RGB irradiance driving atmospheric scattering
|
|
13
|
+
* @property {number} sun_disk_radius angular half-radius of the solar disc in radians
|
|
14
|
+
* @property {number} sun_has_disc `1` when an explicit directional sun disc should be drawn, `0` otherwise
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const _forward = new Float64Array(3);
|
|
18
|
+
const _packed_color = new Float32Array(3);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Allocate a reusable {@link AtmosphereSunState} container so per-frame updates perform zero heap
|
|
22
|
+
* allocations.
|
|
23
|
+
*
|
|
24
|
+
* @returns {AtmosphereSunState}
|
|
25
|
+
*/
|
|
26
|
+
export function create_atmosphere_sun_state() {
|
|
27
|
+
return {
|
|
28
|
+
sun_direction: new Float32Array([0, 1, 0]),
|
|
29
|
+
sun_irradiance: new Float32Array(3),
|
|
30
|
+
sun_disk_radius: 0,
|
|
31
|
+
sun_has_disc: 0,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the active solar light driving {@link Scene#atmosphere}:
|
|
37
|
+
* 1. The first `DirectionalLight` in `scene.lights.elements`, using `-forward` as the direction
|
|
38
|
+
* pointing **toward** the sun (`DirectionalLight` shines along `+Z` / `forward`).
|
|
39
|
+
* 2. Otherwise, when `atmosphere.fallback_sun_enabled` is true, the fallback sun configured on
|
|
40
|
+
* {@link SceneAtmosphere} (with `sun_has_disc = 0` so sunless scenes get skylight IBL without
|
|
41
|
+
* an unshadowed solar disc).
|
|
42
|
+
* 3. Otherwise, zero irradiance.
|
|
43
|
+
*
|
|
44
|
+
* @param {Scene} scene
|
|
45
|
+
* @param {AtmosphereSunState} [out]
|
|
46
|
+
* @returns {AtmosphereSunState}
|
|
47
|
+
*/
|
|
48
|
+
export function resolve_atmosphere_sun(scene, out = create_atmosphere_sun_state()) {
|
|
49
|
+
const atmosphere = scene.atmosphere;
|
|
50
|
+
const scale = Math.max(0, atmosphere.sun_irradiance_scale);
|
|
51
|
+
const lights = scene.lights.elements;
|
|
52
|
+
|
|
53
|
+
for (let i = 0; i < lights.length; i++) {
|
|
54
|
+
const light = lights[i];
|
|
55
|
+
if (light.isDirectionalLight !== true) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const t = light.transform;
|
|
60
|
+
v3_quaternion_apply(
|
|
61
|
+
_forward, 0,
|
|
62
|
+
0, 0, 1,
|
|
63
|
+
t[TRANSFORM64_ROTATION_OFFSET],
|
|
64
|
+
t[TRANSFORM64_ROTATION_OFFSET + 1],
|
|
65
|
+
t[TRANSFORM64_ROTATION_OFFSET + 2],
|
|
66
|
+
t[TRANSFORM64_ROTATION_OFFSET + 3]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const len = Math.hypot(_forward[0], _forward[1], _forward[2]);
|
|
70
|
+
if (len > 1e-6) {
|
|
71
|
+
out.sun_direction[0] = -_forward[0] / len;
|
|
72
|
+
out.sun_direction[1] = -_forward[1] / len;
|
|
73
|
+
out.sun_direction[2] = -_forward[2] / len;
|
|
74
|
+
} else {
|
|
75
|
+
out.sun_direction[0] = 0;
|
|
76
|
+
out.sun_direction[1] = 1;
|
|
77
|
+
out.sun_direction[2] = 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
light_pack_color(_packed_color, 0, light.color, Math.max(0, light.intensity));
|
|
81
|
+
|
|
82
|
+
out.sun_irradiance[0] = _packed_color[0] * scale;
|
|
83
|
+
out.sun_irradiance[1] = _packed_color[1] * scale;
|
|
84
|
+
out.sun_irradiance[2] = _packed_color[2] * scale;
|
|
85
|
+
|
|
86
|
+
const disk_radius = Math.max(0, light.radius);
|
|
87
|
+
out.sun_disk_radius = disk_radius;
|
|
88
|
+
out.sun_has_disc = disk_radius > 0 ? 1 : 0;
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (atmosphere.fallback_sun_enabled) {
|
|
93
|
+
const fb_dir = atmosphere.fallback_sun_direction;
|
|
94
|
+
const len = Math.hypot(fb_dir[0], fb_dir[1], fb_dir[2]);
|
|
95
|
+
if (len > 1e-6) {
|
|
96
|
+
out.sun_direction[0] = fb_dir[0] / len;
|
|
97
|
+
out.sun_direction[1] = fb_dir[1] / len;
|
|
98
|
+
out.sun_direction[2] = fb_dir[2] / len;
|
|
99
|
+
} else {
|
|
100
|
+
out.sun_direction[0] = 0;
|
|
101
|
+
out.sun_direction[1] = 1;
|
|
102
|
+
out.sun_direction[2] = 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const fb_irr = atmosphere.fallback_sun_irradiance;
|
|
106
|
+
out.sun_irradiance[0] = Math.max(0, fb_irr[0]) * scale;
|
|
107
|
+
out.sun_irradiance[1] = Math.max(0, fb_irr[1]) * scale;
|
|
108
|
+
out.sun_irradiance[2] = Math.max(0, fb_irr[2]) * scale;
|
|
109
|
+
out.sun_disk_radius = 0;
|
|
110
|
+
out.sun_has_disc = 0;
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
out.sun_direction[0] = 0;
|
|
115
|
+
out.sun_direction[1] = 1;
|
|
116
|
+
out.sun_direction[2] = 0;
|
|
117
|
+
out.sun_irradiance[0] = 0;
|
|
118
|
+
out.sun_irradiance[1] = 0;
|
|
119
|
+
out.sun_irradiance[2] = 0;
|
|
120
|
+
out.sun_disk_radius = 0;
|
|
121
|
+
out.sun_has_disc = 0;
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_multiscatter_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/shader_multiscatter_lut.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader_multiscatter_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/shader_multiscatter_lut.js"],"names":[],"mappings":"AAoHA,oDAIG;8BArH2B,4BAA4B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WebGPUExtensionType } from "../../descriptor/WebGPUExtensionType.js";
|
|
2
|
-
import { ATMOSPHERE_HEIGHT_DECLARATION } from "../shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js";
|
|
3
2
|
import { chunk_safe_acos } from "../shader/chunk/math/chunk_safe_acos.js";
|
|
4
3
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
5
4
|
import { ComputeShader } from "../shader/ComputeShader.js";
|
|
6
5
|
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
6
|
+
import { ATMOSPHERE_PARAMETERS_STRUCT } from "./ATMOSPHERE_PARAMETERS_STRUCT.js";
|
|
7
7
|
import { chunk_get_multiscatter_values } from "./chunk_get_multiscatter_values.js";
|
|
8
8
|
import { chunk_multiscatter_sample_direction } from "./chunk_multiscatter_sample_direction.js";
|
|
9
9
|
import { chunk_sky_lut_texel_to_unit } from "./chunk_sky_lut_texel_to_unit.js";
|
|
@@ -11,36 +11,23 @@ import {
|
|
|
11
11
|
MULTISCATTER_LUT_DIRECTION_COUNT,
|
|
12
12
|
MULTISCATTER_LUT_MAX_SUBGROUP_PARTIALS
|
|
13
13
|
} from "./MULTISCATTER_LUT_CONFIG.js";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
SKY_LUT_SAMPLER_RESOURCE,
|
|
16
|
+
SKY_LUT_TRANSMITTANCE_RESOURCE
|
|
17
|
+
} from "./SAMPLER_SKY_LUT.js";
|
|
15
18
|
|
|
16
19
|
const resources = new ShaderResourceSetDescriptor();
|
|
17
20
|
resources.createGroup()
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.
|
|
22
|
-
.addSampler("sSkyLut", "filtering", SAMPLER_SKY_LUT)
|
|
23
|
-
.addStorageTexture("tSkyLutMultiscatterOut", "rgba16float")
|
|
24
|
-
;
|
|
25
|
-
|
|
21
|
+
.addUniform("atmosphere", ATMOSPHERE_PARAMETERS_STRUCT)
|
|
22
|
+
.add(SKY_LUT_TRANSMITTANCE_RESOURCE)
|
|
23
|
+
.add(SKY_LUT_SAMPLER_RESOURCE)
|
|
24
|
+
.addStorageTexture("tSkyLutMultiscatterOut", "rgba16float");
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
|
-
*
|
|
29
|
-
* the value is the multiple scattering approximation (Psi_ms from the paper, Eq. 10).
|
|
30
|
-
*
|
|
27
|
+
* Multiple-scattering LUT (`32×32` `rgba16float`, $\Psi_{\text{ms}}$ from Hillaire 2020 Eq. 10).
|
|
31
28
|
* One workgroup per LUT texel, one thread per direction (64 threads per workgroup).
|
|
32
|
-
* The 64 directions used to be a serial loop
|
|
33
|
-
* inside a fragment shader, which left the whole pass with 32*32 = 1024 threads of
|
|
34
|
-
* parallelism -- a few dozen waves, one per scheduler at best, with nothing to hide the
|
|
35
|
-
* latency of the transmittance fetches. Per-thread it is now a single direction's 20-step
|
|
36
|
-
* march.
|
|
37
|
-
*
|
|
38
|
-
* The per-direction results are summed with `subgroupAdd` and then across subgroups through
|
|
39
|
-
* workgroup memory, collapsing a six-step groupshared log-reduction into one subgroup
|
|
40
|
-
* instruction plus a handful of partials.
|
|
41
29
|
*
|
|
42
30
|
* @see "A Scalable and Production Ready Sky and Atmosphere Rendering Technique", Hillaire (2020)
|
|
43
|
-
* @see https://www.shadertoy.com/view/slSXRW
|
|
44
31
|
* @type {CodeChunk}
|
|
45
32
|
*/
|
|
46
33
|
const body = CodeChunk.from(
|
|
@@ -58,56 +45,33 @@ fn main(
|
|
|
58
45
|
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
59
46
|
@builtin(local_invocation_index) thread_index: u32,
|
|
60
47
|
) {
|
|
61
|
-
|
|
62
48
|
if (thread_index == 0u) {
|
|
63
49
|
atomicStore(&wg_partial_count, 0u);
|
|
64
50
|
}
|
|
65
51
|
|
|
66
|
-
// Every thread is here together anyway, so the counter's initialisation costs nothing
|
|
67
|
-
// beyond the barrier itself. WGSL does not promise workgroup variables start zeroed.
|
|
68
52
|
workgroupBarrier();
|
|
69
53
|
|
|
70
|
-
// one workgroup per texel; the dispatch is sized from the texture, so this is in range
|
|
71
54
|
let texel = workgroup_id.xy;
|
|
72
|
-
|
|
73
55
|
let lut_size = vec2<f32>(textureDimensions(tSkyLutMultiscatterOut));
|
|
74
|
-
|
|
75
|
-
// The point of each range this texel stands for: texel 0 carries the bottom and the last
|
|
76
|
-
// texel the top, which is what lets a lookup at either end read a value computed there
|
|
77
|
-
// rather than one from half a texel inside. sky_lut_uv is the other half of this.
|
|
78
56
|
let unit = sky_lut_texel_to_unit(vec2<f32>(texel), lut_size);
|
|
79
57
|
|
|
80
|
-
let sunCosTheta = 2.0*unit.x - 1.0;
|
|
58
|
+
let sunCosTheta = 2.0 * unit.x - 1.0;
|
|
81
59
|
let sunTheta = safe_acos(sunCosTheta);
|
|
82
60
|
|
|
83
|
-
let height =
|
|
84
|
-
|
|
85
|
-
let pos = vec3(0.0, height, 0.0);
|
|
86
|
-
let sunDir = normalize(vec3(0.0, sunCosTheta, -sin(sunTheta)));
|
|
61
|
+
let height = atmosphere.atmosphere_height * unit.y;
|
|
87
62
|
|
|
88
|
-
|
|
89
|
-
|
|
63
|
+
let origin_rel = vec3<f32>(0.0, atmosphere.planet_radius + height, 0.0);
|
|
64
|
+
let sunDir = normalize(vec3<f32>(0.0, sunCosTheta, -sin(sunTheta)));
|
|
90
65
|
let rayDir = multiscatter_sample_direction(thread_index);
|
|
91
66
|
|
|
92
|
-
var lum:vec3<f32>;
|
|
93
|
-
var f_ms:vec3<f32>;
|
|
67
|
+
var lum: vec3<f32>;
|
|
68
|
+
var f_ms: vec3<f32>;
|
|
94
69
|
|
|
95
|
-
|
|
70
|
+
get_multiscatter_values_rel_for(atmosphere, origin_rel, sunDir, rayDir, &lum, &f_ms);
|
|
96
71
|
|
|
97
|
-
// Uniform control flow up to here, so every one of the workgroup's threads is an active
|
|
98
|
-
// lane and the subgroup sum covers all of them.
|
|
99
72
|
let lum_subgroup = subgroupAdd(lum);
|
|
100
73
|
let fms_subgroup = subgroupAdd(f_ms);
|
|
101
74
|
|
|
102
|
-
// subgroupElect picks exactly one active invocation per subgroup, and the slot it claims
|
|
103
|
-
// is whichever the counter hands out. Deriving the slot from local_invocation_index /
|
|
104
|
-
// subgroup_size instead would assume invocations are packed into subgroups in contiguous
|
|
105
|
-
// index order, which WGSL leaves unspecified: a mapping that is not contiguous blocks
|
|
106
|
-
// would collide two subgroups onto one slot and silently drop a partial sum. Which slot
|
|
107
|
-
// a subgroup lands in does not matter, only that it gets its own.
|
|
108
|
-
//
|
|
109
|
-
// Every lane holds the same subgroup sum, so letting them all store it would be a data
|
|
110
|
-
// race on one address even though the values agree.
|
|
111
75
|
if (subgroupElect()) {
|
|
112
76
|
let slot = atomicAdd(&wg_partial_count, 1u);
|
|
113
77
|
|
|
@@ -121,34 +85,27 @@ fn main(
|
|
|
121
85
|
return;
|
|
122
86
|
}
|
|
123
87
|
|
|
124
|
-
// WGSL pins the subgroup size to a power of two in [4, 128], so the workgroup cannot hold
|
|
125
|
-
// more subgroups than the partials array has room for. The clamp keeps a driver that
|
|
126
|
-
// broke that promise reading initialised slots rather than garbage.
|
|
127
88
|
let partial_count = min(atomicLoad(&wg_partial_count), MULTISCATTER_MAX_SUBGROUP_PARTIALS);
|
|
128
89
|
|
|
129
|
-
var lum_total = vec3(0.0);
|
|
130
|
-
var fms_total = vec3(0.0);
|
|
90
|
+
var lum_total = vec3<f32>(0.0);
|
|
91
|
+
var fms_total = vec3<f32>(0.0);
|
|
131
92
|
|
|
132
93
|
for (var i = 0u; i < partial_count; i++) {
|
|
133
94
|
lum_total += wg_lum[i];
|
|
134
95
|
fms_total += wg_fms[i];
|
|
135
96
|
}
|
|
136
97
|
|
|
137
|
-
// The directions carry equal solid angle, so the mean over them is the spherical average
|
|
138
|
-
// the paper's uniform phase reduces to.
|
|
139
98
|
let inv_samples = 1.0 / f32(MULTISCATTER_DIRECTION_COUNT);
|
|
140
99
|
|
|
141
100
|
lum_total *= inv_samples;
|
|
142
101
|
fms_total *= inv_samples;
|
|
143
102
|
|
|
144
|
-
|
|
145
|
-
let psi = lum_total / (1.0 - fms_total);
|
|
103
|
+
let psi = lum_total / max(vec3<f32>(1.0) - fms_total, vec3<f32>(1e-4));
|
|
146
104
|
|
|
147
|
-
textureStore(tSkyLutMultiscatterOut, texel, vec4(psi, 1.0));
|
|
105
|
+
textureStore(tSkyLutMultiscatterOut, texel, vec4<f32>(psi, 1.0));
|
|
148
106
|
}
|
|
149
107
|
`, [
|
|
150
108
|
chunk_safe_acos,
|
|
151
|
-
ATMOSPHERE_HEIGHT_DECLARATION,
|
|
152
109
|
chunk_multiscatter_sample_direction,
|
|
153
110
|
chunk_sky_lut_texel_to_unit,
|
|
154
111
|
chunk_get_multiscatter_values,
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Default side of the scene's octahedral procedural sky map (including the one-texel octahedral
|
|
3
|
+
* skirt). $256 \times 256$ yields 9 mip levels (`256 >> 4 = 16 >= 3` at the roughest prefilter
|
|
4
|
+
* level) while baking in ~0.1 ms whenever the sun or atmosphere changes.
|
|
5
|
+
*
|
|
4
6
|
* @type {number}
|
|
5
7
|
*/
|
|
6
8
|
export const SKY_IRRADIANCE_LUT_RESOLUTION: number;
|
|
9
|
+
export const SKY_IRRADIANCE_LUT_SETTINGS_STRUCT: WebGPUStruct;
|
|
7
10
|
export const shader_sky_irradiance_lut: ImageShader;
|
|
11
|
+
import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
|
|
8
12
|
import { ImageShader } from "../shader/ImageShader.js";
|
|
9
13
|
//# sourceMappingURL=shader_sky_irradiance_lut.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_sky_irradiance_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader_sky_irradiance_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js"],"names":[],"mappings":"AAqBA;;;;;;GAMG;AACH,4CAFU,MAAM,CAEiC;AAEjD,8DAK+B;AAyD/B,oDAWG;6BA5F0B,gCAAgC;4BAJjC,0BAA0B"}
|
|
@@ -1,31 +1,6 @@
|
|
|
1
|
-
import { WebGPUArray } from "../shader/type/WebGPUArray.js";
|
|
2
|
-
import { CAMERA_UNIFORM_STRUCT } from "../camera/CAMERA_UNIFORM_STRUCT.js";
|
|
3
|
-
import { ATMOSPHERE_HEIGHT_DECLARATION } from "../shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js";
|
|
4
|
-
import {
|
|
5
|
-
C_MIE_ABSORPTION_DECLARATION,
|
|
6
|
-
C_MIE_SCATTERING_DECLARATION
|
|
7
|
-
} from "../shader/chunk/atmosphere/C_MIE_SCATTERING_DECLARATION.js";
|
|
8
|
-
import { C_OZONE_DECLARATION } from "../shader/chunk/atmosphere/C_OZONE_DECLARATION.js";
|
|
9
|
-
import { C_RAYLEIGH_DECLARATION } from "../shader/chunk/atmosphere/C_RAYLEIGH_DECLARATION.js";
|
|
10
|
-
import { ATMOSPHERE_RADII_DECLARATION } from "../shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js";
|
|
11
|
-
import { chunk_atmosphere_density } from "../shader/chunk/atmosphere/chunk_atmosphere_density.js";
|
|
12
|
-
import { chunk_atmosphere_ray_bounds } from "../shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js";
|
|
13
|
-
import {
|
|
14
|
-
chunk_position_relative_to_planet_center
|
|
15
|
-
} from "../shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js";
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
chunk_phase_mie_cornette_shanks
|
|
19
|
-
} from "../shader/chunk/atmosphere/phase/chunk_phase_mie_cornette_shanks.js";
|
|
20
|
-
import { chunk_phase_rayleigh } from "../shader/chunk/atmosphere/phase/chunk_phase_rayleigh.js";
|
|
21
|
-
import { PLANET_RADIUS_DECLARATION } from "../shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js";
|
|
22
|
-
import { chunk_mat4_extract_position } from "../shader/chunk/geometry/mat4/chunk_mat4_extract_position.js";
|
|
23
1
|
import {
|
|
24
2
|
chunk_uv_octahedral_unit_decode
|
|
25
3
|
} from "../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
|
|
26
|
-
import { chunk_light_get_sun } from "../shader/chunk/light/sky/chunk_sample_sky_color.js";
|
|
27
|
-
import { chunk_safe_acos } from "../shader/chunk/math/chunk_safe_acos.js";
|
|
28
|
-
import { PI_DECLARATION } from "../shader/chunk/math/PI_DECLARATION.js";
|
|
29
4
|
import {
|
|
30
5
|
chunk_texture_octahedral_skirt_texel_uv
|
|
31
6
|
} from "../shader/chunk/texture/octahedral/chunk_texture_octahedral_skirt_texel_uv.js";
|
|
@@ -33,128 +8,42 @@ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
|
33
8
|
import { ImageShader } from "../shader/ImageShader.js";
|
|
34
9
|
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
35
10
|
import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
|
|
11
|
+
import { f32, u32, vec3f } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
12
|
+
import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
|
|
36
13
|
import { ATMOSPHERE_ALTITUDE_CUTOFF } from "./ATMOSPHERE_ALTITUDE_CUTOFF.js";
|
|
37
|
-
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
|
|
14
|
+
import { ATMOSPHERE_PARAMETERS_STRUCT } from "./ATMOSPHERE_PARAMETERS_STRUCT.js";
|
|
15
|
+
import { chunk_raymarch_sky_scattering } from "./chunk_raymarch_sky_scattering.js";
|
|
16
|
+
import {
|
|
17
|
+
SKY_LUT_MULTISCATTER_RESOURCE,
|
|
18
|
+
SKY_LUT_SAMPLER_RESOURCE,
|
|
19
|
+
SKY_LUT_TRANSMITTANCE_RESOURCE
|
|
20
|
+
} from "./SAMPLER_SKY_LUT.js";
|
|
42
21
|
|
|
43
22
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
23
|
+
* Default side of the scene's octahedral procedural sky map (including the one-texel octahedral
|
|
24
|
+
* skirt). $256 \times 256$ yields 9 mip levels (`256 >> 4 = 16 >= 3` at the roughest prefilter
|
|
25
|
+
* level) while baking in ~0.1 ms whenever the sun or atmosphere changes.
|
|
26
|
+
*
|
|
46
27
|
* @type {number}
|
|
47
28
|
*/
|
|
48
|
-
const
|
|
29
|
+
export const SKY_IRRADIANCE_LUT_RESOLUTION = 256;
|
|
49
30
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
export const SKY_IRRADIANCE_LUT_SETTINGS_STRUCT = WebGPUStruct.from({
|
|
32
|
+
sun_direction: vec3f,
|
|
33
|
+
reference_altitude: f32,
|
|
34
|
+
sun_irradiance: vec3f,
|
|
35
|
+
resolution: u32,
|
|
36
|
+
}, "SkyIrradianceLutSettings");
|
|
56
37
|
|
|
57
38
|
const resources = new ShaderResourceSetDescriptor();
|
|
58
39
|
|
|
59
|
-
resources.
|
|
60
|
-
.addUniform("camera", CAMERA_UNIFORM_STRUCT)
|
|
61
|
-
// "float" rather than the default "unfilterable-float": both LUTs are rgba16float,
|
|
62
|
-
// which is filterable in core WebGPU, so they go through the texture unit rather than a
|
|
63
|
-
// 4-tap manual bilinear -- see chunk_sample_transmittance_lut.
|
|
64
|
-
.addTexture("tSkyLutTransmittance", "float")
|
|
65
|
-
.addTexture("tSkyLutMultiscatter", "float")
|
|
66
|
-
.addSampler("sSkyLut", "filtering", SAMPLER_SKY_LUT)
|
|
67
|
-
;
|
|
40
|
+
resources.setImmediate("settings", SKY_IRRADIANCE_LUT_SETTINGS_STRUCT);
|
|
68
41
|
|
|
69
42
|
resources.createGroup()
|
|
70
|
-
.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
`
|
|
75
|
-
const SKY_IRRADIANCE_STEPS = ${SKY_IRRADIANCE_LUT_STEPS}u;
|
|
76
|
-
const SKY_IRRADIANCE_STEPS_F = f32(SKY_IRRADIANCE_STEPS);
|
|
77
|
-
|
|
78
|
-
fn raymarch_scattering(
|
|
79
|
-
origin_rel: vec3<f32>,
|
|
80
|
-
ray_dir: vec3<f32>,
|
|
81
|
-
sun_dir: vec3<f32>,
|
|
82
|
-
tMax: f32
|
|
83
|
-
) -> vec3<f32> {
|
|
84
|
-
let cosTheta = dot(ray_dir, sun_dir);
|
|
85
|
-
|
|
86
|
-
let miePhaseValue = phase_mie(cosTheta, ${MIE_G});
|
|
87
|
-
let rayleighPhaseValue = phase_rayleigh(-cosTheta);
|
|
88
|
-
|
|
89
|
-
var lum = vec3(0.0);
|
|
90
|
-
var transmittance = vec3(1.0);
|
|
91
|
-
|
|
92
|
-
var t = 0.0;
|
|
93
|
-
for (var step_i = 0u; step_i < SKY_IRRADIANCE_STEPS; step_i++) {
|
|
94
|
-
|
|
95
|
-
let newT = ((f32(step_i) + 0.3)/SKY_IRRADIANCE_STEPS_F)*tMax;
|
|
96
|
-
let dt = newT - t;
|
|
97
|
-
t = newT;
|
|
98
|
-
|
|
99
|
-
// One square root for the whole step. Marching the planet-relative position yields
|
|
100
|
-
// the altitude and the up vector from the same length, and both LUT lookups take
|
|
101
|
-
// that pair directly -- each used to recover it from a world position of its own,
|
|
102
|
-
// which was three lengths and two normalizes per step for one step's worth of work.
|
|
103
|
-
let step_rel = origin_rel + t * ray_dir;
|
|
104
|
-
let step_radius = length(step_rel);
|
|
105
|
-
let up = step_rel / step_radius;
|
|
106
|
-
|
|
107
|
-
let local_height = step_radius - ATMOSPHERE_GROUND_RADIUS;
|
|
108
|
-
let sun_cos_zenith_angle = dot(sun_dir, up);
|
|
109
|
-
|
|
110
|
-
let local_density = atmosphere_density(local_height);
|
|
111
|
-
|
|
112
|
-
let ozone_density = local_density.z;
|
|
113
|
-
let ozone_absorption = ozone_density * C_OZONE;
|
|
114
|
-
|
|
115
|
-
let mie_density = local_density.y;
|
|
116
|
-
let mie_absorption = mie_density * C_MIE_ABSORPTION;
|
|
117
|
-
let mie_scattering = mie_density * C_MIE_SCATTERING;
|
|
118
|
-
|
|
119
|
-
// Rayleigh does not absorb
|
|
120
|
-
let rayleigh_absorption = 0.0;
|
|
121
|
-
let rayleigh_scattering = local_density.x * C_RAYLEIGH;
|
|
122
|
-
|
|
123
|
-
let extinction = rayleigh_scattering + rayleigh_absorption + mie_scattering + mie_absorption + ozone_absorption;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
let sample_transmittance = exp( -dt * extinction );
|
|
127
|
-
|
|
128
|
-
let sun_transmittance = sample_transmittance_lut_params(local_height, sun_cos_zenith_angle);
|
|
129
|
-
let psiMS = sample_multiscatter_lut_params(local_height, sun_cos_zenith_angle);
|
|
130
|
-
|
|
131
|
-
let rayleigh_in_scattering = rayleigh_scattering * ( rayleighPhaseValue * sun_transmittance + psiMS );
|
|
132
|
-
let mie_in_scattering = mie_scattering * ( miePhaseValue * sun_transmittance + psiMS );
|
|
133
|
-
let in_scattering = ( rayleigh_in_scattering + mie_in_scattering );
|
|
134
|
-
|
|
135
|
-
// Integrated scattering within path segment.
|
|
136
|
-
let scattering_integral = ( in_scattering - in_scattering * sample_transmittance ) / extinction;
|
|
137
|
-
|
|
138
|
-
lum += scattering_integral * transmittance;
|
|
139
|
-
|
|
140
|
-
transmittance *= sample_transmittance;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return lum;
|
|
144
|
-
}
|
|
145
|
-
`, [
|
|
146
|
-
ATMOSPHERE_RADII_DECLARATION,
|
|
147
|
-
chunk_atmosphere_density,
|
|
148
|
-
chunk_phase_mie_cornette_shanks,
|
|
149
|
-
chunk_phase_rayleigh,
|
|
150
|
-
chunk_sample_transmittance_lut_params,
|
|
151
|
-
chunk_sample_multiscatter_lut_params,
|
|
152
|
-
C_MIE_ABSORPTION_DECLARATION,
|
|
153
|
-
C_MIE_SCATTERING_DECLARATION,
|
|
154
|
-
C_OZONE_DECLARATION,
|
|
155
|
-
C_RAYLEIGH_DECLARATION,
|
|
156
|
-
]
|
|
157
|
-
);
|
|
43
|
+
.addUniform("atmosphere", ATMOSPHERE_PARAMETERS_STRUCT)
|
|
44
|
+
.add(SKY_LUT_TRANSMITTANCE_RESOURCE)
|
|
45
|
+
.add(SKY_LUT_MULTISCATTER_RESOURCE)
|
|
46
|
+
.add(SKY_LUT_SAMPLER_RESOURCE);
|
|
158
47
|
|
|
159
48
|
const body = CodeChunk.from(
|
|
160
49
|
//language=WGSL
|
|
@@ -164,53 +53,40 @@ fn main(
|
|
|
164
53
|
@builtin(position) coord: vec4<f32>,
|
|
165
54
|
@location(0) uv: vec2<f32>,
|
|
166
55
|
) -> @location(0) vec4<f32> {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
let up = normalize(relative_position);
|
|
173
|
-
|
|
174
|
-
let height = length(relative_position);
|
|
175
|
-
|
|
176
|
-
// force view into valid range
|
|
177
|
-
let clamped_height = clamp(height , PLANET_RADIUS + ${ATMOSPHERE_ALTITUDE_CUTOFF}, PLANET_RADIUS + ATMOSPHERE_HEIGHT - ${ATMOSPHERE_ALTITUDE_CUTOFF});
|
|
178
|
-
|
|
179
|
-
// planet-relative, which is what both the bounds and the march want
|
|
180
|
-
let view_rel = up * clamped_height;
|
|
181
|
-
|
|
182
|
-
// skirt texels compute their interior twin's direction, so the skirt is a copy of it
|
|
183
|
-
let rayDir = uv_octahedral_unit_decode(texture_octahedral_skirt_texel_uv(vec2<u32>(coord.xy), ${SKY_IRRADIANCE_LUT_RESOLUTION}u));
|
|
184
|
-
|
|
185
|
-
let sun = light_get_sun();
|
|
186
|
-
|
|
187
|
-
let sunAltitude = ( 0.5 * PI ) - safe_acos( dot(-sun.direction, up) );
|
|
188
|
-
let sunDir = vec3(0.0, sin(sunAltitude), -cos(sunAltitude));
|
|
189
|
-
|
|
190
|
-
// one quadratic setup for both spheres, rather than two calls sharing an origin and a
|
|
191
|
-
// centre that differ only in radius
|
|
192
|
-
let bounds = atmosphere_ray_bounds(view_rel, rayDir);
|
|
193
|
-
|
|
194
|
-
let lum = raymarch_scattering(view_rel, rayDir, sunDir, bounds.t_max);
|
|
195
|
-
|
|
196
|
-
// TODO validate this, it "feels" wrong to me
|
|
197
|
-
let irradiance = lum * sun.color;
|
|
198
|
-
|
|
199
|
-
return vec4(irradiance, 1.0);
|
|
56
|
+
let sun_len_sq = dot(settings.sun_direction, settings.sun_direction);
|
|
57
|
+
if (sun_len_sq <= 1e-12 || all(settings.sun_irradiance <= vec3<f32>(0.0))) {
|
|
58
|
+
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
59
|
+
}
|
|
200
60
|
|
|
61
|
+
let sun_dir = settings.sun_direction * inverseSqrt(sun_len_sq);
|
|
62
|
+
|
|
63
|
+
let min_alt = ${ATMOSPHERE_ALTITUDE_CUTOFF.toFixed(1)} * METERS_TO_ATMOSPHERE_UNITS;
|
|
64
|
+
let max_alt = max(min_alt, atmosphere.atmosphere_height - min_alt);
|
|
65
|
+
let clamped_alt = clamp(settings.reference_altitude * METERS_TO_ATMOSPHERE_UNITS, min_alt, max_alt);
|
|
66
|
+
let view_rel = vec3<f32>(0.0, atmosphere.planet_radius + clamped_alt, 0.0);
|
|
67
|
+
|
|
68
|
+
// Skirt texels decode their interior twin's world direction so the one-texel border matches
|
|
69
|
+
// octahedral_skirt_matches without a separate copy pass.
|
|
70
|
+
let ray_dir = uv_octahedral_unit_decode(
|
|
71
|
+
texture_octahedral_skirt_texel_uv(vec2<u32>(coord.xy), settings.resolution)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
let bounds = atmosphere_ray_bounds_for(atmosphere, view_rel, ray_dir);
|
|
75
|
+
let lum = raymarch_sky_scattering(
|
|
76
|
+
atmosphere,
|
|
77
|
+
view_rel,
|
|
78
|
+
ray_dir,
|
|
79
|
+
sun_dir,
|
|
80
|
+
bounds.t_max,
|
|
81
|
+
bounds.hits_ground
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
return vec4<f32>(lum * settings.sun_irradiance, 1.0);
|
|
201
85
|
}
|
|
202
86
|
`, [
|
|
203
|
-
chunk_safe_acos,
|
|
204
|
-
chunk_light_get_sun,
|
|
205
|
-
chunk_position_relative_to_planet_center,
|
|
206
|
-
chunk_mat4_extract_position,
|
|
207
|
-
PLANET_RADIUS_DECLARATION,
|
|
208
|
-
ATMOSPHERE_HEIGHT_DECLARATION,
|
|
209
|
-
PI_DECLARATION,
|
|
210
|
-
chunk_atmosphere_ray_bounds,
|
|
211
87
|
chunk_uv_octahedral_unit_decode,
|
|
212
88
|
chunk_texture_octahedral_skirt_texel_uv,
|
|
213
|
-
|
|
89
|
+
chunk_raymarch_sky_scattering,
|
|
214
90
|
]
|
|
215
91
|
);
|
|
216
92
|
|
|
@@ -225,4 +101,4 @@ export const shader_sky_irradiance_lut = new ImageShader({
|
|
|
225
101
|
format: "rgba16float"
|
|
226
102
|
}
|
|
227
103
|
]
|
|
228
|
-
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const SKY_VIEW_LUT_WIDTH: 192;
|
|
2
|
+
export const SKY_VIEW_LUT_HEIGHT: 108;
|
|
3
|
+
export const SKY_VIEW_LUT_SETTINGS_STRUCT: WebGPUStruct;
|
|
4
|
+
export const shader_sky_view_lut: ImageShader;
|
|
5
|
+
import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
|
|
6
|
+
import { ImageShader } from "../shader/ImageShader.js";
|
|
7
|
+
//# sourceMappingURL=shader_sky_view_lut.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_sky_view_lut.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/shader_sky_view_lut.js"],"names":[],"mappings":"AAiBA,qCAAsC;AACtC,sCAAuC;AAEvC,wDAKyB;AAyEzB,8CAYG;6BAvG0B,gCAAgC;4BAJjC,0BAA0B"}
|