@woosh/meep-engine 3.65.0 → 3.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine.js +4 -9
- package/src/engine/graphics3/load_cube_environment.js +3 -3
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/format/lut/cube/CubeLut.d.ts +38 -0
- package/src/format/lut/cube/CubeLut.d.ts.map +1 -0
- package/src/format/lut/cube/CubeLut.js +23 -0
- package/src/format/lut/cube/cube_read.d.ts +23 -0
- package/src/format/lut/cube/cube_read.d.ts.map +1 -0
- package/src/format/lut/cube/cube_read.js +199 -0
- package/src/format/lut/cube/cube_write.d.ts +15 -0
- package/src/format/lut/cube/cube_write.d.ts.map +1 -0
- package/src/format/lut/cube/cube_write.js +90 -0
- package/src/shade/playground/probe_clipmap/README.md +1 -0
- package/src/shade/playground/probe_clipmap/index.html +48 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +36 -0
- package/src/shade/renderer/Renderer.d.ts +7 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +225 -27
- package/src/shade/renderer/ShadeIndirectLightingMode.d.ts +1 -0
- package/src/shade/renderer/ShadeIndirectLightingMode.js +9 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +22 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js +160 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts +45 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.js +57 -0
- package/src/shade/renderer/atmosphere/GPUSky.d.ts +23 -8
- package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/GPUSky.js +91 -34
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts +17 -0
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.js +55 -25
- package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts +164 -0
- package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/SceneAtmosphere.js +308 -0
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts +3 -12
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.js +52 -89
- package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts +14 -0
- package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.js +103 -0
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts +10 -4
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js +95 -57
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts +10 -14
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js +97 -69
- package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts +17 -0
- package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.js +117 -48
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts +8 -0
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.js +65 -35
- package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts +2 -1
- package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/compute_mie_absorption.js +6 -6
- package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts +41 -0
- package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.js +123 -0
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +21 -64
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts +6 -2
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +55 -179
- package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts +7 -0
- package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts.map +1 -0
- package/src/shade/renderer/atmosphere/shader_sky_view_lut.js +111 -0
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts +0 -1
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts.map +1 -1
- package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +68 -79
- package/src/shade/renderer/deferred/shader_background.js +1 -1
- package/src/shade/renderer/deferred/shader_background_sky.d.ts +5 -0
- package/src/shade/renderer/deferred/shader_background_sky.d.ts.map +1 -0
- package/src/shade/renderer/deferred/shader_background_sky.js +130 -0
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +73 -4
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ColorGrade.js +113 -7
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts +12 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.js +12 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +15 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.js +31 -3
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +26 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +55 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +2 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.js +6 -3
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +3 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.js +7 -3
- package/src/shade/renderer/extension/ViewTextures.d.ts +3 -2
- package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
- package/src/shade/renderer/extension/ViewTextures.js +3 -2
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +20 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +29 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts +47 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js +246 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +4 -15
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +8 -148
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +4 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +9 -58
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +142 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +938 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +192 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +231 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +11 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +25 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +110 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +197 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +150 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +408 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +23 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +63 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts +24 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.js +61 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +39 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +126 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +21 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +74 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts +20 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.js +26 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts +24 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.js +57 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +22 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +53 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +62 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +156 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts +18 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.js +50 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +21 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +54 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +67 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +509 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts +20 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.js +128 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +62 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +478 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +69 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +457 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +27 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +219 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +22 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +151 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +66 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +301 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +59 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +364 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +40 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +275 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -1
- package/src/shade/renderer/grass/blade/GPUGrassBlades.js +17 -2
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +18 -8
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -1
- package/src/shade/renderer/grass/blade/grass_blade_resolve.js +114 -32
- package/src/shade/renderer/light/GPULightCollection.d.ts +1 -1
- package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
- package/src/shade/renderer/light/GPULightCollection.js +213 -80
- package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.d.ts +1 -2
- package/src/shade/renderer/light/environment/chunk_sample_environment_color.d.ts.map +1 -0
- package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.js +3 -4
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -1
- package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js +1 -1
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +35 -9
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +81 -11
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +4 -1
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +1 -1
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +1 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +1 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +1 -1
- package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.js +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +2 -0
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +2 -0
- package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +6 -0
- package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +9 -1
- package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.js +4 -3
- package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts +17 -0
- package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.js +16 -0
- package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts +21 -0
- package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.js +30 -0
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -5
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +19 -17
- package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.js +2 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +2 -1
- package/src/shade/renderer/scene/Scene.d.ts +9 -2
- package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/Scene.js +10 -2
- package/src/shade/renderer/shader/ImageShader.d.ts +24 -12
- package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ImageShader.js +11 -8
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts +3 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js +11 -3
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts +2 -11
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js +23 -32
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js +14 -2
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js +4 -2
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js +11 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js +68 -69
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts +4 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js +46 -39
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js +5 -3
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +7 -0
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +4 -4
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +86 -5
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +73 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +139 -0
- package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.js +30 -0
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js +60 -0
- package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.d.ts → io/chunk_light_get_sun.d.ts} +3 -6
- package/src/shade/renderer/shader/chunk/light/io/chunk_light_get_sun.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.js → io/chunk_light_get_sun.js} +6 -26
- package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.js +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +3 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -2
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +743 -739
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +2 -0
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +19 -17
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +5 -3
- package/src/shade/renderer/water/chunk_water_gi.js +2 -0
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts +0 -2
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +0 -45
- package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts +0 -2
- package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +0 -17
- package/src/engine/graphics/sh3/sky/hosek/README.md +0 -4
- package/src/engine/graphics/sh3/sky/hosek/data.d.ts +0 -17
- package/src/engine/graphics/sh3/sky/hosek/data.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/data.js +0 -3744
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts +0 -2
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +0 -71
- package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts +0 -26
- package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.js +0 -70
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +0 -22
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +0 -1
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +0 -388
- package/src/engine/graphics3/make_default_environment.d.ts +0 -15
- package/src/engine/graphics3/make_default_environment.d.ts.map +0 -1
- package/src/engine/graphics3/make_default_environment.js +0 -111
- package/src/shade/renderer/atmosphere/MIE_G.d.ts +0 -6
- package/src/shade/renderer/atmosphere/MIE_G.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/MIE_G.js +0 -5
- package/src/shade/renderer/atmosphere/chunk_sample_environment_color.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts +0 -4
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.js +0 -44
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +0 -2
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.js +0 -43
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.js +0 -6
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.js +0 -18
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts +0 -14
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.js +0 -86
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts +0 -8
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.js +0 -125
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.js +0 -17
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.js +0 -38
- package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts +0 -16
- package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.js +0 -28
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts +0 -11
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.js +0 -56
- package/src/shade/renderer/shader/chunk/light/sky/chunk_sample_sky_color.d.ts.map +0 -1
- package/src/shade/renderer/view/GPUViewSkyContext.d.ts +0 -26
- package/src/shade/renderer/view/GPUViewSkyContext.d.ts.map +0 -1
- package/src/shade/renderer/view/GPUViewSkyContext.js +0 -170
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A probe's radiance from its rays (Lumen's `ScreenProbeCompositeTracesWithScatterCS`): a workgroup a probe, its lanes
|
|
3
|
+
* over its n² rays, then over its n² texels.
|
|
4
|
+
*
|
|
5
|
+
* - **A ray's weight** is its texel's share of the probe's texel, (n / its level's resolution)²: one, or a quarter
|
|
6
|
+
* for a child of a split texel, which holds a quarter of the solid angle (the map is equal-area).
|
|
7
|
+
* - **Its radiance**, pre-exposed as every ray's is, times the weight, held to `SCREEN_PROBE_MAX_RAY_INTENSITY`, the
|
|
8
|
+
* brightest channel scaled down to it: the display's units, so a sum of the brightest rays stays well inside the
|
|
9
|
+
* atlas's half floats at any exposure.
|
|
10
|
+
* - **Its texel**: where its direction falls on the probe's n² grid, less half a texel, and from there to the texel
|
|
11
|
+
* below or above along each axis as the probe's dither, one blue-noise draw at the probe's tile half the noise's
|
|
12
|
+
* period from the jitter's, falls under or over the place's fraction: each ray lands in one of the four texels about
|
|
13
|
+
* it in proportion to its bilinear weights, which hides the grid of directions. A step past the octahedron's edge
|
|
14
|
+
* lands on its fold (`screen_probe_texel_wrap`).
|
|
15
|
+
* - **Accumulated** in workgroup memory, fixed point with the scale that keeps n² of the largest radiance in a word;
|
|
16
|
+
* each texel keeps the nearest hit among the rays that landed, and whether any did.
|
|
17
|
+
* - **The texels**: the sum, not normalised, as Lumen's: a texel takes about one ray's weight on average; the nearest
|
|
18
|
+
* hit in alpha, negative where none landed.
|
|
19
|
+
* - **The probe's moving share**: the moving rays' weight over n², Lumen's, which its thresholds are set against (the
|
|
20
|
+
* filter's 1%, the fast update's 10%). With importance sampling the rays' weights sum to less than n², so a share
|
|
21
|
+
* of their sum would pass those thresholds at less motion.
|
|
22
|
+
* - Rays that ended unresolved, or of no ray, bring nothing; a probe on no surface is zero.
|
|
23
|
+
*
|
|
24
|
+
* @type {ComputeShader}
|
|
25
|
+
*/
|
|
26
|
+
export const shader_screen_probe_composite: ComputeShader;
|
|
27
|
+
/**
|
|
28
|
+
* One pass of the filter between probes (Lumen's `ScreenProbeFilterGatherTracesCS`): a thread a texel of the frame's
|
|
29
|
+
* probes, through the thread-a-ray command; its result in alpha keeps the texel's own nearest hit, which no pass
|
|
30
|
+
* changes.
|
|
31
|
+
*
|
|
32
|
+
* - **The texel itself** weighs one where a ray landed in it, and nothing where none did.
|
|
33
|
+
* - **Its neighbours**: the uniform probes of the four tiles beside its probe's, the same texel of each; with the
|
|
34
|
+
* probe's rays seeing more than 1% moving, the eight beyond them too, as the temporal filter will hold less of its
|
|
35
|
+
* history.
|
|
36
|
+
* - **A neighbour's weight**: its plane weight from the probe's plane, on the same surface, times, unless the probe's
|
|
37
|
+
* rays saw something moving, an angle weight: where the neighbour's ray in the texel hit, at the nearer of its own
|
|
38
|
+
* and the probe's nearest hits, seen from the probe, against the texel's direction, `1 − angle / θ`. θ is the half
|
|
39
|
+
* angle of the cone with a texel's solid angle, acos(1 − 2/n²), 14.4° at n = 8: a neighbour's light is the
|
|
40
|
+
* texel's when what it saw lies inside the texel's cone from here. Lumen's 10° is the cone of half the texel's
|
|
41
|
+
* solid angle at n = 8.
|
|
42
|
+
* - A neighbour on no surface, or whose texel no ray landed in, gives nothing. The mean of what is given; zero where
|
|
43
|
+
* nothing is.
|
|
44
|
+
*
|
|
45
|
+
* Lumen weighs a neighbour by its depth's difference; the plane weight here is interpolation's, on which a neighbour
|
|
46
|
+
* further along a slanted surface is still the same surface.
|
|
47
|
+
*
|
|
48
|
+
* @type {ComputeShader}
|
|
49
|
+
*/
|
|
50
|
+
export const shader_screen_probe_filter: ComputeShader;
|
|
51
|
+
/**
|
|
52
|
+
* A probe's radiance as SH3 (Lumen's `ScreenProbeConvertToIrradianceCS`, its SH3 form): a workgroup a probe, its lanes
|
|
53
|
+
* over its texels. The radiance is pre-exposed, and so is the SH. Each texel holds 4π/n² of the sphere, so the
|
|
54
|
+
* projection is `Σ L(ωᵢ)·Y(ωᵢ)·4π/n²` over the texels, at
|
|
55
|
+
* each texel's centre; a texel no ray landed in adds nothing. Stored as the probe clipmap's records store theirs
|
|
56
|
+
* (`probe_record_sh_encode`), seven words a probe; readers resolve E with `sh3_color_get_irradiance_at`.
|
|
57
|
+
*
|
|
58
|
+
* @type {ComputeShader}
|
|
59
|
+
*/
|
|
60
|
+
export const shader_screen_probe_irradiance: ComputeShader;
|
|
61
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
62
|
+
//# sourceMappingURL=shader_screen_probe_gather.d.ts.map
|
package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_screen_probe_gather.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js"],"names":[],"mappings":"AAmDA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,4CAFU,aAAa,CAqIpB;AAaH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yCAFU,aAAa,CAgIpB;AAWH;;;;;;;;GAQG;AACH,6CAFU,aAAa,CA0FpB;8BArd2B,+BAA+B"}
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { chunk_uv_equal_area_sphere } from "../../shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js";
|
|
2
|
+
import {
|
|
3
|
+
chunk_uv_octahedral_unit_decode
|
|
4
|
+
} from "../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
|
|
5
|
+
import { chunk_folded_workgroup_index } from "../../shader/chunk/grid/chunk_folded_workgroup_index.js";
|
|
6
|
+
import { chunk_stbn_sample_vec2 } from "../../shader/chunk/noise/chunk_stbn_sample_vec2.js";
|
|
7
|
+
import { chunk_sh3_basis_at } from "../../shader/chunk/spherical_harmonics/chunk_sh3_basis_at.js";
|
|
8
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
9
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
10
|
+
import { ShaderResourceDescriptor } from "../../shader/resource/ShaderResourceDescriptor.js";
|
|
11
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
12
|
+
import { u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
13
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
14
|
+
import { STBN_VEC2_RESOURCE } from "../../STATIC_GRAPHICS_ENGINE_ASSET_RESOURCES.js";
|
|
15
|
+
import { chunk_probe_clipmap } from "../probe_clipmap/probe/chunk_probe_clipmap.js";
|
|
16
|
+
import {
|
|
17
|
+
chunk_screen_probe,
|
|
18
|
+
chunk_screen_probe_counts,
|
|
19
|
+
chunk_screen_probe_ray_jitter,
|
|
20
|
+
SCREEN_PROBE_DISPATCH_READ_RESOURCE,
|
|
21
|
+
SCREEN_PROBE_FRAME_RESOURCE,
|
|
22
|
+
SCREEN_PROBE_MOVING_READ_RESOURCE,
|
|
23
|
+
SCREEN_PROBE_MOVING_WRITE_RESOURCE,
|
|
24
|
+
SCREEN_PROBE_RADIANCE_READ_RESOURCE,
|
|
25
|
+
SCREEN_PROBE_RADIANCE_WRITE_RESOURCE,
|
|
26
|
+
SCREEN_PROBE_RAY_INFO_READ_RESOURCE,
|
|
27
|
+
SCREEN_PROBE_SH_WRITE_RESOURCE,
|
|
28
|
+
SCREEN_PROBE_TRACE_HIT_READ_RESOURCE,
|
|
29
|
+
SCREEN_PROBE_TRACE_RADIANCE_READ_RESOURCE,
|
|
30
|
+
SCREEN_PROBES_READ_RESOURCE
|
|
31
|
+
} from "./chunk_screen_probe.js";
|
|
32
|
+
import { chunk_screen_probe_workgroup_sum } from "./chunk_screen_probe_workgroup_sum.js";
|
|
33
|
+
import {
|
|
34
|
+
SCREEN_PROBE_MAX_RAY_INTENSITY,
|
|
35
|
+
SCREEN_PROBE_OCTAHEDRON_LIMIT,
|
|
36
|
+
SCREEN_PROBE_THREAD_WORKGROUP_SIZE
|
|
37
|
+
} from "./SCREEN_PROBE.js";
|
|
38
|
+
|
|
39
|
+
const composite_resources = new ShaderResourceSetDescriptor();
|
|
40
|
+
|
|
41
|
+
composite_resources.createGroup()
|
|
42
|
+
.add(SCREEN_PROBE_FRAME_RESOURCE)
|
|
43
|
+
.add(SCREEN_PROBES_READ_RESOURCE)
|
|
44
|
+
.add(SCREEN_PROBE_DISPATCH_READ_RESOURCE)
|
|
45
|
+
.add(SCREEN_PROBE_MOVING_WRITE_RESOURCE)
|
|
46
|
+
.add(STBN_VEC2_RESOURCE)
|
|
47
|
+
.add(SCREEN_PROBE_RAY_INFO_READ_RESOURCE)
|
|
48
|
+
.add(SCREEN_PROBE_TRACE_RADIANCE_READ_RESOURCE)
|
|
49
|
+
.add(SCREEN_PROBE_TRACE_HIT_READ_RESOURCE)
|
|
50
|
+
.add(SCREEN_PROBE_RADIANCE_WRITE_RESOURCE);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A probe's radiance from its rays (Lumen's `ScreenProbeCompositeTracesWithScatterCS`): a workgroup a probe, its lanes
|
|
54
|
+
* over its n² rays, then over its n² texels.
|
|
55
|
+
*
|
|
56
|
+
* - **A ray's weight** is its texel's share of the probe's texel, (n / its level's resolution)²: one, or a quarter
|
|
57
|
+
* for a child of a split texel, which holds a quarter of the solid angle (the map is equal-area).
|
|
58
|
+
* - **Its radiance**, pre-exposed as every ray's is, times the weight, held to `SCREEN_PROBE_MAX_RAY_INTENSITY`, the
|
|
59
|
+
* brightest channel scaled down to it: the display's units, so a sum of the brightest rays stays well inside the
|
|
60
|
+
* atlas's half floats at any exposure.
|
|
61
|
+
* - **Its texel**: where its direction falls on the probe's n² grid, less half a texel, and from there to the texel
|
|
62
|
+
* below or above along each axis as the probe's dither, one blue-noise draw at the probe's tile half the noise's
|
|
63
|
+
* period from the jitter's, falls under or over the place's fraction: each ray lands in one of the four texels about
|
|
64
|
+
* it in proportion to its bilinear weights, which hides the grid of directions. A step past the octahedron's edge
|
|
65
|
+
* lands on its fold (`screen_probe_texel_wrap`).
|
|
66
|
+
* - **Accumulated** in workgroup memory, fixed point with the scale that keeps n² of the largest radiance in a word;
|
|
67
|
+
* each texel keeps the nearest hit among the rays that landed, and whether any did.
|
|
68
|
+
* - **The texels**: the sum, not normalised, as Lumen's: a texel takes about one ray's weight on average; the nearest
|
|
69
|
+
* hit in alpha, negative where none landed.
|
|
70
|
+
* - **The probe's moving share**: the moving rays' weight over n², Lumen's, which its thresholds are set against (the
|
|
71
|
+
* filter's 1%, the fast update's 10%). With importance sampling the rays' weights sum to less than n², so a share
|
|
72
|
+
* of their sum would pass those thresholds at less motion.
|
|
73
|
+
* - Rays that ended unresolved, or of no ray, bring nothing; a probe on no surface is zero.
|
|
74
|
+
*
|
|
75
|
+
* @type {ComputeShader}
|
|
76
|
+
*/
|
|
77
|
+
export const shader_screen_probe_composite = ComputeShader.from({
|
|
78
|
+
label: "Screen Probe Composite",
|
|
79
|
+
resources: composite_resources,
|
|
80
|
+
body: CodeChunk.from(
|
|
81
|
+
//language=WGSL
|
|
82
|
+
`
|
|
83
|
+
const SCREEN_PROBE_TEXEL_LIMIT = ${SCREEN_PROBE_OCTAHEDRON_LIMIT * SCREEN_PROBE_OCTAHEDRON_LIMIT}u;
|
|
84
|
+
|
|
85
|
+
// each texel's red, green, blue, and how many rays landed
|
|
86
|
+
var<workgroup> screen_probe_sums: array<atomic<u32>, ${4 * SCREEN_PROBE_OCTAHEDRON_LIMIT * SCREEN_PROBE_OCTAHEDRON_LIMIT}>;
|
|
87
|
+
// each texel's nearest hit, a positive f32's bits, which order as the floats do
|
|
88
|
+
var<workgroup> screen_probe_nearest: array<atomic<u32>, SCREEN_PROBE_TEXEL_LIMIT>;
|
|
89
|
+
|
|
90
|
+
@compute @workgroup_size(${SCREEN_PROBE_THREAD_WORKGROUP_SIZE})
|
|
91
|
+
fn main(
|
|
92
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
93
|
+
@builtin(local_invocation_index) lane: u32,
|
|
94
|
+
@builtin(subgroup_invocation_id) subgroup_lane: u32,
|
|
95
|
+
@builtin(subgroup_size) subgroup_size: u32,
|
|
96
|
+
) {
|
|
97
|
+
let probe = folded_workgroup_index(workgroup_id);
|
|
98
|
+
|
|
99
|
+
if (probe >= screen_probe_count()) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let frame = screen_probe_frame;
|
|
104
|
+
let n = frame.octahedron_resolution;
|
|
105
|
+
let count = n * n;
|
|
106
|
+
let record = screen_probes[probe];
|
|
107
|
+
|
|
108
|
+
if (record.depth <= 0.0) {
|
|
109
|
+
for (var t = lane; t < count; t += ${SCREEN_PROBE_THREAD_WORKGROUP_SIZE}u) {
|
|
110
|
+
textureStore(screen_probe_radiance_out, screen_probe_texel(probe, t), vec4<f32>(0.0, 0.0, 0.0, -1.0));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (lane == 0u) {
|
|
114
|
+
screen_probe_moving[probe] = 0.0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
for (var t = lane; t < count; t += ${SCREEN_PROBE_THREAD_WORKGROUP_SIZE}u) {
|
|
121
|
+
atomicStore(&screen_probe_sums[4u * t], 0u);
|
|
122
|
+
atomicStore(&screen_probe_sums[4u * t + 1u], 0u);
|
|
123
|
+
atomicStore(&screen_probe_sums[4u * t + 2u], 0u);
|
|
124
|
+
atomicStore(&screen_probe_sums[4u * t + 3u], 0u);
|
|
125
|
+
atomicStore(&screen_probe_nearest[t], bitcast<u32>(65504.0));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
workgroupBarrier();
|
|
129
|
+
|
|
130
|
+
// the largest radiance a ray may bring, and the fixed point that holds n² of it in a word: 2³² − 256, the largest
|
|
131
|
+
// u32 an f32 holds exactly, where 4294967295.0 rounds up to 2³² and n² rays at the limit wrap a word to zero
|
|
132
|
+
let limit = ${SCREEN_PROBE_MAX_RAY_INTENSITY}.0;
|
|
133
|
+
let quantum = (4294967040.0 / f32(count)) / limit;
|
|
134
|
+
|
|
135
|
+
let pixel = screen_probe_pixel_decode(record.pixel);
|
|
136
|
+
let tile = screen_probe_noise_tile(probe, pixel);
|
|
137
|
+
let jitter = screen_probe_ray_jitter(tile);
|
|
138
|
+
let dither = stbn_sample_vec2(vec3<u32>(tile, frame.frame_index + 32u));
|
|
139
|
+
|
|
140
|
+
var moving = 0.0;
|
|
141
|
+
|
|
142
|
+
for (var slot = lane; slot < count; slot += ${SCREEN_PROBE_THREAD_WORKGROUP_SIZE}u) {
|
|
143
|
+
let at = screen_probe_texel(probe, slot);
|
|
144
|
+
let hit = textureLoad(screen_probe_trace_hit, at, 0).r;
|
|
145
|
+
let kind = screen_probe_trace_hit_kind(hit);
|
|
146
|
+
|
|
147
|
+
if (kind == SCREEN_PROBE_TRACE_PENDING || kind == SCREEN_PROBE_TRACE_UNRESOLVED || kind == SCREEN_PROBE_TRACE_NONE) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let info = textureLoad(screen_probe_ray_info, at, 0).r;
|
|
152
|
+
let size = f32((n * 2u) >> screen_probe_ray_info_level(info));
|
|
153
|
+
let share = f32(n) / size;
|
|
154
|
+
let weight = share * share;
|
|
155
|
+
|
|
156
|
+
var radiance = textureLoad(screen_probe_trace_radiance, at, 0).rgb * weight;
|
|
157
|
+
let brightest = max(radiance.r, max(radiance.g, radiance.b));
|
|
158
|
+
|
|
159
|
+
if (brightest > limit) {
|
|
160
|
+
radiance *= limit / brightest;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// the ray's place on the probe's grid, dithered to one of the four texels about it
|
|
164
|
+
let place = (vec2<f32>(screen_probe_ray_info_texel(info)) + jitter) * share - 0.5;
|
|
165
|
+
let corner = floor(place);
|
|
166
|
+
let landing = screen_probe_texel_wrap(vec2<i32>(corner) + select(vec2<i32>(1), vec2<i32>(0), place - corner < dither));
|
|
167
|
+
let index = landing.y * n + landing.x;
|
|
168
|
+
|
|
169
|
+
let quantised = vec3<u32>(radiance * quantum);
|
|
170
|
+
|
|
171
|
+
atomicAdd(&screen_probe_sums[4u * index], quantised.r);
|
|
172
|
+
atomicAdd(&screen_probe_sums[4u * index + 1u], quantised.g);
|
|
173
|
+
atomicAdd(&screen_probe_sums[4u * index + 2u], quantised.b);
|
|
174
|
+
atomicAdd(&screen_probe_sums[4u * index + 3u], 1u);
|
|
175
|
+
atomicMin(&screen_probe_nearest[index], bitcast<u32>(max(screen_probe_trace_hit_distance(hit), 0.0)));
|
|
176
|
+
|
|
177
|
+
moving += select(0.0, weight, (hit & SCREEN_PROBE_TRACE_MOVING) != 0u);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
workgroupBarrier();
|
|
181
|
+
|
|
182
|
+
for (var t = lane; t < count; t += ${SCREEN_PROBE_THREAD_WORKGROUP_SIZE}u) {
|
|
183
|
+
let sum = vec3<f32>(vec3<u32>(
|
|
184
|
+
atomicLoad(&screen_probe_sums[4u * t]),
|
|
185
|
+
atomicLoad(&screen_probe_sums[4u * t + 1u]),
|
|
186
|
+
atomicLoad(&screen_probe_sums[4u * t + 2u]),
|
|
187
|
+
)) / quantum;
|
|
188
|
+
let landed = atomicLoad(&screen_probe_sums[4u * t + 3u]) != 0u;
|
|
189
|
+
let nearest = select(-1.0, bitcast<f32>(atomicLoad(&screen_probe_nearest[t])), landed);
|
|
190
|
+
|
|
191
|
+
textureStore(screen_probe_radiance_out, screen_probe_texel(probe, t), vec4<f32>(sum, nearest));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
let shares = screen_probe_workgroup_sum(vec4<f32>(moving, 0.0, 0.0, 0.0), lane, subgroup_lane, subgroup_size);
|
|
195
|
+
|
|
196
|
+
if (lane == 0u) {
|
|
197
|
+
screen_probe_moving[probe] = shares.x / f32(count);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
`, [
|
|
201
|
+
chunk_screen_probe,
|
|
202
|
+
chunk_screen_probe_counts,
|
|
203
|
+
chunk_screen_probe_ray_jitter,
|
|
204
|
+
chunk_screen_probe_workgroup_sum,
|
|
205
|
+
chunk_folded_workgroup_index,
|
|
206
|
+
chunk_stbn_sample_vec2,
|
|
207
|
+
]),
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const filter_resources = new ShaderResourceSetDescriptor();
|
|
211
|
+
|
|
212
|
+
filter_resources.createGroup()
|
|
213
|
+
.add(SCREEN_PROBE_FRAME_RESOURCE)
|
|
214
|
+
.add(SCREEN_PROBES_READ_RESOURCE)
|
|
215
|
+
.add(SCREEN_PROBE_DISPATCH_READ_RESOURCE)
|
|
216
|
+
.add(SCREEN_PROBE_MOVING_READ_RESOURCE)
|
|
217
|
+
.add(STBN_VEC2_RESOURCE)
|
|
218
|
+
.add(SCREEN_PROBE_RADIANCE_READ_RESOURCE)
|
|
219
|
+
.add(SCREEN_PROBE_RADIANCE_WRITE_RESOURCE);
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* One pass of the filter between probes (Lumen's `ScreenProbeFilterGatherTracesCS`): a thread a texel of the frame's
|
|
223
|
+
* probes, through the thread-a-ray command; its result in alpha keeps the texel's own nearest hit, which no pass
|
|
224
|
+
* changes.
|
|
225
|
+
*
|
|
226
|
+
* - **The texel itself** weighs one where a ray landed in it, and nothing where none did.
|
|
227
|
+
* - **Its neighbours**: the uniform probes of the four tiles beside its probe's, the same texel of each; with the
|
|
228
|
+
* probe's rays seeing more than 1% moving, the eight beyond them too, as the temporal filter will hold less of its
|
|
229
|
+
* history.
|
|
230
|
+
* - **A neighbour's weight**: its plane weight from the probe's plane, on the same surface, times, unless the probe's
|
|
231
|
+
* rays saw something moving, an angle weight: where the neighbour's ray in the texel hit, at the nearer of its own
|
|
232
|
+
* and the probe's nearest hits, seen from the probe, against the texel's direction, `1 − angle / θ`. θ is the half
|
|
233
|
+
* angle of the cone with a texel's solid angle, acos(1 − 2/n²), 14.4° at n = 8: a neighbour's light is the
|
|
234
|
+
* texel's when what it saw lies inside the texel's cone from here. Lumen's 10° is the cone of half the texel's
|
|
235
|
+
* solid angle at n = 8.
|
|
236
|
+
* - A neighbour on no surface, or whose texel no ray landed in, gives nothing. The mean of what is given; zero where
|
|
237
|
+
* nothing is.
|
|
238
|
+
*
|
|
239
|
+
* Lumen weighs a neighbour by its depth's difference; the plane weight here is interpolation's, on which a neighbour
|
|
240
|
+
* further along a slanted surface is still the same surface.
|
|
241
|
+
*
|
|
242
|
+
* @type {ComputeShader}
|
|
243
|
+
*/
|
|
244
|
+
export const shader_screen_probe_filter = ComputeShader.from({
|
|
245
|
+
label: "Screen Probe Filter",
|
|
246
|
+
resources: filter_resources,
|
|
247
|
+
body: CodeChunk.from(
|
|
248
|
+
//language=WGSL
|
|
249
|
+
`
|
|
250
|
+
struct ScreenProbeFilterSum {
|
|
251
|
+
radiance: vec3<f32>,
|
|
252
|
+
weight: f32,
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// one neighbour's share of the texel, by its tile offset from the probe's tile
|
|
256
|
+
fn screen_probe_filter_neighbour(
|
|
257
|
+
sum: ScreenProbeFilterSum,
|
|
258
|
+
tile: vec2<i32>,
|
|
259
|
+
offset: vec2<i32>,
|
|
260
|
+
slot: u32,
|
|
261
|
+
position: vec3<f32>,
|
|
262
|
+
plane: vec4<f32>,
|
|
263
|
+
depth: f32,
|
|
264
|
+
direction: vec3<f32>,
|
|
265
|
+
own_hit: f32,
|
|
266
|
+
angular: bool,
|
|
267
|
+
cos_limit: f32,
|
|
268
|
+
) -> ScreenProbeFilterSum {
|
|
269
|
+
let tiles = vec2<i32>(screen_probe_frame.tile_count);
|
|
270
|
+
let at = tile + offset;
|
|
271
|
+
|
|
272
|
+
if (any(at < vec2<i32>(0)) || any(at >= tiles)) {
|
|
273
|
+
return sum;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
let neighbour = u32(at.y) * screen_probe_frame.tile_count.x + u32(at.x);
|
|
277
|
+
let record = screen_probes[neighbour];
|
|
278
|
+
|
|
279
|
+
if (record.depth <= 0.0) {
|
|
280
|
+
return sum;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
let position_weight = screen_probe_plane_weight(plane, record.position, depth);
|
|
284
|
+
let value = textureLoad(screen_probe_radiance, screen_probe_texel(neighbour, slot), 0);
|
|
285
|
+
|
|
286
|
+
if (position_weight <= 0.0 || value.a < 0.0) {
|
|
287
|
+
return sum;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
var weight = position_weight;
|
|
291
|
+
|
|
292
|
+
if (angular) {
|
|
293
|
+
// where the neighbour's ray hit, held to the probe's own nearest so a near occluder's shadow stays
|
|
294
|
+
let reach = select(value.a, min(value.a, own_hit), own_hit >= 0.0);
|
|
295
|
+
let to_hit = record.position + direction * reach - position;
|
|
296
|
+
let cosine = dot(to_hit, direction) / max(length(to_hit), 1e-20);
|
|
297
|
+
|
|
298
|
+
weight *= 1.0 - saturate(acos(clamp(cosine, -1.0, 1.0)) / acos(cos_limit));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return ScreenProbeFilterSum(sum.radiance + value.rgb * weight, sum.weight + weight);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@compute @workgroup_size(${SCREEN_PROBE_THREAD_WORKGROUP_SIZE})
|
|
305
|
+
fn main(
|
|
306
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
307
|
+
@builtin(local_invocation_index) lane: u32,
|
|
308
|
+
) {
|
|
309
|
+
let frame = screen_probe_frame;
|
|
310
|
+
let index = folded_workgroup_index(workgroup_id) * ${SCREEN_PROBE_THREAD_WORKGROUP_SIZE}u + lane;
|
|
311
|
+
let shift = 2u * frame.octahedron_shift;
|
|
312
|
+
let probe = index >> shift;
|
|
313
|
+
let slot = index & ((1u << shift) - 1u);
|
|
314
|
+
|
|
315
|
+
if (probe >= screen_probe_count()) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
let texel = screen_probe_texel(probe, slot);
|
|
320
|
+
let record = screen_probes[probe];
|
|
321
|
+
|
|
322
|
+
if (record.depth <= 0.0) {
|
|
323
|
+
textureStore(screen_probe_radiance_out, texel, vec4<f32>(0.0, 0.0, 0.0, -1.0));
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let n = frame.octahedron_resolution;
|
|
328
|
+
let own = textureLoad(screen_probe_radiance, texel, 0);
|
|
329
|
+
let normal = uv_octahedral_unit_decode(unpack2x16unorm(record.normal));
|
|
330
|
+
let plane = vec4<f32>(normal, dot(normal, record.position));
|
|
331
|
+
let pixel = screen_probe_pixel_decode(record.pixel);
|
|
332
|
+
let tile = screen_probe_noise_tile(probe, pixel);
|
|
333
|
+
let in_probe = vec2<u32>(slot & (n - 1u), slot >> frame.octahedron_shift);
|
|
334
|
+
let direction = uv_equal_area_sphere_decode((vec2<f32>(in_probe) + screen_probe_ray_jitter(tile)) / f32(n));
|
|
335
|
+
|
|
336
|
+
let moving = screen_probe_moving[probe] > 0.01;
|
|
337
|
+
let cos_limit = 1.0 - 2.0 / f32(n * n);
|
|
338
|
+
let t = vec2<i32>(tile);
|
|
339
|
+
|
|
340
|
+
var sum = ScreenProbeFilterSum(select(vec3<f32>(0.0), own.rgb, own.a >= 0.0), select(0.0, 1.0, own.a >= 0.0));
|
|
341
|
+
|
|
342
|
+
// each neighbour by name
|
|
343
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(-1, 0), slot, record.position, plane, record.depth, direction, own.a, !moving, cos_limit);
|
|
344
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(1, 0), slot, record.position, plane, record.depth, direction, own.a, !moving, cos_limit);
|
|
345
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(0, -1), slot, record.position, plane, record.depth, direction, own.a, !moving, cos_limit);
|
|
346
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(0, 1), slot, record.position, plane, record.depth, direction, own.a, !moving, cos_limit);
|
|
347
|
+
|
|
348
|
+
if (moving) {
|
|
349
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(-2, 0), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
350
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(2, 0), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
351
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(0, -2), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
352
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(0, 2), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
353
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(-1, 1), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
354
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(1, 1), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
355
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(-1, -1), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
356
|
+
sum = screen_probe_filter_neighbour(sum, t, vec2<i32>(1, -1), slot, record.position, plane, record.depth, direction, own.a, false, cos_limit);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
let radiance = select(vec3<f32>(0.0), sum.radiance / sum.weight, sum.weight > 0.0);
|
|
360
|
+
|
|
361
|
+
textureStore(screen_probe_radiance_out, texel, vec4<f32>(radiance, own.a));
|
|
362
|
+
}
|
|
363
|
+
`, [
|
|
364
|
+
chunk_screen_probe,
|
|
365
|
+
chunk_screen_probe_counts,
|
|
366
|
+
chunk_screen_probe_ray_jitter,
|
|
367
|
+
chunk_folded_workgroup_index,
|
|
368
|
+
chunk_uv_octahedral_unit_decode,
|
|
369
|
+
]),
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
const irradiance_resources = new ShaderResourceSetDescriptor();
|
|
373
|
+
|
|
374
|
+
irradiance_resources.createGroup()
|
|
375
|
+
.add(SCREEN_PROBE_FRAME_RESOURCE)
|
|
376
|
+
.add(SCREEN_PROBES_READ_RESOURCE)
|
|
377
|
+
.add(SCREEN_PROBE_DISPATCH_READ_RESOURCE)
|
|
378
|
+
.add(SCREEN_PROBE_SH_WRITE_RESOURCE)
|
|
379
|
+
.add(SCREEN_PROBE_RADIANCE_READ_RESOURCE);
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* A probe's radiance as SH3 (Lumen's `ScreenProbeConvertToIrradianceCS`, its SH3 form): a workgroup a probe, its lanes
|
|
383
|
+
* over its texels. The radiance is pre-exposed, and so is the SH. Each texel holds 4π/n² of the sphere, so the
|
|
384
|
+
* projection is `Σ L(ωᵢ)·Y(ωᵢ)·4π/n²` over the texels, at
|
|
385
|
+
* each texel's centre; a texel no ray landed in adds nothing. Stored as the probe clipmap's records store theirs
|
|
386
|
+
* (`probe_record_sh_encode`), seven words a probe; readers resolve E with `sh3_color_get_irradiance_at`.
|
|
387
|
+
*
|
|
388
|
+
* @type {ComputeShader}
|
|
389
|
+
*/
|
|
390
|
+
export const shader_screen_probe_irradiance = ComputeShader.from({
|
|
391
|
+
label: "Screen Probe Irradiance",
|
|
392
|
+
resources: irradiance_resources,
|
|
393
|
+
body: CodeChunk.from(
|
|
394
|
+
//language=WGSL
|
|
395
|
+
`
|
|
396
|
+
@compute @workgroup_size(${SCREEN_PROBE_THREAD_WORKGROUP_SIZE})
|
|
397
|
+
fn main(
|
|
398
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
399
|
+
@builtin(local_invocation_index) lane: u32,
|
|
400
|
+
@builtin(subgroup_invocation_id) subgroup_lane: u32,
|
|
401
|
+
@builtin(subgroup_size) subgroup_size: u32,
|
|
402
|
+
) {
|
|
403
|
+
let probe = folded_workgroup_index(workgroup_id);
|
|
404
|
+
|
|
405
|
+
if (probe >= screen_probe_count()) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
let frame = screen_probe_frame;
|
|
410
|
+
let n = frame.octahedron_resolution;
|
|
411
|
+
let count = n * n;
|
|
412
|
+
|
|
413
|
+
var sh = array<vec3<f32>, 9>();
|
|
414
|
+
|
|
415
|
+
if (screen_probes[probe].depth > 0.0) {
|
|
416
|
+
for (var t = lane; t < count; t += ${SCREEN_PROBE_THREAD_WORKGROUP_SIZE}u) {
|
|
417
|
+
let value = textureLoad(screen_probe_radiance, screen_probe_texel(probe, t), 0);
|
|
418
|
+
|
|
419
|
+
if (value.a < 0.0) {
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
let texel = vec2<u32>(t & (n - 1u), t >> frame.octahedron_shift);
|
|
424
|
+
let basis = sh3_basis_at(uv_equal_area_sphere_decode((vec2<f32>(texel) + 0.5) / f32(n)));
|
|
425
|
+
|
|
426
|
+
sh[0] += value.rgb * basis[0];
|
|
427
|
+
sh[1] += value.rgb * basis[1];
|
|
428
|
+
sh[2] += value.rgb * basis[2];
|
|
429
|
+
sh[3] += value.rgb * basis[3];
|
|
430
|
+
sh[4] += value.rgb * basis[4];
|
|
431
|
+
sh[5] += value.rgb * basis[5];
|
|
432
|
+
sh[6] += value.rgb * basis[6];
|
|
433
|
+
sh[7] += value.rgb * basis[7];
|
|
434
|
+
sh[8] += value.rgb * basis[8];
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// the 27 coefficients in seven sums
|
|
439
|
+
let a = screen_probe_workgroup_sum(vec4<f32>(sh[0], sh[1].r), lane, subgroup_lane, subgroup_size);
|
|
440
|
+
let b = screen_probe_workgroup_sum(vec4<f32>(sh[1].gb, sh[2].rg), lane, subgroup_lane, subgroup_size);
|
|
441
|
+
let c = screen_probe_workgroup_sum(vec4<f32>(sh[2].b, sh[3]), lane, subgroup_lane, subgroup_size);
|
|
442
|
+
let d = screen_probe_workgroup_sum(vec4<f32>(sh[4], sh[5].r), lane, subgroup_lane, subgroup_size);
|
|
443
|
+
let e = screen_probe_workgroup_sum(vec4<f32>(sh[5].gb, sh[6].rg), lane, subgroup_lane, subgroup_size);
|
|
444
|
+
let f = screen_probe_workgroup_sum(vec4<f32>(sh[6].b, sh[7]), lane, subgroup_lane, subgroup_size);
|
|
445
|
+
let g = screen_probe_workgroup_sum(vec4<f32>(sh[8], 0.0), lane, subgroup_lane, subgroup_size);
|
|
446
|
+
|
|
447
|
+
if (lane == 0u) {
|
|
448
|
+
// each texel's solid angle on the equal-area map
|
|
449
|
+
let w = 12.566370614359172 / f32(count);
|
|
450
|
+
|
|
451
|
+
let total = array<vec3<f32>, 9>(
|
|
452
|
+
a.xyz * w,
|
|
453
|
+
vec3<f32>(a.w, b.xy) * w,
|
|
454
|
+
vec3<f32>(b.zw, c.x) * w,
|
|
455
|
+
c.yzw * w,
|
|
456
|
+
d.xyz * w,
|
|
457
|
+
vec3<f32>(d.w, e.xy) * w,
|
|
458
|
+
vec3<f32>(e.zw, f.x) * w,
|
|
459
|
+
f.yzw * w,
|
|
460
|
+
g.xyz * w,
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
let words = probe_record_sh_encode(total);
|
|
464
|
+
|
|
465
|
+
for (var i = 0u; i < 7u; i++) {
|
|
466
|
+
screen_probe_sh[probe * 7u + i] = words[i];
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
`, [
|
|
471
|
+
chunk_screen_probe,
|
|
472
|
+
chunk_screen_probe_counts,
|
|
473
|
+
chunk_screen_probe_workgroup_sum,
|
|
474
|
+
chunk_folded_workgroup_index,
|
|
475
|
+
chunk_sh3_basis_at,
|
|
476
|
+
chunk_probe_clipmap,
|
|
477
|
+
]),
|
|
478
|
+
});
|
package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** Each probe's BRDF density, SH3 in three `vec4`s: coefficients 0–3, 4–7, and 8 alone. @type {ShaderResourceDescriptor} */
|
|
2
|
+
export const SCREEN_PROBE_BRDF_READ_RESOURCE: ShaderResourceDescriptor;
|
|
3
|
+
/** @type {ShaderResourceDescriptor} */
|
|
4
|
+
export const SCREEN_PROBE_BRDF_WRITE_RESOURCE: ShaderResourceDescriptor;
|
|
5
|
+
/** Each probe texel's lighting density, `r32float`, a texel a texel in the probes' atlas. @type {ShaderResourceDescriptor} */
|
|
6
|
+
export const SCREEN_PROBE_LIGHTING_PDF_READ_RESOURCE: ShaderResourceDescriptor;
|
|
7
|
+
/** @type {ShaderResourceDescriptor} */
|
|
8
|
+
export const SCREEN_PROBE_LIGHTING_PDF_WRITE_RESOURCE: ShaderResourceDescriptor;
|
|
9
|
+
/** Last frame's probe radiance after the spatial filter, `rgba16float`. @type {ShaderResourceDescriptor} */
|
|
10
|
+
export const SCREEN_PROBE_RADIANCE_HISTORY_RESOURCE: ShaderResourceDescriptor;
|
|
11
|
+
/** The G-buffer's shading normals. @type {ShaderResourceDescriptor} */
|
|
12
|
+
export const SCREEN_PROBE_NORMAL_RESOURCE: ShaderResourceDescriptor;
|
|
13
|
+
/**
|
|
14
|
+
* A probe's BRDF density (Lumen's `ScreenProbeComputeBRDFProbabilityDensityFunctionCS`): a workgroup a probe, a lane a
|
|
15
|
+
* pixel of an 8 × 8 grid over the square of 2D pixels about it, the pixels whose light interpolates from it. The centre
|
|
16
|
+
* lane takes the probe's own pixel.
|
|
17
|
+
*
|
|
18
|
+
* A pixel counts where it stands on the probe's surface: the probe's plane weight from the pixel's plane is past
|
|
19
|
+
* `SCREEN_PROBE_BRDF_PIXEL_WEIGHT` (the centre always counts). It adds its clamped cosine lobe about its shading normal
|
|
20
|
+
* as SH3 (`sh3_cosine_convolved_basis_at`, Lumen's `CalcDiffuseTransferSH3`), and the probe's density is the mean of
|
|
21
|
+
* the lobes: at a direction, how much the pixels' diffuse would weigh light from it.
|
|
22
|
+
*
|
|
23
|
+
* Lumen offsets its grid by `t/8·2D − 1` pixels, to one side of the probe; here the cells are centred on it, as the
|
|
24
|
+
* pixels that read the probe are.
|
|
25
|
+
*
|
|
26
|
+
* @type {ComputeShader}
|
|
27
|
+
*/
|
|
28
|
+
export const shader_screen_probe_brdf_pdf: ComputeShader;
|
|
29
|
+
/**
|
|
30
|
+
* A probe's lighting density (Lumen's `ScreenProbeComputeLightingProbabilityDensityFunctionCS`): a workgroup a probe,
|
|
31
|
+
* its lanes over its n² texels.
|
|
32
|
+
*
|
|
33
|
+
* - **History**: last frame's four uniform probes around the probe's surface point that stood on its surface
|
|
34
|
+
* (`screen_probe_lighting_history`), each giving its filtered radiance in the same texel, since a texel is a
|
|
35
|
+
* direction in the world. They are averaged, pre-exposed as last frame's exposure left them and brought to this
|
|
36
|
+
* frame's (`screen_probe_exposure` over `screen_probe_exposure_previous`), as Lumen rescales its history.
|
|
37
|
+
* - **The rest**: the share of the four that gave nothing, 1 − accepted / 4, is the world-space probes' radiance the
|
|
38
|
+
* probe's pick reads (`screen_probe_picks`), along the texel's direction at this frame's jitter, pre-exposed by this
|
|
39
|
+
* frame's exposure. Where nothing was picked, the history alone, or one where there is none: a density that ranks
|
|
40
|
+
* nothing.
|
|
41
|
+
* - The density is each texel's luminance over the probe's sum.
|
|
42
|
+
*
|
|
43
|
+
* @type {ComputeShader}
|
|
44
|
+
*/
|
|
45
|
+
export const shader_screen_probe_lighting_pdf: ComputeShader;
|
|
46
|
+
/**
|
|
47
|
+
* A probe's rays (Lumen's `ScreenProbeGenerateRaysCS`): a workgroup a probe, its lanes over its n² rays, each written
|
|
48
|
+
* as the texel and level it falls in (`screen_probe_ray_info_pack`), a ray's slot its place in the sorted order.
|
|
49
|
+
*
|
|
50
|
+
* 1. **Density**: each texel's BRDF density at its centre, `max(0, Σ brdf·Y(ω))`; times its lighting density · n².
|
|
51
|
+
* A texel any of whose directions the BRDF density reaches `SCREEN_PROBE_MIN_PDF` is held there
|
|
52
|
+
* (`screen_probe_brdf_keeps`), so the light ranks texels and only the pixels' lobes cull one; another falls under
|
|
53
|
+
* it unless its light lifts it.
|
|
54
|
+
* 2. **Sort**: the probe's own rays, ascending by density, ties in index order (`screen_probe_ray_sort`: the engine's
|
|
55
|
+
* bitonic network in the workgroup's memory, O(n² log² n) a probe, where Lumen ranks every ray against every other,
|
|
56
|
+
* O(n⁴)).
|
|
57
|
+
* 3. **Reassignment**: the sorted rays in threes from the lowest; a three whose highest is under the minimum gives
|
|
58
|
+
* its rays to the highest texel not yet given, from the top: that texel splits into its four children at twice the
|
|
59
|
+
* resolution, the three take three children and the texel the fourth. One level only, as Lumen's parallel path.
|
|
60
|
+
* A child holds a quarter of its parent's solid angle (the map is equal-area), which the composite weighs it by.
|
|
61
|
+
*
|
|
62
|
+
* With importance sampling off, or where the probe stands on no surface, ray i is texel i at the probe's own n.
|
|
63
|
+
*
|
|
64
|
+
* @type {ComputeShader}
|
|
65
|
+
*/
|
|
66
|
+
export const shader_screen_probe_generate_rays: ComputeShader;
|
|
67
|
+
import { ShaderResourceDescriptor } from "../../shader/resource/ShaderResourceDescriptor.js";
|
|
68
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
69
|
+
//# sourceMappingURL=shader_screen_probe_importance.d.ts.map
|
package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_screen_probe_importance.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js"],"names":[],"mappings":"AAgDA,4HAA4H;AAC5H,8CADgG,wBAAwB,CACM;AAC9H,uCAAuC;AACvC,+CADW,wBAAwB,CACkG;AAErI,8HAA8H;AAC9H,sDADkG,wBAAwB,CACiB;AAC3I,uCAAuC;AACvC,uDADW,wBAAwB,CAC0H;AAE7J,4GAA4G;AAC5G,qDADgF,wBAAwB,CACsC;AAE9I,uEAAuE;AACvE,2CAD2C,wBAAwB,CAC6B;AAchG;;;;;;;;;;;;;;GAcG;AACH,2CAFU,aAAa,CA6EpB;AAoBH;;;;;;;;;;;;;;;GAeG;AACH,+CAFU,aAAa,CAiHpB;AAYH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gDAFU,aAAa,CAiHpB;yCA7bsC,mDAAmD;8BAD9D,+BAA+B"}
|