@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.
- 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/shade/playground/probe_clipmap/index.html +43 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +29 -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 +213 -15
- 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/chunk_tonemap_purkinje.d.ts +2 -1
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +6 -2
- 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/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/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +18 -10
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +30 -27
- 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/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
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import Vector3 from "../../core/geom/Vector3.js";
|
|
2
|
-
import { Sampler2D } from "../graphics/texture/sampler/Sampler2D.js";
|
|
3
|
-
import { sampler2d_to_f16 } from "../graphics/texture/sampler/sampler2d_to_f16.js";
|
|
4
|
-
import { octahedral_z_pole_uv_to_direction } from "../../shade/renderer/light/environment/octahedral_z_pole_uv_to_direction.js";
|
|
5
|
-
import { sampler2d_octahedral_skirt_fill } from "../../shade/renderer/light/environment/sampler2d_octahedral_skirt_fill.js";
|
|
6
|
-
import { ColorSpace } from "../../shade/renderer/texture/ColorSpace.js";
|
|
7
|
-
import { ShadeImage } from "../../shade/renderer/texture/source/ShadeImage.js";
|
|
8
|
-
import { ShadeTexture } from "../../shade/renderer/texture/ShadeTexture.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Side of the generated map, its one-texel octahedral skirt included.
|
|
12
|
-
*
|
|
13
|
-
* Small on purpose. This is an *ambient* source — it is convolved into irradiance and a handful of
|
|
14
|
-
* roughness mips before anything samples it, so detail here buys nothing. What it has to be is
|
|
15
|
-
* smooth and correctly oriented.
|
|
16
|
-
*
|
|
17
|
-
* @type {number}
|
|
18
|
-
*/
|
|
19
|
-
const RESOLUTION = 128;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @type {Vector3}
|
|
23
|
-
*/
|
|
24
|
-
const SCRATCH_DIRECTION = new Vector3();
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Radiance arriving from a direction, in linear space.
|
|
28
|
-
*
|
|
29
|
-
* A plausible outdoor sky, not a simulation: sky above, ground below, and a brighter band where they
|
|
30
|
-
* meet. The engine has a full atmosphere model available and this deliberately does not use it —
|
|
31
|
-
* what is wanted is a sane default, and an atmospheric solve is a much larger thing to own.
|
|
32
|
-
*
|
|
33
|
-
* @param {number[]} out rgb
|
|
34
|
-
* @param {number} x direction
|
|
35
|
-
* @param {number} y direction, +Y is up
|
|
36
|
-
* @param {number} z direction
|
|
37
|
-
*/
|
|
38
|
-
function sky_radiance(out, x, y, z) {
|
|
39
|
-
if (y >= 0) {
|
|
40
|
-
// Zenith to horizon. The falloff is steep near the top and flattens toward the horizon,
|
|
41
|
-
// which is what makes a gradient read as sky rather than as a ramp.
|
|
42
|
-
const t = Math.pow(1 - y, 3);
|
|
43
|
-
|
|
44
|
-
out[0] = 0.18 + t * 0.62;
|
|
45
|
-
out[1] = 0.32 + t * 0.60;
|
|
46
|
-
out[2] = 0.62 + t * 0.34;
|
|
47
|
-
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Below the horizon: diffuse bounce off the ground, dimmer and warmer than the sky, fading as it
|
|
52
|
-
// points further down. Getting this wrong is what makes objects look like they are floating —
|
|
53
|
-
// the underside of everything is lit by it.
|
|
54
|
-
const t = Math.pow(1 + y, 2);
|
|
55
|
-
|
|
56
|
-
out[0] = 0.10 + t * 0.28;
|
|
57
|
-
out[1] = 0.09 + t * 0.25;
|
|
58
|
-
out[2] = 0.08 + t * 0.20;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Build the environment the engine lights with when nobody has supplied one.
|
|
63
|
-
*
|
|
64
|
-
* **Shade assumes global illumination**, and that is a deliberate quality decision rather than a
|
|
65
|
-
* limitation: indirect light is on, and a scene with no environment renders unlit. So the default is
|
|
66
|
-
* something the engine *provides*. Turning GI off is the thing that takes an explicit choice.
|
|
67
|
-
*
|
|
68
|
-
* The map is octahedral because that is the projection `scene.lights.environment` is sampled with,
|
|
69
|
-
* and half-float because that is what the octahedral path is built for.
|
|
70
|
-
*
|
|
71
|
-
* @returns {ShadeTexture}
|
|
72
|
-
*/
|
|
73
|
-
export function make_default_environment() {
|
|
74
|
-
const sampler = Sampler2D.float32(4, RESOLUTION, RESOLUTION);
|
|
75
|
-
|
|
76
|
-
const data = sampler.data;
|
|
77
|
-
const rgb = [0, 0, 0];
|
|
78
|
-
|
|
79
|
-
// the octahedral square inside the one-texel skirt an environment map carries
|
|
80
|
-
const interior = RESOLUTION - 2;
|
|
81
|
-
|
|
82
|
-
for (let v = 1; v <= interior; v++) {
|
|
83
|
-
for (let u = 1; u <= interior; u++) {
|
|
84
|
-
// texel centres, so the mapping is symmetric across the octahedron's folds
|
|
85
|
-
octahedral_z_pole_uv_to_direction(
|
|
86
|
-
SCRATCH_DIRECTION,
|
|
87
|
-
(u - 0.5) / interior,
|
|
88
|
-
(v - 0.5) / interior
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
sky_radiance(rgb, SCRATCH_DIRECTION.x, SCRATCH_DIRECTION.y, SCRATCH_DIRECTION.z);
|
|
92
|
-
|
|
93
|
-
const offset = (v * RESOLUTION + u) * 4;
|
|
94
|
-
|
|
95
|
-
data[offset] = rgb[0];
|
|
96
|
-
data[offset + 1] = rgb[1];
|
|
97
|
-
data[offset + 2] = rgb[2];
|
|
98
|
-
data[offset + 3] = 1;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
sampler2d_octahedral_skirt_fill(sampler);
|
|
103
|
-
|
|
104
|
-
const image = ShadeImage.fromSampler2D(sampler2d_to_f16(sampler));
|
|
105
|
-
|
|
106
|
-
// radiance, not colour: the values above are light arriving, and treating them as sRGB would
|
|
107
|
-
// put a transfer curve through numbers that never had one
|
|
108
|
-
image.color_space = ColorSpace.LinearSRGB;
|
|
109
|
-
|
|
110
|
-
return ShadeTexture.from(image);
|
|
111
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MIE_G.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/MIE_G.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAFU,MAAM,CAES"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_sample_environment_color.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/atmosphere/chunk_sample_environment_color.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,6CAFU,SAAS,CAcjB;0BArBwB,iCAAiC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ATMOSPHERE_EARTH.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.js"],"names":[],"mappings":""}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { compute_mie_absorption } from "../compute_mie_absorption.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* info.absorption_density.layers[0] = { 25.0f, 0.0f, 0.0f, 1.0f / 15.0f, -2.0f / 3.0f };
|
|
5
|
-
* info.absorption_density.layers[1] = { 0.0f, 0.0f, 0.0f, -1.0f / 15.0f, 8.0f / 3.0f };
|
|
6
|
-
* info.absorption_extinction = { 0.000650f, 0.001881f, 0.000085f }; // 1/km
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Earth-like atmospheric parametrization
|
|
11
|
-
*
|
|
12
|
-
* NOTE: all values are in Km (not m)
|
|
13
|
-
* @see "A Scalable and Production Ready Sky and Atmosphere Rendering Technique", Hillaire (2020)
|
|
14
|
-
*/
|
|
15
|
-
export const ATMOSPHERE_EARTH = {
|
|
16
|
-
BottomRadius: 6378,
|
|
17
|
-
|
|
18
|
-
// 100km atmosphere radius, less edge visible and it contains 99.99% of the atmosphere medium https://en.wikipedia.org/wiki/K%C3%A1rm%C3%A1n_line
|
|
19
|
-
TopRadius: 6378 + 100,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
RayleighDensityExpScale: -1 / 8,
|
|
23
|
-
RayleighScattering: [0.005802, 0.013558, 0.033100], // 1/km
|
|
24
|
-
|
|
25
|
-
MieDensityExpScale: -1 / 1.2,
|
|
26
|
-
MieScattering: [0.003996, 0.003996, 0.003996], // 1/km
|
|
27
|
-
MieExtinction: [0.004440, 0.004440, 0.004440], // 1/km
|
|
28
|
-
|
|
29
|
-
MiePhaseG: 0.8,
|
|
30
|
-
|
|
31
|
-
// Ozone
|
|
32
|
-
AbsorptionDensity0LayerWidth: 25.0,
|
|
33
|
-
AbsorptionDensity0ConstantTerm: -2.0 / 3.0,
|
|
34
|
-
AbsorptionDensity0LinearTerm: 1.0 / 15.0,
|
|
35
|
-
|
|
36
|
-
AbsorptionDensity1ConstantTerm: 8.0 / 3.0,
|
|
37
|
-
AbsorptionDensity1LinearTerm: -1.0 / 15.0,
|
|
38
|
-
|
|
39
|
-
AbsorptionExtinction: [0.000650, 0.001881, 0.000085], // 1/km
|
|
40
|
-
|
|
41
|
-
GroundAlbedo: [0.0, 0.0, 0.0]
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
ATMOSPHERE_EARTH.MieAbsorption = compute_mie_absorption(ATMOSPHERE_EARTH.MieScattering, ATMOSPHERE_EARTH.MieExtinction);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ATMOSPHERE_PARAMETERS_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.js"],"names":[],"mappings":""}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { f32, vec3f } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
2
|
-
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Atmosphere parameters uniform struct ("A Scalable and Production Ready Sky and Atmosphere Rendering Technique", Hillaire 2020).
|
|
6
|
-
* @type {WebGPUStruct}
|
|
7
|
-
*/
|
|
8
|
-
const ATMOSPHERE_PARAMETERS_STRUCT = WebGPUStruct.from({
|
|
9
|
-
|
|
10
|
-
// Radius of the planet (center to ground)
|
|
11
|
-
BottomRadius: f32,
|
|
12
|
-
// Maximum considered atmosphere height (center to atmosphere top)
|
|
13
|
-
TopRadius: f32,
|
|
14
|
-
|
|
15
|
-
// Rayleigh scattering exponential distribution scale in the atmosphere
|
|
16
|
-
RayleighDensityExpScale: f32,
|
|
17
|
-
// Rayleigh scattering coefficients
|
|
18
|
-
RayleighScattering: vec3f,
|
|
19
|
-
|
|
20
|
-
// Mie scattering exponential distribution scale in the atmosphere
|
|
21
|
-
MieDensityExpScale: f32,
|
|
22
|
-
// Mie scattering coefficients
|
|
23
|
-
MieScattering: vec3f,
|
|
24
|
-
// Mie extinction coefficients
|
|
25
|
-
MieExtinction: vec3f,
|
|
26
|
-
// Mie absorption coefficients
|
|
27
|
-
MieAbsorption: vec3f,
|
|
28
|
-
// Mie phase function excentricity
|
|
29
|
-
MiePhaseG: f32,
|
|
30
|
-
|
|
31
|
-
// Another medium type in the atmosphere
|
|
32
|
-
AbsorptionDensity0LayerWidth: "f32",
|
|
33
|
-
AbsorptionDensity0ConstantTerm: "f32",
|
|
34
|
-
AbsorptionDensity0LinearTerm: "f32",
|
|
35
|
-
AbsorptionDensity1ConstantTerm: "f32",
|
|
36
|
-
AbsorptionDensity1LinearTerm: "f32",
|
|
37
|
-
// This other medium only absorb light, e.g. useful to represent ozone in the earth atmosphere
|
|
38
|
-
AbsorptionExtinction: "vec3<f32>",
|
|
39
|
-
|
|
40
|
-
// The albedo of the ground.
|
|
41
|
-
GroundAlbedo: "vec3<f32>"
|
|
42
|
-
|
|
43
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ATMOSPHERE_DENSITY_DECLARATION.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.js"],"names":[],"mappings":"AAEA,uDAGE;0BALwB,6BAA6B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_absorb.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.js"],"names":[],"mappings":"AAIA,qCAaC;0BAjByB,6BAA6B"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
2
|
-
import { ATMOSPHERE_DENSITY_DECLARATION } from "./ATMOSPHERE_DENSITY_DECLARATION.js";
|
|
3
|
-
import { chunk_compute_extinction } from "./chunk_compute_extinction.js";
|
|
4
|
-
// Calculate a luminance transmittance value from optical depth.
|
|
5
|
-
export const chunk_absorb = CodeChunk.from(
|
|
6
|
-
//language=WGSL
|
|
7
|
-
`
|
|
8
|
-
fn absorb ( optical_depth:vec3<f32> ) -> vec3<f32>
|
|
9
|
-
{
|
|
10
|
-
let extinction = compute_extinction(optical_depth);
|
|
11
|
-
|
|
12
|
-
return exp(- extinction * ATMOSPHERE_DENSITY);
|
|
13
|
-
}
|
|
14
|
-
`, [
|
|
15
|
-
ATMOSPHERE_DENSITY_DECLARATION,
|
|
16
|
-
chunk_compute_extinction,
|
|
17
|
-
]
|
|
18
|
-
)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Optical depth is a unitless measurement of the amount of absorption of a participating medium (such as the atmosphere).
|
|
3
|
-
* This function calculates just that for our three atmospheric elements:
|
|
4
|
-
* R: Rayleigh
|
|
5
|
-
* G: Mie
|
|
6
|
-
* B: Ozone
|
|
7
|
-
* If you find the term "optical depth" confusing, you can think of it as "how much density was found along the ray in total".
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/blender/blender/blob/7675b5a0b4edc4480818abb626b38f799f15acf8/intern/sky/source/sky_nishita.cpp#L177
|
|
10
|
-
* @see https://github.com/Fewes/MinimalAtmosphere
|
|
11
|
-
*/
|
|
12
|
-
export const chunk_integrate_optical_depth: CodeChunk;
|
|
13
|
-
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
14
|
-
//# sourceMappingURL=chunk_integrate_optical_depth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_integrate_optical_depth.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.js"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,sDAqEM;0BArFoB,6BAA6B"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
2
|
-
import { chunk_atmosphere_density } from "./chunk_atmosphere_density.js";
|
|
3
|
-
import { chunk_atmosphere_height } from "./chunk_atmosphere_height.js";
|
|
4
|
-
import { chunk_atmosphere_intersection } from "./chunk_atmosphere_intersection.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Optical depth is a unitless measurement of the amount of absorption of a participating medium (such as the atmosphere).
|
|
8
|
-
* This function calculates just that for our three atmospheric elements:
|
|
9
|
-
* R: Rayleigh
|
|
10
|
-
* G: Mie
|
|
11
|
-
* B: Ozone
|
|
12
|
-
* If you find the term "optical depth" confusing, you can think of it as "how much density was found along the ray in total".
|
|
13
|
-
*
|
|
14
|
-
* @see https://github.com/blender/blender/blob/7675b5a0b4edc4480818abb626b38f799f15acf8/intern/sky/source/sky_nishita.cpp#L177
|
|
15
|
-
* @see https://github.com/Fewes/MinimalAtmosphere
|
|
16
|
-
*/
|
|
17
|
-
export const chunk_integrate_optical_depth = CodeChunk.from(
|
|
18
|
-
//language=WGSL
|
|
19
|
-
`
|
|
20
|
-
fn integrate_optical_depth (
|
|
21
|
-
ray_origin:vec3<f32>,
|
|
22
|
-
ray_direction:vec3<f32>,
|
|
23
|
-
) -> vec3<f32> {
|
|
24
|
-
|
|
25
|
-
/* Parameters for optical depth quadrature.
|
|
26
|
-
* See the comment in ray_optical_depth for more detail.
|
|
27
|
-
* Computed using sympy and following Python code:
|
|
28
|
-
* # from sympy.integrals.quadrature import gauss_laguerre
|
|
29
|
-
* # from sympy import exp
|
|
30
|
-
* # x, w = gauss_laguerre(8, 50)
|
|
31
|
-
* # xend = 25
|
|
32
|
-
* # print([(xi / xend).evalf(10) for xi in x])
|
|
33
|
-
* # print([(wi * exp(xi) / xend).evalf(10) for xi, wi in zip(x, w)])
|
|
34
|
-
*/
|
|
35
|
-
const quadrature_steps = 8;
|
|
36
|
-
|
|
37
|
-
const quadrature_nodes = array<f32,8>(
|
|
38
|
-
0.006811185292f,
|
|
39
|
-
0.03614807107f,
|
|
40
|
-
0.09004346519f,
|
|
41
|
-
0.1706680068f,
|
|
42
|
-
0.2818362161f,
|
|
43
|
-
0.4303406404f,
|
|
44
|
-
0.6296271457f,
|
|
45
|
-
0.9145252695f
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const quadrature_weights = array<f32,8>(
|
|
49
|
-
0.01750893642f,
|
|
50
|
-
0.04135477391f,
|
|
51
|
-
0.06678839063f,
|
|
52
|
-
0.09507698807f,
|
|
53
|
-
0.1283416365f,
|
|
54
|
-
0.1707430204f,
|
|
55
|
-
0.2327233347f,
|
|
56
|
-
0.3562490486f
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
let intersection = atmosphere_intersection(ray_origin, ray_direction);
|
|
60
|
-
let ray_length = intersection.y;
|
|
61
|
-
|
|
62
|
-
let segment = ray_length * ray_direction;
|
|
63
|
-
|
|
64
|
-
var optical_depth = vec3(0.0);
|
|
65
|
-
|
|
66
|
-
for (var i = 0; i < quadrature_steps; i++) {
|
|
67
|
-
|
|
68
|
-
let local_position = ray_origin + quadrature_nodes[i] * segment;
|
|
69
|
-
|
|
70
|
-
// height above the sea level
|
|
71
|
-
let local_height = atmosphere_height(local_position);
|
|
72
|
-
|
|
73
|
-
let local_density = atmosphere_density(local_height);
|
|
74
|
-
|
|
75
|
-
optical_depth += local_density * quadrature_weights[i];
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return optical_depth * ray_length;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
`, [
|
|
83
|
-
chunk_atmosphere_intersection,
|
|
84
|
-
chunk_atmosphere_height,
|
|
85
|
-
chunk_atmosphere_density,
|
|
86
|
-
])
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integrate scattering over a ray for a single directional light source.
|
|
3
|
-
* Also return the transmittance for the same ray as we are already calculating the optical depth anyway.
|
|
4
|
-
* Ported from https://github.com/Fewes/MinimalAtmosphere
|
|
5
|
-
*/
|
|
6
|
-
export const chunk_integrate_scattering: CodeChunk;
|
|
7
|
-
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
8
|
-
//# sourceMappingURL=chunk_integrate_scattering.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_integrate_scattering.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.js"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,mDAyGO;0BA3HmB,6BAA6B"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { MIE_G } from "../../../atmosphere/MIE_G.js";
|
|
2
|
-
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
3
|
-
import { ATMOSPHERE_HEIGHT_DECLARATION } from "./ATMOSPHERE_HEIGHT_DECLARATION.js";
|
|
4
|
-
import { C_MIE_SCATTERING_DECLARATION } from "./C_MIE_SCATTERING_DECLARATION.js";
|
|
5
|
-
import { C_RAYLEIGH_DECLARATION } from "./C_RAYLEIGH_DECLARATION.js";
|
|
6
|
-
import { chunk_absorb } from "./chunk_absorb.js";
|
|
7
|
-
import { chunk_atmosphere_density } from "./chunk_atmosphere_density.js";
|
|
8
|
-
import { chunk_integrate_optical_depth } from "./chunk_integrate_optical_depth.js";
|
|
9
|
-
import { chunk_planet_intersection } from "./chunk_planet_intersection.js";
|
|
10
|
-
import { MIE_HEIGHT_DECLARATION } from "./MIE_HEIGHT_DECLARATION.js";
|
|
11
|
-
import { chunk_phase_mie_cornette_shanks } from "./phase/chunk_phase_mie_cornette_shanks.js";
|
|
12
|
-
import { chunk_phase_rayleigh } from "./phase/chunk_phase_rayleigh.js";
|
|
13
|
-
import { RAYLEIGH_HEIGHT_DECLARATION } from "./RAYLEIGH_HEIGHT_DECLARATION.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Integrate scattering over a ray for a single directional light source.
|
|
17
|
-
* Also return the transmittance for the same ray as we are already calculating the optical depth anyway.
|
|
18
|
-
* Ported from https://github.com/Fewes/MinimalAtmosphere
|
|
19
|
-
*/
|
|
20
|
-
export const chunk_integrate_scattering = CodeChunk.from(
|
|
21
|
-
//language=WGSL
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
fn integrate_scattering (
|
|
25
|
-
ray_start: vec3<f32>,
|
|
26
|
-
ray_dir: vec3<f32>,
|
|
27
|
-
ray_length: f32,
|
|
28
|
-
light_dir: vec3<f32>,
|
|
29
|
-
light_color: vec3<f32>,
|
|
30
|
-
transmittance: ptr< function, vec3<f32>>
|
|
31
|
-
) -> vec3<f32> {
|
|
32
|
-
|
|
33
|
-
// We can reduce the number of atmospheric samples required to converge by spacing them exponentially closer to the camera.
|
|
34
|
-
// This breaks space view however, so let's compensate for that with an exponent that "fades" to 1 as we leave the atmosphere.
|
|
35
|
-
let rayHeight = atmosphere_height(ray_start);
|
|
36
|
-
let sampleDistributionExponent = 1.0 + saturate(1.0 - rayHeight / ATMOSPHERE_HEIGHT) * 8.0; // Slightly arbitrary max exponent of 9
|
|
37
|
-
|
|
38
|
-
let intersection = atmosphere_intersection(ray_start, ray_dir);
|
|
39
|
-
|
|
40
|
-
var _rayLength = min(ray_length, intersection.y);
|
|
41
|
-
|
|
42
|
-
var _rayStart = ray_start;
|
|
43
|
-
|
|
44
|
-
if (intersection.x > 0)
|
|
45
|
-
{
|
|
46
|
-
// Advance ray to the atmosphere entry point
|
|
47
|
-
_rayStart += ray_dir * intersection.x;
|
|
48
|
-
_rayLength -= intersection.x;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const g = ${MIE_G};
|
|
52
|
-
|
|
53
|
-
let costh = dot(ray_dir, light_dir);
|
|
54
|
-
let phaseR = phase_rayleigh(costh);
|
|
55
|
-
let phaseM = phase_mie(costh , g );
|
|
56
|
-
|
|
57
|
-
// primary ray segments
|
|
58
|
-
const sampleCount = 64;
|
|
59
|
-
|
|
60
|
-
var opticalDepth = vec3(0.0);
|
|
61
|
-
var rayleigh = vec3(0.0);
|
|
62
|
-
var mie = vec3(0.0);
|
|
63
|
-
|
|
64
|
-
var prevRayTime = 0.0;
|
|
65
|
-
|
|
66
|
-
var view_transmittance: vec3<f32>;
|
|
67
|
-
|
|
68
|
-
/*
|
|
69
|
-
The node index runs 1..sampleCount, so the last one lands on _rayLength and the whole ray is
|
|
70
|
-
covered.
|
|
71
|
-
|
|
72
|
-
It used to run 0..sampleCount-1, which covers [0, (63/64)^e * _rayLength]: with the exponent
|
|
73
|
-
this function computes for a camera at ground level, e = 9, that is 0.868 — 13.2% of the ray
|
|
74
|
-
never integrated. A horizon-grazing ray at sea level is a 600 km chord with its highest density
|
|
75
|
-
along it, so the last 80 km of both optical depth and in-scattering went missing: the
|
|
76
|
-
transmittance came back too high and the radiance under-scattered, and the bias is largest
|
|
77
|
-
exactly at the horizon where the gradient is steepest, so it reads as a band rather than as an
|
|
78
|
-
offset exposure would hide. The i = 0 iteration was also pure waste — a full
|
|
79
|
-
integrate_optical_depth, eight density evaluations and a sphere intersection, multiplied by a
|
|
80
|
-
step size of exactly zero.
|
|
81
|
-
*/
|
|
82
|
-
for (var i = 1; i <= sampleCount; i++) {
|
|
83
|
-
let rayTime = pow( f32(i) / sampleCount, sampleDistributionExponent) * _rayLength;
|
|
84
|
-
// Because we are distributing the samples exponentially, we have to calculate the step size per sample.
|
|
85
|
-
let stepSize = (rayTime - prevRayTime);
|
|
86
|
-
|
|
87
|
-
let local_position = _rayStart + ray_dir * rayTime;
|
|
88
|
-
let local_height = atmosphere_height(local_position);
|
|
89
|
-
let local_density = atmosphere_density(local_height);
|
|
90
|
-
|
|
91
|
-
opticalDepth += local_density * stepSize;
|
|
92
|
-
|
|
93
|
-
// The atmospheric transmittance from rayStart to localPosition
|
|
94
|
-
view_transmittance = absorb(opticalDepth);
|
|
95
|
-
|
|
96
|
-
let opticalDepthlight = integrate_optical_depth(local_position, light_dir);
|
|
97
|
-
// The atmospheric transmittance of light reaching localPosition
|
|
98
|
-
let lightTransmittance = absorb(opticalDepthlight);
|
|
99
|
-
|
|
100
|
-
let k = view_transmittance * lightTransmittance * stepSize;
|
|
101
|
-
|
|
102
|
-
rayleigh += k * phaseR * local_density.x;
|
|
103
|
-
mie += k * phaseM * local_density.y;
|
|
104
|
-
|
|
105
|
-
prevRayTime = rayTime;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
*transmittance = view_transmittance;
|
|
109
|
-
|
|
110
|
-
return (rayleigh * C_RAYLEIGH + mie * C_MIE_SCATTERING) * light_color;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
`, [
|
|
114
|
-
ATMOSPHERE_HEIGHT_DECLARATION,
|
|
115
|
-
RAYLEIGH_HEIGHT_DECLARATION,
|
|
116
|
-
MIE_HEIGHT_DECLARATION,
|
|
117
|
-
chunk_phase_mie_cornette_shanks,
|
|
118
|
-
chunk_phase_rayleigh,
|
|
119
|
-
chunk_integrate_optical_depth,
|
|
120
|
-
chunk_atmosphere_density,
|
|
121
|
-
chunk_planet_intersection,
|
|
122
|
-
C_RAYLEIGH_DECLARATION,
|
|
123
|
-
C_MIE_SCATTERING_DECLARATION,
|
|
124
|
-
chunk_absorb,
|
|
125
|
-
]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_planet_intersection.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.js"],"names":[],"mappings":"AAKA,kDAWO;0BAhBmB,6BAA6B"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
2
|
-
import { chunk_sphere_intersection } from "./chunk_sphere_intersection.js";
|
|
3
|
-
import { PLANET_CENTER_DECLARATION } from "./PLANET_CENTER_DECLARATION.js";
|
|
4
|
-
import { PLANET_RADIUS_DECLARATION } from "./PLANET_RADIUS_DECLARATION.js";
|
|
5
|
-
|
|
6
|
-
export const chunk_planet_intersection = CodeChunk.from(
|
|
7
|
-
//language=WGSL
|
|
8
|
-
`
|
|
9
|
-
fn planet_intersection ( rayStart:vec3<f32>, rayDir:vec3<f32> ) -> vec2<f32>
|
|
10
|
-
{
|
|
11
|
-
return sphere_intersection(rayStart, rayDir, PLANET_CENTER, PLANET_RADIUS);
|
|
12
|
-
}
|
|
13
|
-
`, [
|
|
14
|
-
PLANET_CENTER_DECLARATION,
|
|
15
|
-
PLANET_RADIUS_DECLARATION,
|
|
16
|
-
chunk_sphere_intersection
|
|
17
|
-
]);
|
package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_sphere_intersection_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.js"],"names":[],"mappings":"AAEA,0DAmCE;0BArCwB,6BAA6B"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
2
|
-
|
|
3
|
-
export const chunk_sphere_intersection_nearest = CodeChunk.from(
|
|
4
|
-
//language=WGSL
|
|
5
|
-
`
|
|
6
|
-
fn sphere_intersection_nearest(
|
|
7
|
-
ray_origin: vec3<f32>,
|
|
8
|
-
ray_direction: vec3<f32>,
|
|
9
|
-
center: vec3<f32>,
|
|
10
|
-
radius: f32
|
|
11
|
-
) -> f32{
|
|
12
|
-
|
|
13
|
-
let _ray_start = ray_origin - center;
|
|
14
|
-
|
|
15
|
-
let a = dot(ray_direction, ray_direction);
|
|
16
|
-
let b = 2.0 * dot(_ray_start, ray_direction);
|
|
17
|
-
let c = dot(_ray_start, _ray_start) - (radius * radius);
|
|
18
|
-
|
|
19
|
-
let d2 = fma(b, b, - 4.0 * a * c);
|
|
20
|
-
|
|
21
|
-
if (d2 < 0)
|
|
22
|
-
{
|
|
23
|
-
return -1.0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let d = sqrt(d2);
|
|
27
|
-
|
|
28
|
-
let a2 = (2.0 * a);
|
|
29
|
-
|
|
30
|
-
if( d2 > b*b ){
|
|
31
|
-
// inside sphere, use far hit
|
|
32
|
-
return (-b + d) / a2;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (-b - d) / a2;
|
|
36
|
-
}
|
|
37
|
-
`
|
|
38
|
-
);
|
package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An atmosphere layer of width 'width', and whose density is defined as
|
|
3
|
-
* 'exp_term' * exp('exp_scale' * h) + 'linear_term' * h + 'constant_term',
|
|
4
|
-
* clamped to [0,1], and where h is the altitude.
|
|
5
|
-
* @see "Precomputed Atmospheric Scattering", Bruneton & Neyret (2008) / Bruneton (2017)
|
|
6
|
-
*/
|
|
7
|
-
export const DENSITY_PROFILE_LAYER_STRUCT: WebGPUStruct;
|
|
8
|
-
/**
|
|
9
|
-
* An atmosphere density profile made of several layers on top of each other
|
|
10
|
-
* (from bottom to top). The width of the last layer is ignored, i.e. it always
|
|
11
|
-
* extend to the top atmosphere boundary. The profile values vary between 0
|
|
12
|
-
* (null density) to 1 (maximum density).
|
|
13
|
-
*/
|
|
14
|
-
export const DENSITY_PROFILE_STRUCT: WebGPUStruct;
|
|
15
|
-
import { WebGPUStruct } from "../../../type/WebGPUStruct.js";
|
|
16
|
-
//# sourceMappingURL=DENSITY_PROFILE_LAYER_STRUCT.d.ts.map
|
package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DENSITY_PROFILE_LAYER_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wDAMG;AAEH;;;;;GAKG;AACH,kDAEG;6BAxB0B,+BAA+B"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { f32 } from "../../../type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
2
|
-
import { WebGPUArray } from "../../../type/WebGPUArray.js";
|
|
3
|
-
import { WebGPUStruct } from "../../../type/WebGPUStruct.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* An atmosphere layer of width 'width', and whose density is defined as
|
|
7
|
-
* 'exp_term' * exp('exp_scale' * h) + 'linear_term' * h + 'constant_term',
|
|
8
|
-
* clamped to [0,1], and where h is the altitude.
|
|
9
|
-
* @see "Precomputed Atmospheric Scattering", Bruneton & Neyret (2008) / Bruneton (2017)
|
|
10
|
-
*/
|
|
11
|
-
export const DENSITY_PROFILE_LAYER_STRUCT = WebGPUStruct.from({
|
|
12
|
-
width: f32,
|
|
13
|
-
exp_term: f32,
|
|
14
|
-
exp_scale: f32,
|
|
15
|
-
linear_term: f32,
|
|
16
|
-
constant_term: f32
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* An atmosphere density profile made of several layers on top of each other
|
|
21
|
-
* (from bottom to top). The width of the last layer is ignored, i.e. it always
|
|
22
|
-
* extend to the top atmosphere boundary. The profile values vary between 0
|
|
23
|
-
* (null density) to 1 (maximum density).
|
|
24
|
-
*/
|
|
25
|
-
export const DENSITY_PROFILE_STRUCT = WebGPUStruct.from({
|
|
26
|
-
layers: WebGPUArray.from(DENSITY_PROFILE_LAYER_STRUCT, 2)
|
|
27
|
-
});
|
|
28
|
-
|