@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
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
2
|
import { gpu_texture_format_info } from "../../descriptor/texture/format/gpu_texture_format_info.js";
|
|
3
|
+
import { TextureViewDescriptor } from "../../descriptor/texture/TextureViewDescriptor.js";
|
|
3
4
|
import { isImageBitmap } from "../../../core/dom/isImageBitmap.js";
|
|
4
5
|
import { ShadeGPUCommandContext } from "../../device/ShadeGPUCommandContext.js";
|
|
6
|
+
import { create_atmosphere_sun_state, resolve_atmosphere_sun } from "../atmosphere/resolve_atmosphere_sun.js";
|
|
7
|
+
import { SKY_IRRADIANCE_LUT_RESOLUTION, shader_sky_irradiance_lut } from "../atmosphere/shader_sky_irradiance_lut.js";
|
|
5
8
|
import { GPUDatabase } from "../buffer/table/GPUDatabase.js";
|
|
6
9
|
import { GPUSceneShadowmapContext } from "../shadow/map/GPUSceneShadowmapContext.js";
|
|
7
10
|
import { GPUTextureContext } from "../texture/GPUTextureContext.js";
|
|
@@ -50,15 +53,23 @@ import {
|
|
|
50
53
|
*/
|
|
51
54
|
const MAX_DIRECTIONAL_LIGHTS = 32;
|
|
52
55
|
|
|
56
|
+
const MIP_0_VIEW_DESCRIPTOR = TextureViewDescriptor.from({
|
|
57
|
+
baseMipLevel: 0,
|
|
58
|
+
mipLevelCount: 1,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const ZERO_ENVIRONMENT_SH = new Float32Array(ENVIRONMENT_SH_TYPE.size / 4);
|
|
62
|
+
|
|
53
63
|
export class GPULightCollection {
|
|
54
64
|
|
|
55
65
|
/**
|
|
56
66
|
* Offer the pipelines a scene's lights are updated with — the environment map's filtering and
|
|
57
|
-
* projection, and the pose refresh — see {@link PipelineEnquiry}.
|
|
67
|
+
* projection, procedural sky mip-0 synthesis, and the pose refresh — see {@link PipelineEnquiry}.
|
|
58
68
|
*
|
|
59
69
|
* @param {PipelineEnquiry} enquiry
|
|
60
70
|
*/
|
|
61
71
|
static enquirePipelines(enquiry) {
|
|
72
|
+
enquiry.render.push(shader_sky_irradiance_lut.pipeline);
|
|
62
73
|
enquire_filter_environment_map_pipelines(enquiry);
|
|
63
74
|
enquiry.compute.push(shader_project_environment_sh.pipeline);
|
|
64
75
|
enquiry.compute.push(shader_project_far_field_irradiance_sh.pipeline);
|
|
@@ -66,6 +77,11 @@ export class GPULightCollection {
|
|
|
66
77
|
}
|
|
67
78
|
|
|
68
79
|
|
|
80
|
+
/**
|
|
81
|
+
* @type {GPUSceneContext}
|
|
82
|
+
*/
|
|
83
|
+
#scene_ctx;
|
|
84
|
+
|
|
69
85
|
/**
|
|
70
86
|
* @type {LightCollection}
|
|
71
87
|
*/
|
|
@@ -178,10 +194,39 @@ export class GPULightCollection {
|
|
|
178
194
|
#environment;
|
|
179
195
|
|
|
180
196
|
/**
|
|
181
|
-
* @type {ShadeTexture}
|
|
197
|
+
* @type {ShadeTexture|undefined}
|
|
182
198
|
*/
|
|
183
199
|
#environment_source;
|
|
184
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Active backing mode for {@link #environment}: `"black"` (`1×1` zeroed fallback),
|
|
203
|
+
* `"texture"` (authored `ShadeTexture` from `lights.environment`), or `"atmosphere"`
|
|
204
|
+
* (procedural Hillaire octahedral sky driven by `scene.atmosphere`).
|
|
205
|
+
*
|
|
206
|
+
* @type {"black" | "texture" | "atmosphere"}
|
|
207
|
+
*/
|
|
208
|
+
#environment_mode = "black";
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Reusable per-update sun descriptor for procedural sky synthesis.
|
|
212
|
+
*/
|
|
213
|
+
#atmosphere_sun_state = create_atmosphere_sun_state();
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Reusable immediate settings payload for {@link shader_sky_irradiance_lut}.
|
|
217
|
+
*/
|
|
218
|
+
#sky_irradiance_settings = {
|
|
219
|
+
sun_direction: this.#atmosphere_sun_state.sun_direction,
|
|
220
|
+
reference_altitude: 0,
|
|
221
|
+
sun_irradiance: this.#atmosphere_sun_state.sun_irradiance,
|
|
222
|
+
resolution: SKY_IRRADIANCE_LUT_RESOLUTION,
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
#committed_atmosphere_version = -1;
|
|
226
|
+
#committed_reference_altitude = NaN;
|
|
227
|
+
#committed_sun_direction = new Float32Array([NaN, NaN, NaN]);
|
|
228
|
+
#committed_sun_irradiance = new Float32Array([NaN, NaN, NaN]);
|
|
229
|
+
|
|
185
230
|
/**
|
|
186
231
|
* The environment's radiance as RGB SH2, projected from {@link #environment} whenever it changes;
|
|
187
232
|
* see {@link shader_project_environment_sh}.
|
|
@@ -258,6 +303,7 @@ export class GPULightCollection {
|
|
|
258
303
|
const device = graphics.device;
|
|
259
304
|
|
|
260
305
|
this.#device = device;
|
|
306
|
+
this.#scene_ctx = scene_ctx;
|
|
261
307
|
this.#source = scene.lights;
|
|
262
308
|
|
|
263
309
|
this.#source.onRemoved.add(this.#removed, this);
|
|
@@ -268,6 +314,7 @@ export class GPULightCollection {
|
|
|
268
314
|
this.#environment.descriptor.usage |=
|
|
269
315
|
GPUTextureUsage.COPY_DST // so we can write to it
|
|
270
316
|
| GPUTextureUsage.STORAGE_BINDING // so we can convolve it in compute shader
|
|
317
|
+
| GPUTextureUsage.RENDER_ATTACHMENT // for procedural sky mip-0 synthesis and ImageBitmap uploads
|
|
271
318
|
;
|
|
272
319
|
|
|
273
320
|
// zeroed on creation, which is what an absent environment projects to
|
|
@@ -298,115 +345,201 @@ export class GPULightCollection {
|
|
|
298
345
|
*/
|
|
299
346
|
#update_environment(ctx) {
|
|
300
347
|
const source_env = this.#source.environment;
|
|
348
|
+
const gpu_ctx = this.#environment;
|
|
349
|
+
|
|
350
|
+
if (source_env !== undefined) {
|
|
351
|
+
if (this.#environment_mode === "texture" && this.#environment_source === source_env) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const source_image = source_env.image;
|
|
356
|
+
|
|
357
|
+
/*
|
|
358
|
+
An environment map comes with a one-texel octahedral skirt: the octahedral square in the
|
|
359
|
+
interior, each texel of the outer ring a copy of the one the fold puts beside it. The renderer
|
|
360
|
+
filters it in hardware through that skirt and skirts the levels it filters itself; an
|
|
361
|
+
unskirted map is the caller's error, and it would read as seams along the octahedron's
|
|
362
|
+
edges. Every level the roughness mapping reaches needs an interior, so 3 texels at the last.
|
|
363
|
+
`resample_equirectangular_to_octahedral` and the offline converter write the skirt by default.
|
|
364
|
+
|
|
365
|
+
Checked where the pixels are on hand; an ImageBitmap's are not.
|
|
366
|
+
*/
|
|
367
|
+
assert.greaterThanOrEqual(
|
|
368
|
+
source_image.width >> (SPHERE_PROBE_MIPMAP_LEVELS - 1),
|
|
369
|
+
3,
|
|
370
|
+
'environment map too small for its last filtered level'
|
|
371
|
+
);
|
|
372
|
+
|
|
373
|
+
assert.equal(source_image.width, source_image.height, 'an octahedral environment map is square');
|
|
374
|
+
|
|
375
|
+
const source_texels = source_image.source;
|
|
376
|
+
|
|
377
|
+
if (source_texels?.isSampler2D === true) {
|
|
378
|
+
assert.ok(
|
|
379
|
+
octahedral_skirt_matches(source_texels.data, source_texels.itemSize, source_texels.width),
|
|
380
|
+
'environment map has no octahedral skirt (see sampler2d_octahedral_skirt_fill)'
|
|
381
|
+
);
|
|
382
|
+
} else if (
|
|
383
|
+
source_texels?.isShadeTexelData === true
|
|
384
|
+
&& source_texels.levels[0] !== undefined
|
|
385
|
+
&& gpu_texture_format_info(source_texels.format).block_width === 1
|
|
386
|
+
) {
|
|
387
|
+
assert.ok(
|
|
388
|
+
octahedral_skirt_matches(
|
|
389
|
+
source_texels.levels[0],
|
|
390
|
+
gpu_texture_format_info(source_texels.format).bytes_per_block,
|
|
391
|
+
source_texels.width
|
|
392
|
+
),
|
|
393
|
+
'environment map has no octahedral skirt (see sampler2d_octahedral_skirt_fill)'
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
this.#environment_mode = "texture";
|
|
398
|
+
this.#environment_source = source_env;
|
|
399
|
+
|
|
400
|
+
/*
|
|
401
|
+
Assign descriptor.size directly rather than calling gpu_ctx.resize(): resize() immediately
|
|
402
|
+
re-allocates when the context is already in TEXTURE_STATE_ALLOCATED, which would call
|
|
403
|
+
createTexture with the new size and the previous map's mipLevelCount (failing WebGPU
|
|
404
|
+
validation whenever the new map is smaller) before allocate() below replaces it again.
|
|
405
|
+
*/
|
|
406
|
+
gpu_ctx.descriptor.size = [source_image.width, source_image.height, 1];
|
|
407
|
+
/*
|
|
408
|
+
The environment map is octahedral 2D and this context keeps the default dimension while
|
|
409
|
+
`size` above sets two spatial axes. Asked of the descriptor rather than assumed, so the
|
|
410
|
+
count follows if that ever stops being true.
|
|
411
|
+
*/
|
|
412
|
+
const gpu_size = gpu_ctx.descriptor.size;
|
|
413
|
+
|
|
414
|
+
gpu_ctx.descriptor.mipLevelCount = texture_mip_level_count(
|
|
415
|
+
gpu_size.width, gpu_size.height, gpu_size.depthOrArrayLayers, gpu_ctx.descriptor.dimension
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
if (isImageBitmap(source_image.source)) {
|
|
419
|
+
// need RENDER_ATTACHMENT to use GPUQueue.copyExternalImageToTexture API
|
|
420
|
+
gpu_ctx.descriptor.usage |= GPUTextureUsage.RENDER_ATTACHMENT;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
gpu_ctx.allocate();
|
|
424
|
+
gpu_ctx.incrementVersion();
|
|
425
|
+
|
|
426
|
+
texture_write_to_gpu(source_image, gpu_ctx.gpu_texture, this.#device.queue, source_image.level_count);
|
|
427
|
+
|
|
428
|
+
// convolve
|
|
429
|
+
const cmd = ShadeGPUCommandContext.create(ctx);
|
|
430
|
+
|
|
431
|
+
encode_filter_environment_map(gpu_ctx, cmd);
|
|
301
432
|
|
|
302
|
-
|
|
303
|
-
|
|
433
|
+
// after the prefilter, whose roughest levels are what it reads
|
|
434
|
+
shader_project_environment_sh.dispatch({
|
|
435
|
+
encoder: cmd,
|
|
436
|
+
group_count_x: 1,
|
|
437
|
+
bindings: {
|
|
438
|
+
tEnvironment: gpu_ctx.obtainView(),
|
|
439
|
+
output: this.#environment_sh,
|
|
440
|
+
},
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
this.#far_field_sh_dirty = true;
|
|
444
|
+
|
|
445
|
+
cmd.finish();
|
|
304
446
|
return;
|
|
305
447
|
}
|
|
306
448
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const gpu_ctx = this.#environment;
|
|
449
|
+
const scene = this.#scene_ctx.scene;
|
|
450
|
+
const atmosphere = scene.atmosphere;
|
|
310
451
|
|
|
311
452
|
/*
|
|
312
|
-
No environment
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
source_env.image and take the frame down from inside the renderer's per-frame update.
|
|
316
|
-
|
|
317
|
-
Every consumer binds this texture unconditionally — the path tracer, the probe atlas, the
|
|
318
|
-
lightmap baker, the transparent passes all call obtainView() on it without asking whether
|
|
319
|
-
there is an environment — so it has to keep existing. A freshly allocated 1x1 at one mip
|
|
320
|
-
is zeroed, which is the same black IBL they read before an environment is ever assigned.
|
|
453
|
+
No authored environment and procedural atmosphere disabled: keep a valid 1x1 zeroed texture
|
|
454
|
+
and zeroed SH buffer because downstream consumers (path tracer, probe atlas, lightmap baker,
|
|
455
|
+
transparent passes) bind `environment` unconditionally via `obtainView()`.
|
|
321
456
|
*/
|
|
322
|
-
if (
|
|
457
|
+
if (!atmosphere.enabled) {
|
|
458
|
+
if (this.#environment_mode === "black") {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
this.#environment_mode = "black";
|
|
463
|
+
this.#environment_source = undefined;
|
|
464
|
+
|
|
323
465
|
gpu_ctx.descriptor.mipLevelCount = 1;
|
|
324
466
|
gpu_ctx.descriptor.size = [1, 1, 1];
|
|
325
467
|
|
|
326
468
|
gpu_ctx.allocate();
|
|
469
|
+
gpu_ctx.incrementVersion();
|
|
327
470
|
|
|
328
471
|
// what a black environment projects to; nothing to run the projection over
|
|
329
|
-
this.#device.queue.writeBuffer(this.#environment_sh, 0,
|
|
472
|
+
this.#device.queue.writeBuffer(this.#environment_sh, 0, ZERO_ENVIRONMENT_SH);
|
|
330
473
|
this.#far_field_sh_dirty = true;
|
|
331
474
|
|
|
332
475
|
return;
|
|
333
476
|
}
|
|
334
477
|
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
'environment map too small for its last filtered level'
|
|
351
|
-
);
|
|
352
|
-
|
|
353
|
-
assert.equal(source_image.width, source_image.height, 'an octahedral environment map is square');
|
|
478
|
+
const sun = resolve_atmosphere_sun(scene, this.#atmosphere_sun_state);
|
|
479
|
+
|
|
480
|
+
if (
|
|
481
|
+
this.#environment_mode === "atmosphere"
|
|
482
|
+
&& this.#committed_atmosphere_version === atmosphere.version
|
|
483
|
+
&& this.#committed_reference_altitude === atmosphere.reference_altitude
|
|
484
|
+
&& this.#committed_sun_direction[0] === sun.sun_direction[0]
|
|
485
|
+
&& this.#committed_sun_direction[1] === sun.sun_direction[1]
|
|
486
|
+
&& this.#committed_sun_direction[2] === sun.sun_direction[2]
|
|
487
|
+
&& this.#committed_sun_irradiance[0] === sun.sun_irradiance[0]
|
|
488
|
+
&& this.#committed_sun_irradiance[1] === sun.sun_irradiance[1]
|
|
489
|
+
&& this.#committed_sun_irradiance[2] === sun.sun_irradiance[2]
|
|
490
|
+
) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
354
493
|
|
|
355
|
-
const
|
|
494
|
+
const sky = this.#scene_ctx.sky;
|
|
495
|
+
sky.update();
|
|
356
496
|
|
|
357
|
-
if (
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
);
|
|
362
|
-
} else if (
|
|
363
|
-
source_texels?.isShadeTexelData === true
|
|
364
|
-
&& source_texels.levels[0] !== undefined
|
|
365
|
-
&& gpu_texture_format_info(source_texels.format).block_width === 1
|
|
497
|
+
if (
|
|
498
|
+
this.#environment_mode !== "atmosphere"
|
|
499
|
+
|| gpu_ctx.width !== SKY_IRRADIANCE_LUT_RESOLUTION
|
|
500
|
+
|| gpu_ctx.height !== SKY_IRRADIANCE_LUT_RESOLUTION
|
|
366
501
|
) {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
source_texels.width
|
|
372
|
-
),
|
|
373
|
-
'environment map has no octahedral skirt (see sampler2d_octahedral_skirt_fill)'
|
|
502
|
+
gpu_ctx.descriptor.size = [SKY_IRRADIANCE_LUT_RESOLUTION, SKY_IRRADIANCE_LUT_RESOLUTION, 1];
|
|
503
|
+
const gpu_size = gpu_ctx.descriptor.size;
|
|
504
|
+
gpu_ctx.descriptor.mipLevelCount = texture_mip_level_count(
|
|
505
|
+
gpu_size.width, gpu_size.height, gpu_size.depthOrArrayLayers, gpu_ctx.descriptor.dimension
|
|
374
506
|
);
|
|
507
|
+
gpu_ctx.allocate();
|
|
375
508
|
}
|
|
376
509
|
|
|
377
|
-
|
|
378
|
-
Assign descriptor.size directly rather than calling gpu_ctx.resize(): resize() immediately
|
|
379
|
-
re-allocates when the context is already in TEXTURE_STATE_ALLOCATED, which would call
|
|
380
|
-
createTexture with the new size and the previous map's mipLevelCount (failing WebGPU
|
|
381
|
-
validation whenever the new map is smaller) before allocate() below replaces it again.
|
|
382
|
-
*/
|
|
383
|
-
gpu_ctx.descriptor.size = [source_image.width, source_image.height, 1];
|
|
384
|
-
/*
|
|
385
|
-
The environment map is equirectangular and this context is built 2D a few lines up — the
|
|
386
|
-
descriptor keeps the default dimension and `size` above only sets two spatial axes. Asked of
|
|
387
|
-
the descriptor rather than assumed, so the count follows if that ever stops being true.
|
|
388
|
-
*/
|
|
389
|
-
const gpu_size = gpu_ctx.descriptor.size;
|
|
510
|
+
gpu_ctx.incrementVersion();
|
|
390
511
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
512
|
+
this.#environment_mode = "atmosphere";
|
|
513
|
+
this.#environment_source = undefined;
|
|
514
|
+
this.#committed_atmosphere_version = atmosphere.version;
|
|
515
|
+
this.#committed_reference_altitude = atmosphere.reference_altitude;
|
|
516
|
+
this.#committed_sun_direction.set(sun.sun_direction);
|
|
517
|
+
this.#committed_sun_irradiance.set(sun.sun_irradiance);
|
|
394
518
|
|
|
395
|
-
|
|
396
|
-
// need RENDER_ATTACHMENT to use GPUQueue.copyExternalImageToTexture API
|
|
397
|
-
gpu_ctx.descriptor.usage |= GPUTextureUsage.RENDER_ATTACHMENT;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
gpu_ctx.allocate();
|
|
519
|
+
this.#sky_irradiance_settings.reference_altitude = atmosphere.reference_altitude;
|
|
401
520
|
|
|
402
|
-
|
|
521
|
+
const cmd = ShadeGPUCommandContext.create(ctx, "GPULightCollection/sky_environment");
|
|
403
522
|
|
|
404
|
-
|
|
405
|
-
|
|
523
|
+
shader_sky_irradiance_lut.draw({
|
|
524
|
+
encoder: cmd,
|
|
525
|
+
bindings: {
|
|
526
|
+
settings: this.#sky_irradiance_settings,
|
|
527
|
+
atmosphere: sky.parameters_buffer.buffer,
|
|
528
|
+
tSkyLutTransmittance: sky.lut_transmittance.obtainView(),
|
|
529
|
+
tSkyLutMultiscatter: sky.lut_multiple_scattering.obtainView(),
|
|
530
|
+
},
|
|
531
|
+
colorAttachments: [
|
|
532
|
+
{
|
|
533
|
+
view: gpu_ctx.obtainView(MIP_0_VIEW_DESCRIPTOR),
|
|
534
|
+
loadOp: "clear",
|
|
535
|
+
storeOp: "store",
|
|
536
|
+
clearValue: [0, 0, 0, 1],
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
});
|
|
406
540
|
|
|
407
541
|
encode_filter_environment_map(gpu_ctx, cmd);
|
|
408
542
|
|
|
409
|
-
// after the prefilter, whose roughest levels are what it reads
|
|
410
543
|
shader_project_environment_sh.dispatch({
|
|
411
544
|
encoder: cmd,
|
|
412
545
|
group_count_x: 1,
|
package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.d.ts
RENAMED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* The environment map's level 0 in a direction: one hardware bilinear tap through the octahedral
|
|
3
3
|
* skirt (see `texture_octahedral_skirt_uv`).
|
|
4
4
|
*
|
|
5
|
-
* see {@link shader_sky_irradiance_lut}
|
|
6
5
|
* @type {CodeChunk}
|
|
7
6
|
*/
|
|
8
7
|
export const chunk_sample_environment_color: CodeChunk;
|
|
9
|
-
import { CodeChunk } from "
|
|
8
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
10
9
|
//# sourceMappingURL=chunk_sample_environment_color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_sample_environment_color.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/light/environment/chunk_sample_environment_color.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,6CAFU,SAAS,CAcjB;0BApBwB,oCAAoC"}
|
package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.js
RENAMED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { chunk_uv_octahedral_unit_encode } from "
|
|
2
|
-
import { chunk_texture_octahedral_skirt_uv } from "
|
|
3
|
-
import { CodeChunk } from "
|
|
1
|
+
import { chunk_uv_octahedral_unit_encode } from "../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
|
|
2
|
+
import { chunk_texture_octahedral_skirt_uv } from "../../shader/chunk/texture/octahedral/chunk_texture_octahedral_skirt_uv.js";
|
|
3
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The environment map's level 0 in a direction: one hardware bilinear tap through the octahedral
|
|
7
7
|
* skirt (see `texture_octahedral_skirt_uv`).
|
|
8
8
|
*
|
|
9
|
-
* see {@link shader_sky_irradiance_lut}
|
|
10
9
|
* @type {CodeChunk}
|
|
11
10
|
*/
|
|
12
11
|
export const chunk_sample_environment_color = CodeChunk.from(
|
|
@@ -13,7 +13,7 @@ export class TinyGltf {
|
|
|
13
13
|
* @readonly
|
|
14
14
|
* @type {TextureFormat}
|
|
15
15
|
*/
|
|
16
|
-
static readonly "__#
|
|
16
|
+
static readonly "__#315@#UNCOMPRESSED_TARGET": TextureFormat;
|
|
17
17
|
/**
|
|
18
18
|
* @param {AssetManager} assetManager
|
|
19
19
|
* @param {AssetRequestScope} [scope]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f32, u32, vec3f } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
2
2
|
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
3
|
-
import { chunk_sample_environment_color } from "../../
|
|
3
|
+
import { chunk_sample_environment_color } from "../../light/environment/chunk_sample_environment_color.js";
|
|
4
4
|
import { chunk_scene_database_access } from "../../scene/chunk_scene_database_access.js";
|
|
5
5
|
import { chunk_BRDF_GGX } from "../../shader/chunk/brdf/chunk_BRDF_GGX.js";
|
|
6
6
|
import { chunk_compute_ggx_vndf_pdf } from "../../shader/chunk/brdf/chunk_compute_ggx_pdf.js";
|
|
@@ -41,7 +41,7 @@ fn main(
|
|
|
41
41
|
|
|
42
42
|
let depth = textureLoad( DepthBuffer, current_coord, 0 ).r;
|
|
43
43
|
|
|
44
|
-
let velocity = textureLoad( VelocityBuffer, current_coord, 0 ).
|
|
44
|
+
let velocity = textureLoad( VelocityBuffer, current_coord, 0 ).rg;
|
|
45
45
|
let current_coord_f = vec2<f32>(current_coord.xy);
|
|
46
46
|
|
|
47
47
|
let previous_coord = current_coord_f - velocity.xy;
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* The factor lives in one buffer for the manager's life, {@link multiplier}, which a frame's {@link update} or
|
|
6
6
|
* {@link unadapted} writes over. A pass recorded ahead of that write in the frame reads the factor the last frame was
|
|
7
7
|
* shown with: the exposure of the image on screen, Unreal Engine's `View.PreExposure`.
|
|
8
|
+
*
|
|
9
|
+
* Beside it, {@link adaptation}: the luminance the view is adapted to, cd/m², written by the same pass. Adapted, it is
|
|
10
|
+
* the luminance the eye has adapted to, without {@link exposure_compensation}; unadapted, it is the luminance the
|
|
11
|
+
* exposure shows at middle grey.
|
|
8
12
|
*/
|
|
9
13
|
export class GPUCameraExposureManager {
|
|
10
14
|
/**
|
|
@@ -44,9 +48,17 @@ export class GPUCameraExposureManager {
|
|
|
44
48
|
* imports it into its graph once, and hands the handle both to the passes that read it ahead of the exposure,
|
|
45
49
|
* which take the last frame's factor, and to {@link update} or {@link unadapted}, which write this frame's.
|
|
46
50
|
*
|
|
47
|
-
* @returns {GPUBuffer} usable as a uniform or read-only storage
|
|
51
|
+
* @returns {GPUBuffer} usable as a uniform or read-only storage, and as a copy source, to read it back
|
|
48
52
|
*/
|
|
49
53
|
get multiplier(): GPUBuffer;
|
|
54
|
+
/**
|
|
55
|
+
* The luminance the view is adapted to, cd/m², {@link F32_CONTAINER_STRUCT}, as the last {@link update} or
|
|
56
|
+
* {@link unadapted} wrote it. Imported into a frame's graph once and handed to {@link update} or {@link unadapted},
|
|
57
|
+
* like {@link multiplier}.
|
|
58
|
+
*
|
|
59
|
+
* @returns {GPUBuffer} usable as a uniform or read-only storage
|
|
60
|
+
*/
|
|
61
|
+
get adaptation(): GPUBuffer;
|
|
50
62
|
/**
|
|
51
63
|
* Offer the pipelines {@link update} meters and adapts with — see {@link PipelineEnquiry}.
|
|
52
64
|
* {@link unadapted} dispatches none.
|
|
@@ -55,34 +67,48 @@ export class GPUCameraExposureManager {
|
|
|
55
67
|
*/
|
|
56
68
|
enquirePipelines(enquiry: PipelineEnquiry): void;
|
|
57
69
|
/**
|
|
58
|
-
* This frame's factor from {@link exposure_compensation} alone: 2^compensation.
|
|
70
|
+
* This frame's factor from {@link exposure_compensation} alone: 2^compensation. Its adaptation is the luminance
|
|
71
|
+
* that factor shows at middle grey, 0.18 / 2^compensation cd/m².
|
|
59
72
|
*
|
|
60
73
|
* @param {Object} options
|
|
61
74
|
* @param {FrameGraph} options.graph
|
|
62
75
|
* @param {number} options.multiplier the graph handle of {@link multiplier}, imported into `graph`
|
|
63
|
-
* @
|
|
76
|
+
* @param {number} options.adaptation the graph handle of {@link adaptation}, imported into `graph`
|
|
77
|
+
* @return {{multiplier: number, adaptation: number}} the handles of {@link multiplier} and {@link adaptation}
|
|
78
|
+
* with this frame's written; the object is reused by the next call
|
|
64
79
|
*/
|
|
65
|
-
unadapted({ graph, multiplier, }: {
|
|
80
|
+
unadapted({ graph, multiplier, adaptation, }: {
|
|
66
81
|
graph: FrameGraph;
|
|
67
82
|
multiplier: number;
|
|
68
|
-
|
|
83
|
+
adaptation: number;
|
|
84
|
+
}): {
|
|
85
|
+
multiplier: number;
|
|
86
|
+
adaptation: number;
|
|
87
|
+
};
|
|
69
88
|
/**
|
|
70
89
|
* This frame's factor metered from `input_color`: the luminance adapted toward the frame's, from the last
|
|
71
|
-
* frame's, by the adaptation speeds; its factor is middle grey over it, times 2^{@link exposure_compensation}.
|
|
90
|
+
* frame's, by the adaptation speeds; its factor is middle grey over it, times 2^{@link exposure_compensation}. Its
|
|
91
|
+
* adaptation is that adapted luminance, without the compensation.
|
|
72
92
|
*
|
|
73
93
|
* @param {Object} options
|
|
74
94
|
* @param {FrameGraph} options.graph
|
|
75
95
|
* @param {number} options.input_color
|
|
76
96
|
* @param {number} options.multiplier the graph handle of {@link multiplier}, imported into `graph`
|
|
97
|
+
* @param {number} options.adaptation the graph handle of {@link adaptation}, imported into `graph`
|
|
77
98
|
* @param {number} [options.time_delta_seconds]
|
|
78
|
-
* @return {number} the
|
|
99
|
+
* @return {{multiplier: number, adaptation: number}} the handles of {@link multiplier} and {@link adaptation}
|
|
100
|
+
* with this frame's written; the object is reused by the next call
|
|
79
101
|
*/
|
|
80
|
-
update({ input_color, graph, multiplier, time_delta_seconds, }: {
|
|
102
|
+
update({ input_color, graph, multiplier, adaptation, time_delta_seconds, }: {
|
|
81
103
|
graph: FrameGraph;
|
|
82
104
|
input_color: number;
|
|
83
105
|
multiplier: number;
|
|
106
|
+
adaptation: number;
|
|
84
107
|
time_delta_seconds?: number;
|
|
85
|
-
}):
|
|
108
|
+
}): {
|
|
109
|
+
multiplier: number;
|
|
110
|
+
adaptation: number;
|
|
111
|
+
};
|
|
86
112
|
#private;
|
|
87
113
|
}
|
|
88
114
|
export type PipelineEnquiry = import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUCameraExposureManager.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUCameraExposureManager.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;GAWG;AACH;IAuEI;;;OAGG;IACH,+BAoCC;IAlFD;;;;OAIG;IACH,qBAFU,MAAM,CAEU;IAE1B;;;;OAIG;IACH,uBAFU,MAAM,CAEY;IAE5B;;;;;OAKG;IACH,yBAFU,MAAM,CAEc;IAE9B;;;;;OAKG;IACH,uBAFU,MAAM,CAEY;IAwD5B,gBAOC;IAED;;;;;;OAMG;IACH,4BAEC;IAED;;;;;;OAMG;IACH,4BAEC;IAED;;;;;OAKG;IACH,0BAFW,eAAe,QAMzB;IAED;;;;;;;;;;OAUG;IACH;QAN+B,KAAK;QACT,UAAU,EAA1B,MAAM;QACU,UAAU,EAA1B,MAAM;QACL;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAwBnD;IAsBD;;;;;;;;;;;;;OAaG;IACH;QAR+B,KAAK;QACT,WAAW,EAA3B,MAAM;QACU,UAAU,EAA1B,MAAM;QACU,UAAU,EAA1B,MAAM;QACW,kBAAkB,GAAnC,MAAM;QACL;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CA4DnD;;CA4EJ;8BAnYY,OAAO,6CAA6C,EAAE,eAAe"}
|