@woosh/meep-engine 3.77.0 → 3.78.1
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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/package.json +3 -2
- package/src/engine/EngineHarness.d.ts +4 -6
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +11 -19
- package/src/engine/graphics3/GraphicsEngine.d.ts +19 -1
- package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine.js +24 -2
- package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step.js +4 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts +36 -2
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +60 -3
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +0 -1
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.js +0 -1
- package/src/shade/device/pipeline/ComputePipelineManager.d.ts +8 -0
- package/src/shade/device/pipeline/ComputePipelineManager.d.ts.map +1 -1
- package/src/shade/device/pipeline/ComputePipelineManager.js +18 -0
- package/src/shade/device/pipeline/RenderPipelineManager.d.ts +8 -0
- package/src/shade/device/pipeline/RenderPipelineManager.d.ts.map +1 -1
- package/src/shade/device/pipeline/RenderPipelineManager.js +17 -0
- package/src/shade/playground/avboit_footprint/index.html +20 -0
- package/src/shade/playground/avboit_footprint/main.d.ts +2 -0
- package/src/shade/playground/avboit_footprint/main.d.ts.map +1 -0
- package/src/shade/playground/avboit_footprint/main.js +428 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +7 -3
- package/src/shade/playground/screen_probes/main.d.ts.map +1 -1
- package/src/shade/playground/screen_probes/main.js +7 -3
- package/src/shade/renderer/Renderer.d.ts +18 -8
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +201 -16
- package/src/shade/renderer/RendererConfiguration.d.ts +95 -0
- package/src/shade/renderer/RendererConfiguration.d.ts.map +1 -0
- package/src/shade/renderer/RendererConfiguration.js +119 -0
- package/src/shade/renderer/extension/ShadowAtlas.d.ts +4 -2
- package/src/shade/renderer/extension/ShadowAtlas.d.ts.map +1 -1
- package/src/shade/renderer/extension/ShadowAtlas.js +4 -2
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +8 -0
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +34 -0
- package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.d.ts +7 -0
- package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.js +15 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +10 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +37 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +31 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +7 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +20 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +8 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +14 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts +7 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.js +13 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +9 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +11 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +71 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.js +9 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +9 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +13 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +9 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +47 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +6 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +17 -0
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts +2 -2
- package/src/shade/renderer/hair/hair_shadow_draw.js +2 -2
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts +8 -0
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +20 -1
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts +6 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts.map +1 -1
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.js +11 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +6 -0
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +15 -0
- package/src/shade/renderer/particles/graph_particles.d.ts +8 -0
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +28 -3
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts +7 -0
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles_avboit.js +14 -0
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +5 -7
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +7 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +15 -0
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts +6 -0
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +16 -2
- package/src/shade/renderer/path_tracer/accumulating/graph_float32rgba_to_float16rgba.d.ts +6 -0
- package/src/shade/renderer/path_tracer/accumulating/graph_float32rgba_to_float16rgba.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/graph_float32rgba_to_float16rgba.js +9 -0
- package/src/shade/renderer/path_tracer/accumulating/graph_flood_fill.d.ts +11 -0
- package/src/shade/renderer/path_tracer/accumulating/graph_flood_fill.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/graph_flood_fill.js +10 -0
- package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts +6 -0
- package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.js +10 -1
- package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts +7 -0
- package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.js +21 -0
- package/src/shade/renderer/postprocess/dof/raymarch/DepthOfField.d.ts +7 -0
- package/src/shade/renderer/postprocess/dof/raymarch/DepthOfField.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/DepthOfField.js +11 -1
- package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.d.ts +9 -0
- package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.js +29 -0
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +6 -0
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +13 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +6 -0
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +11 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +9 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.js +33 -18
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts +8 -0
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +42 -2
- package/src/shade/renderer/postprocess/ssr/ssr_graph_denoise_tiles.d.ts +6 -0
- package/src/shade/renderer/postprocess/ssr/ssr_graph_denoise_tiles.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_graph_denoise_tiles.js +10 -0
- package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.d.ts +6 -0
- package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.js +11 -0
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts +8 -0
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +27 -3
- package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts +7 -4
- package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.js +66 -14
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.d.ts +6 -0
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.js +10 -0
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +5 -4
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +5 -4
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_CONSTANTS.d.ts +3 -3
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_CONSTANTS.js +3 -3
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -7
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.js +5 -7
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_depth.d.ts +34 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_depth.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_depth.js +42 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.d.ts +5 -4
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.js +8 -7
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.d.ts +2 -2
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.js +4 -5
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts +9 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +18 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts +20 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js +149 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts +8 -0
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +100 -33
- package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.d.ts +9 -0
- package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.js +15 -0
- package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts +11 -0
- package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/rasterization_shader_resources.js +24 -11
- package/src/shade/renderer/restir/di/ReSTIRDI.d.ts +6 -0
- package/src/shade/renderer/restir/di/ReSTIRDI.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/ReSTIRDI.js +10 -1
- package/src/shade/renderer/restir/di/graph_restir_di.d.ts +9 -0
- package/src/shade/renderer/restir/di/graph_restir_di.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/graph_restir_di.js +19 -1
- package/src/shade/renderer/restir/di/graph_restir_di_denoise.d.ts +6 -0
- package/src/shade/renderer/restir/di/graph_restir_di_denoise.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/graph_restir_di_denoise.js +9 -0
- package/src/shade/renderer/scene/movers/graph_scene_movers.d.ts +7 -0
- package/src/shade/renderer/scene/movers/graph_scene_movers.d.ts.map +1 -1
- package/src/shade/renderer/scene/movers/graph_scene_movers.js +11 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.js +42 -0
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +10 -0
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +39 -6
- package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts +34 -0
- package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js +106 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts +16 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.js +50 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts +25 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js +42 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.d.ts +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.js +5 -5
- package/src/shade/renderer/shadow/vsm/graph_vsm_feedback.d.ts +7 -0
- package/src/shade/renderer/shadow/vsm/graph_vsm_feedback.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/graph_vsm_feedback.js +14 -0
- package/src/shade/renderer/text/shaders/shader_text_avboit.d.ts.map +1 -1
- package/src/shade/renderer/text/shaders/shader_text_avboit.js +5 -7
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts +9 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +16 -1
- package/src/shade/renderer/water/shader_water_avboit.d.ts.map +1 -1
- package/src/shade/renderer/water/shader_water_avboit.js +16 -13
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.d.ts +0 -33
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.d.ts.map +0 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.js +0 -45
|
@@ -3,11 +3,29 @@ import { TextureResourceDescriptor } from "../../../device/graph/TextureResource
|
|
|
3
3
|
import { RTXDI_PackedReservoir } from "../reservoir/RTXDI_PackedReservoir.js";
|
|
4
4
|
import { STATIC_GRAPHICS_ENGINE_ASSETS } from "../../STATIC_GRAPHICS_ENGINE_ASSETS.js";
|
|
5
5
|
import { graph_import_buffer } from "../../shader/graph/graph_import_buffer.js";
|
|
6
|
-
import { graph_restir_di_denoise } from "./graph_restir_di_denoise.js";
|
|
6
|
+
import { enquire_restir_di_denoise_pipelines, graph_restir_di_denoise } from "./graph_restir_di_denoise.js";
|
|
7
7
|
import { shader_restir_di_resample } from "./shader_restir_di_resample.js";
|
|
8
8
|
import { shader_restir_di_resolve } from "./shader_restir_di_resolve.js";
|
|
9
9
|
import { shader_restir_di_spatial } from "./shader_restir_di_spatial.js";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Offer the pipelines {@link graph_restir_di} dispatches — see {@link PipelineEnquiry}. The two arguments are the
|
|
13
|
+
* ones it takes, and say whether the denoiser's is among them.
|
|
14
|
+
*
|
|
15
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
16
|
+
* @param {boolean} denoise_enabled
|
|
17
|
+
* @param {number} denoise_iterations
|
|
18
|
+
*/
|
|
19
|
+
export function enquire_restir_di_pipelines(enquiry, denoise_enabled, denoise_iterations) {
|
|
20
|
+
enquiry.compute.push(shader_restir_di_resample.pipeline);
|
|
21
|
+
enquiry.compute.push(shader_restir_di_spatial.pipeline);
|
|
22
|
+
enquiry.compute.push(shader_restir_di_resolve.pipeline);
|
|
23
|
+
|
|
24
|
+
if (denoise_enabled && denoise_iterations > 0) {
|
|
25
|
+
enquire_restir_di_denoise_pipelines(enquiry);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
11
29
|
/**
|
|
12
30
|
* FrameGraph wiring for ReSTIR DI, three compute passes (each within the default
|
|
13
31
|
* maxStorageBuffersPerShaderStage of 10):
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offer the pipeline {@link graph_restir_di_denoise} dispatches — see {@link PipelineEnquiry}.
|
|
3
|
+
*
|
|
4
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
5
|
+
*/
|
|
6
|
+
export function enquire_restir_di_denoise_pipelines(enquiry: import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry): void;
|
|
1
7
|
/**
|
|
2
8
|
* Edge-aware à-trous denoise of the ReSTIR DI radiance: `iterations` passes with
|
|
3
9
|
* step sizes 1, 2, 4, … (AMD shadow-denoiser cadence), each a fresh transient the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_restir_di_denoise.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/restir/di/graph_restir_di_denoise.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH;IAR8B,KAAK;IACD,IAAI;IACZ,KAAK,EAApB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,MAAM,EAArB,MAAM;IACU,UAAU,GAA1B,MAAM;IACJ,MAAM,CAuDlB"}
|
|
1
|
+
{"version":3,"file":"graph_restir_di_denoise.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/restir/di/graph_restir_di_denoise.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,6DAFW,OAAO,6CAA6C,EAAE,eAAe,QAI/E;AAED;;;;;;;;;;;;;;GAcG;AACH;IAR8B,KAAK;IACD,IAAI;IACZ,KAAK,EAApB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,MAAM,EAArB,MAAM;IACU,UAAU,GAA1B,MAAM;IACJ,MAAM,CAuDlB"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { TextureResourceDescriptor } from "../../../device/graph/TextureResourceDescriptor.js";
|
|
2
2
|
import { shader_restir_di_denoise } from "./shader_restir_di_denoise.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Offer the pipeline {@link graph_restir_di_denoise} dispatches — see {@link PipelineEnquiry}.
|
|
6
|
+
*
|
|
7
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
8
|
+
*/
|
|
9
|
+
export function enquire_restir_di_denoise_pipelines(enquiry) {
|
|
10
|
+
enquiry.compute.push(shader_restir_di_denoise.pipeline);
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
14
|
* Edge-aware à-trous denoise of the ReSTIR DI radiance: `iterations` passes with
|
|
6
15
|
* step sizes 1, 2, 4, … (AMD shadow-denoiser cadence), each a fresh transient the
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* @typedef {import("../GPUSceneContext.js").GPUSceneContext} GPUSceneContext
|
|
4
4
|
* @typedef {import("./SceneMoverTracker.js").SceneMoverTracker} SceneMoverTracker
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Offer the pipelines {@link graph_scene_movers} dispatches — see {@link PipelineEnquiry}. For whoever reads the
|
|
8
|
+
* mover list: a frame with no reader culls the pass, and draws with neither.
|
|
9
|
+
*
|
|
10
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
11
|
+
*/
|
|
12
|
+
export function enquire_scene_movers_pipelines(enquiry: import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry): void;
|
|
6
13
|
/**
|
|
7
14
|
* Record the scene's mover list for a frame (`SceneMovers`, {@link SCENE_MOVERS_BYTE_SIZE} bytes):
|
|
8
15
|
* every mesh row against the box it had last frame ({@link shader_scene_movers}), and every skinned
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_scene_movers.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/scene/movers/graph_scene_movers.js"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAL+B,KAAK,EAAzB,UAAU;IACe,KAAK,EAA9B,eAAe;IACY,OAAO,EAAlC,iBAAiB;IACf,MAAM,CAmFlB;
|
|
1
|
+
{"version":3,"file":"graph_scene_movers.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/scene/movers/graph_scene_movers.js"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH;;;;;GAKG;AACH,wDAFW,OAAO,6CAA6C,EAAE,eAAe,QAK/E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAL+B,KAAK,EAAzB,UAAU;IACe,KAAK,EAA9B,eAAe;IACY,OAAO,EAAlC,iBAAiB;IACf,MAAM,CAmFlB;yBApHY,OAAO,8DAA8D,EAAE,UAAU;8BACjF,OAAO,uBAAuB,EAAE,eAAe;gCAC/C,OAAO,wBAAwB,EAAE,iBAAiB"}
|
|
@@ -11,6 +11,17 @@ import { shader_scene_skinned_movers } from "./shader_scene_skinned_movers.js";
|
|
|
11
11
|
* @typedef {import("./SceneMoverTracker.js").SceneMoverTracker} SceneMoverTracker
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Offer the pipelines {@link graph_scene_movers} dispatches — see {@link PipelineEnquiry}. For whoever reads the
|
|
16
|
+
* mover list: a frame with no reader culls the pass, and draws with neither.
|
|
17
|
+
*
|
|
18
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
19
|
+
*/
|
|
20
|
+
export function enquire_scene_movers_pipelines(enquiry) {
|
|
21
|
+
enquiry.compute.push(shader_scene_movers.pipeline);
|
|
22
|
+
enquiry.compute.push(shader_scene_skinned_movers.pipeline);
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
/**
|
|
15
26
|
* Record the scene's mover list for a frame (`SceneMovers`, {@link SCENE_MOVERS_BYTE_SIZE} bytes):
|
|
16
27
|
* every mesh row against the box it had last frame ({@link shader_scene_movers}), and every skinned
|
package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A meshlet vertex's normal alone, in the geometry's own space: the shading frame section that follows
|
|
3
|
+
* the positions, as {@link chunk_read_meshlet_vertex} reads it, without the tangent or the sections after.
|
|
4
|
+
*
|
|
5
|
+
* ```wgsl
|
|
6
|
+
* fn read_meshlet_vertex_normal(header: MeshletMetadata, vertex_id: u32) -> vec3f
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* @type {CodeChunk}
|
|
10
|
+
*/
|
|
11
|
+
export const chunk_read_meshlet_vertex_normal: CodeChunk;
|
|
12
|
+
import { CodeChunk } from "../../../compiler/CodeChunk.js";
|
|
13
|
+
//# sourceMappingURL=chunk_read_meshlet_vertex_normal.d.ts.map
|
package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_read_meshlet_vertex_normal.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,+CAFU,SAAS,CAyBjB;0BAvCwB,gCAAgC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MESHLET_METADATA_FLAGS } from "../../../../geometry/meshlet/encoding/MESHLET_METADATA_FLAGS.js";
|
|
2
|
+
import { MESHLET_METADATA_STRUCT } from "../../../../geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.js";
|
|
3
|
+
import { CodeChunk } from "../../../compiler/CodeChunk.js";
|
|
4
|
+
import { chunk_meshlet_compute_attribute_section_offset } from "./chunk_meshlet_compute_attribute_section_offset.js";
|
|
5
|
+
import { chunk_meshlet_frame_decode } from "./chunk_meshlet_frame_decode.js";
|
|
6
|
+
import { chunk_meshlet_section_sizes } from "./chunk_meshlet_section_sizes.js";
|
|
7
|
+
import { chunk_read_meshlet_attribute_u32 } from "./chunk_read_meshlet_attribute_u32.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A meshlet vertex's normal alone, in the geometry's own space: the shading frame section that follows
|
|
11
|
+
* the positions, as {@link chunk_read_meshlet_vertex} reads it, without the tangent or the sections after.
|
|
12
|
+
*
|
|
13
|
+
* ```wgsl
|
|
14
|
+
* fn read_meshlet_vertex_normal(header: MeshletMetadata, vertex_id: u32) -> vec3f
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @type {CodeChunk}
|
|
18
|
+
*/
|
|
19
|
+
export const chunk_read_meshlet_vertex_normal = CodeChunk.from(
|
|
20
|
+
//language=WGSL
|
|
21
|
+
`
|
|
22
|
+
fn read_meshlet_vertex_normal(
|
|
23
|
+
header: ${MESHLET_METADATA_STRUCT.wgsl_ref},
|
|
24
|
+
vertex_id: u32,
|
|
25
|
+
) -> vec3f {
|
|
26
|
+
let clamped_vertex_id = min(vertex_id, header.vertex_count - 1u);
|
|
27
|
+
|
|
28
|
+
// the shading frame section follows the positions
|
|
29
|
+
let frame_offset = meshlet_compute_attribute_section_offset(header) + header.vertex_count * meshlet_position_words(header.flags);
|
|
30
|
+
|
|
31
|
+
let compressed = (header.flags & ${MESHLET_METADATA_FLAGS.ATTRIBUTE_COMPRESSED_NORMAL}) != 0u;
|
|
32
|
+
|
|
33
|
+
return meshlet_frame_decode_normal(read_meshlet_attribute_u32(frame_offset + select(clamped_vertex_id, 0u, compressed)));
|
|
34
|
+
}
|
|
35
|
+
`, [
|
|
36
|
+
MESHLET_METADATA_STRUCT.declaration_chunk,
|
|
37
|
+
chunk_meshlet_compute_attribute_section_offset,
|
|
38
|
+
chunk_meshlet_section_sizes,
|
|
39
|
+
chunk_read_meshlet_attribute_u32,
|
|
40
|
+
chunk_meshlet_frame_decode,
|
|
41
|
+
]
|
|
42
|
+
);
|
|
@@ -10,6 +10,16 @@ export class GPUSceneShadowmapContext {
|
|
|
10
10
|
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
11
11
|
*/
|
|
12
12
|
static enquirePipelines(enquiry: import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry): void;
|
|
13
|
+
/**
|
|
14
|
+
* Offer the pipelines that follow from how a context is set — see {@link PipelineEnquiry}: the point lights'
|
|
15
|
+
* remap into the atlas, by which generator makes their faces, and the feedback of virtual shadow maps. Beside
|
|
16
|
+
* {@link enquirePipelines}, which offers what every setting shares.
|
|
17
|
+
*
|
|
18
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
19
|
+
* @param {boolean} use_tetrahedron_point_shadows as {@link use_tetrahedron_point_shadows} will be set
|
|
20
|
+
* @param {boolean} use_virtual_shadow_maps as {@link use_virtual_shadow_maps} will be set
|
|
21
|
+
*/
|
|
22
|
+
static enquireSettingPipelines(enquiry: import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry, use_tetrahedron_point_shadows: boolean, use_virtual_shadow_maps: boolean): void;
|
|
13
23
|
/**
|
|
14
24
|
*
|
|
15
25
|
* @param {GraphicsContext} graphics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUSceneShadowmapContext.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUSceneShadowmapContext.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js"],"names":[],"mappings":"AAsKA;;GAEG;AACH;IACI;;;;;;OAMG;IACH,iCAFW,OAAO,6CAA6C,EAAE,eAAe,QAQ/E;IAED;;;;;;;;OAQG;IACH,wCAJW,OAAO,6CAA6C,EAAE,eAAe,iCACrE,OAAO,2BACP,OAAO,QAejB;IA+aD;;;;;;;;OAQG;IACH,sBAPW,eAAe,aACf,eAAe,SAGf,kBAAkB,EAiE5B;IApfD,2BAAwG;IAExG;;;OAGG;IACH,SAFU,iBAAiB,CAEnB;IAQR;;;;;;;;OAQG;IACH,qBAFU,WAAW,CAED;IAsCpB;;;;;;;;OAQG;IACH,SAFU,OAAO,CAEF;IAEf;;;;;;;;;;OAUG;IACH,+BAFU,OAAO,CAEqB;IAEtC;;;;;;OAMG;IACH,yBAFU,OAAO,CAEe;IAehC;;;;;OAKG;IACH,mCAIC;IAjBD;;OAEG;IACH,kCAEC;IAcD;;;;;OAKG;IACH,kBAFU,MAAM,CAEK;IAiBrB;;;;OAIG;IACH,uCAMC;IAlBD;;OAEG;IACH,sCAEC;IA6BD;;;;OAIG;IACH,uCAMC;IAlBD;;OAEG;IACH,sCAEC;IA6BD;;;;OAIG;IACH,4CAKC;IAjBD;;OAEG;IACH,2CAEC;IA2BD;;;;;OAKG;IACH,wCAKC;IAlBD;;OAEG;IACH,uCAEC;IA4BD;;;;;;;;OAQG;IACH,6BAIC;IApBD;;OAEG;IACH,4BAEC;IA0CD;;;;OAIG;IACH,6BAIC;IAhBD;;OAEG;IACH,4BAEC;IA2FD;;OAEG;IACH,iCAEC;IAED;;;;;;OAMG;IACH,oCAEC;IAED;;;;;OAKG;IACH,oCAEC;IAoGD;;;;;OAKG;IACH,4BAMC;IA2MD;;;;;;;;;;;;OAYG;IACH;QAN+B,KAAK,EAAzB,UAAU;QACqD,IAAI,EAAnE,OAAO,8BAA8B,EAAE,cAAc;QACrC,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;aA+BhB;IAiMD;;;;;;;OAOG;IACH,eAFa,OAAO,gCAAgC,EAAE,eAAe,EAAE,CA6CtE;IAED;;;;OAIG;IACH,+BAEC;IASD;;;;OAIG;IACH,eAHW,KAAK,GACH,SAAS,GAAC,SAAS,CAI/B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,6BAPW,MAAM,SAEN,eAAe,eACf,MAAM,mBACN,UAAU,MAAM,CAAC,QA0G3B;IA2GD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,kBAFW,sBAAsB,QA0FhC;IA0bD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kBALa,OAAO,CAsTnB;IAED;;;;;;;;;;OAUG;IACH,iBALW,MAAM,SACN,MAAM,GACJ,KAAK,CAejB;IA2DD,gBAiBC;;CACJ;qCAh2EY,OAAO,2CAA2C,EAAE,sBAAsB;8BAC1E,OAAO,0BAA0B,EAAE,eAAe;qBAClD,OAAO,wBAAwB,EAAE,MAAM;iCACvC,OAAO,mCAAmC,EAAE,kBAAkB;oBAC9D,OAAO,4BAA4B,EAAE,KAAK;8BAC1C,OAAO,gCAAgC,EAAE,eAAe;wBACxD,OAAO,gBAAgB,EAAE,SAAS;8BAClC,OAAO,oDAAoD,EAAE,eAAe;oCAtFrD,+DAA+D;kCAuBjE,oCAAoC;4BAI1C,2BAA2B;2BA1B5B,8DAA8D;kBAFvE,wCAAwC"}
|
|
@@ -12,11 +12,15 @@ import { CullPolicy } from "../../rasterize/bucket/construct_primitive_state.js"
|
|
|
12
12
|
import { graph_mesh_sphere_cull } from "../../rasterize/compute/graph_mesh_sphere_cull.js";
|
|
13
13
|
import { execute_rasterization_jobs } from "../../rasterize/execute_rasterization_jobs.js";
|
|
14
14
|
import {
|
|
15
|
+
shadow_cascade_alpha_tested_pass_descriptor,
|
|
15
16
|
shadow_rasterization_alpha_tested_pass_descriptor
|
|
16
17
|
} from "../../rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js";
|
|
17
18
|
import {
|
|
18
19
|
shadow_rasterization_pass_descriptor
|
|
19
20
|
} from "../../rasterize/native/depth/shadow_rasterization_pass_descriptor.js";
|
|
21
|
+
import {
|
|
22
|
+
shadow_cascade_rasterization_pass_descriptor
|
|
23
|
+
} from "../../rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js";
|
|
20
24
|
import { RasterizationJob, RasterizationPipelineType } from "../../rasterize/RasterizationJob.js";
|
|
21
25
|
import { enquire_rasterize_scene_pipelines } from "../../rasterize/standard/graph_rasterize_scene.js";
|
|
22
26
|
import { graph_rasterize_scene_fast_raw } from "../../rasterize/fast/graph_rasterize_scene_fast.js";
|
|
@@ -71,7 +75,7 @@ import { DEFAULT_VSM_PAGE_BUDGET } from "../vsm/DEFAULT_VSM_PAGE_BUDGET.js";
|
|
|
71
75
|
import { DEFAULT_VSM_LOW_LOAD_FACTOR } from "../vsm/DEFAULT_VSM_LOW_LOAD_FACTOR.js";
|
|
72
76
|
import { DEFAULT_VSM_MAX_DYNAMIC_LOD_BIAS } from "../vsm/DEFAULT_VSM_MAX_DYNAMIC_LOD_BIAS.js";
|
|
73
77
|
import { DEFAULT_VSM_MAX_LOAD_FACTOR } from "../vsm/DEFAULT_VSM_MAX_LOAD_FACTOR.js";
|
|
74
|
-
import { graph_vsm_feedback } from "../vsm/graph_vsm_feedback.js";
|
|
78
|
+
import { enquire_vsm_feedback_pipelines, graph_vsm_feedback } from "../vsm/graph_vsm_feedback.js";
|
|
75
79
|
import { VirtualShadowMap } from "../vsm/VirtualShadowMap.js";
|
|
76
80
|
import { VSM_DEFAULT_REQUEST_CAPACITY } from "../vsm/VSM_FEEDBACK_LAYOUT.js";
|
|
77
81
|
import { VSM_SLOT_EMPTY } from "../vsm/VSM_SLOT_STRUCT.js";
|
|
@@ -118,9 +122,10 @@ const DEFAULT_SHADOWMAP_LOCAL_RESOLUTION = 128;
|
|
|
118
122
|
|
|
119
123
|
/**
|
|
120
124
|
* How every shadow caster is culled: as the main view culls it, so a caster's front faces are what
|
|
121
|
-
* reach the shadow map and acne is the
|
|
122
|
-
* ({@link DEPTH_STENCIL_STATE_SHADOW})
|
|
123
|
-
*
|
|
125
|
+
* reach the shadow map and acne is the caster bias's to prevent — the rasterizer's slope bias
|
|
126
|
+
* ({@link DEPTH_STENCIL_STATE_SHADOW}), or for a directional light's cascades the vertex-stage push of
|
|
127
|
+
* `shadow_cascade_rasterization_pass_descriptor`. Casting back faces on top of the rasterizer's bias
|
|
128
|
+
* pushed a caster's steep far face past the ground at its base, a gap of 1–1.5 shadow texels at every contact.
|
|
124
129
|
* @type {Readonly<Record<number, GPUCullMode>>}
|
|
125
130
|
*/
|
|
126
131
|
const SHADOW_CULL_POLICY = CullPolicy.Standard;
|
|
@@ -172,11 +177,36 @@ export class GPUSceneShadowmapContext {
|
|
|
172
177
|
*/
|
|
173
178
|
static enquirePipelines(enquiry) {
|
|
174
179
|
enquire_rasterize_scene_pipelines(enquiry, shadow_rasterization_pass_descriptor, SHADOW_CULL_POLICY);
|
|
180
|
+
enquire_rasterize_scene_pipelines(enquiry, shadow_cascade_rasterization_pass_descriptor, SHADOW_CULL_POLICY);
|
|
175
181
|
enquiry.compute.push(shader_csm_caster_range_accumulate.pipeline);
|
|
176
182
|
enquiry.compute.push(shader_csm_caster_range_publish.pipeline);
|
|
177
183
|
enquire_texture_fill_rectangle_depth_pipeline(enquiry);
|
|
178
184
|
}
|
|
179
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Offer the pipelines that follow from how a context is set — see {@link PipelineEnquiry}: the point lights'
|
|
188
|
+
* remap into the atlas, by which generator makes their faces, and the feedback of virtual shadow maps. Beside
|
|
189
|
+
* {@link enquirePipelines}, which offers what every setting shares.
|
|
190
|
+
*
|
|
191
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
192
|
+
* @param {boolean} use_tetrahedron_point_shadows as {@link use_tetrahedron_point_shadows} will be set
|
|
193
|
+
* @param {boolean} use_virtual_shadow_maps as {@link use_virtual_shadow_maps} will be set
|
|
194
|
+
*/
|
|
195
|
+
static enquireSettingPipelines(enquiry, use_tetrahedron_point_shadows, use_virtual_shadow_maps) {
|
|
196
|
+
assert.isBoolean(use_tetrahedron_point_shadows, 'use_tetrahedron_point_shadows');
|
|
197
|
+
assert.isBoolean(use_virtual_shadow_maps, 'use_virtual_shadow_maps');
|
|
198
|
+
|
|
199
|
+
enquiry.render.push(
|
|
200
|
+
use_tetrahedron_point_shadows
|
|
201
|
+
? shader_shadowmap_remap_tetrahedron_to_octahedral.pipeline
|
|
202
|
+
: shader_shadowmap_remap_cube_to_octahedral.pipeline
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
if (use_virtual_shadow_maps) {
|
|
206
|
+
enquire_vsm_feedback_pipelines(enquiry);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
180
210
|
atlas = new MaxRectanglesPacker(DEFAULT_SHADOWMAP_ATLAS_RESOLUTION, DEFAULT_SHADOWMAP_ATLAS_RESOLUTION);
|
|
181
211
|
|
|
182
212
|
/**
|
|
@@ -1613,8 +1643,11 @@ export class GPUSceneShadowmapContext {
|
|
|
1613
1643
|
view_ctx.update();
|
|
1614
1644
|
|
|
1615
1645
|
const job = new RasterizationJob();
|
|
1616
|
-
|
|
1617
|
-
|
|
1646
|
+
// a directional light's cascades are biased the way Unreal biases them, in the vertex stage of an
|
|
1647
|
+
// orthographic view; a spot light keeps the rasterizer's bias
|
|
1648
|
+
const cascade = map.light.isDirectionalLight === true;
|
|
1649
|
+
job.opaque_pass = cascade ? shadow_cascade_rasterization_pass_descriptor : shadow_rasterization_pass_descriptor;
|
|
1650
|
+
job.alpha_tested_pass = cascade ? shadow_cascade_alpha_tested_pass_descriptor : shadow_rasterization_alpha_tested_pass_descriptor;
|
|
1618
1651
|
job.cull_policy = SHADOW_CULL_POLICY;
|
|
1619
1652
|
job.render_target = this.#render_target;
|
|
1620
1653
|
job.view_ctx = view_ctx;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visibility of a point in one of a directional light's cascades: Unreal's receiver for cascaded shadow
|
|
3
|
+
* maps (UE 5.4 `ShadowProjectionPixelShader.usf`, `ShadowFilteringCommon.ush` `Manual5x5PCF`) at its
|
|
4
|
+
* defaults, the receiver half of the scheme whose caster half is {@link chunk_shadow_caster_depth_bias}.
|
|
5
|
+
*
|
|
6
|
+
* ```wgsl
|
|
7
|
+
* fn sample_shadowmap_cascade(
|
|
8
|
+
* projection_matrix: mat4x4f, // the cascade's view-projection, orthographic, reverse-Z
|
|
9
|
+
* position_ws: vec3f,
|
|
10
|
+
* surface_normal: vec3f,
|
|
11
|
+
* light: IncidentLight,
|
|
12
|
+
* atlas_aabb: vec4f, // the cascade's tile: x0, y0, width, height in texels
|
|
13
|
+
* ) -> f32
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The point is projected as it is, with no offset. Each of the 6×6 texels around it is compared softly,
|
|
17
|
+
* `saturate((receiver − texel) / transition + 1)` in reverse-Z depth: a texel nearer the light by the
|
|
18
|
+
* transition or more shadows the point fully, one level with it not at all. The transition is 2.5 texels
|
|
19
|
+
* along the light (the caster bias's constant, `ComputeTransitionSize`), widened by
|
|
20
|
+
* `1 / lerp(1 − r.Shadow.CSMReceiverBias, 1, N·L)` with `CSMReceiverBias` 0.9: tenfold where the surface
|
|
21
|
+
* meets the light edge-on. The 36 results are weighted as a 5×5 box filter at the point's sub-texel
|
|
22
|
+
* position, the edge rows and columns by the fraction that falls inside it, and the filtered value is
|
|
23
|
+
* squared, Unreal's `ApplyPCFOverBlurCorrection`.
|
|
24
|
+
*
|
|
25
|
+
* A receiver past the far plane, depth at or below 0, is shadowed only by what was drawn in front of it:
|
|
26
|
+
* against a texel nothing was drawn into, depth 0, it is level and lit.
|
|
27
|
+
*
|
|
28
|
+
* Texels are read with `textureLoad`, clamped to the tile, so the shader needs the atlas and no sampler.
|
|
29
|
+
*
|
|
30
|
+
* @type {CodeChunk}
|
|
31
|
+
*/
|
|
32
|
+
export const chunk_sample_shadowmap_cascade: CodeChunk;
|
|
33
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
34
|
+
//# sourceMappingURL=chunk_sample_shadowmap_cascade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_sample_shadowmap_cascade.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6CAFU,SAAS,CAqEjB;0BArGwB,uCAAuC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { INCIDENT_LIGHT_STRUCT } from "../../../shader/chunk/light/INCIDENT_LIGHT_STRUCT.js";
|
|
2
|
+
import { chunk_ndc_to_uv } from "../../../shader/chunk/texture/chunk_ndc_to_uv.js";
|
|
3
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
4
|
+
import { SHADOWMAP_ATLAS_RESOURCE } from "../SHADOWMAP_RESOURCES.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Visibility of a point in one of a directional light's cascades: Unreal's receiver for cascaded shadow
|
|
8
|
+
* maps (UE 5.4 `ShadowProjectionPixelShader.usf`, `ShadowFilteringCommon.ush` `Manual5x5PCF`) at its
|
|
9
|
+
* defaults, the receiver half of the scheme whose caster half is {@link chunk_shadow_caster_depth_bias}.
|
|
10
|
+
*
|
|
11
|
+
* ```wgsl
|
|
12
|
+
* fn sample_shadowmap_cascade(
|
|
13
|
+
* projection_matrix: mat4x4f, // the cascade's view-projection, orthographic, reverse-Z
|
|
14
|
+
* position_ws: vec3f,
|
|
15
|
+
* surface_normal: vec3f,
|
|
16
|
+
* light: IncidentLight,
|
|
17
|
+
* atlas_aabb: vec4f, // the cascade's tile: x0, y0, width, height in texels
|
|
18
|
+
* ) -> f32
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* The point is projected as it is, with no offset. Each of the 6×6 texels around it is compared softly,
|
|
22
|
+
* `saturate((receiver − texel) / transition + 1)` in reverse-Z depth: a texel nearer the light by the
|
|
23
|
+
* transition or more shadows the point fully, one level with it not at all. The transition is 2.5 texels
|
|
24
|
+
* along the light (the caster bias's constant, `ComputeTransitionSize`), widened by
|
|
25
|
+
* `1 / lerp(1 − r.Shadow.CSMReceiverBias, 1, N·L)` with `CSMReceiverBias` 0.9: tenfold where the surface
|
|
26
|
+
* meets the light edge-on. The 36 results are weighted as a 5×5 box filter at the point's sub-texel
|
|
27
|
+
* position, the edge rows and columns by the fraction that falls inside it, and the filtered value is
|
|
28
|
+
* squared, Unreal's `ApplyPCFOverBlurCorrection`.
|
|
29
|
+
*
|
|
30
|
+
* A receiver past the far plane, depth at or below 0, is shadowed only by what was drawn in front of it:
|
|
31
|
+
* against a texel nothing was drawn into, depth 0, it is level and lit.
|
|
32
|
+
*
|
|
33
|
+
* Texels are read with `textureLoad`, clamped to the tile, so the shader needs the atlas and no sampler.
|
|
34
|
+
*
|
|
35
|
+
* @type {CodeChunk}
|
|
36
|
+
*/
|
|
37
|
+
export const chunk_sample_shadowmap_cascade = CodeChunk.from(
|
|
38
|
+
//language=WGSL
|
|
39
|
+
`
|
|
40
|
+
fn sample_shadowmap_cascade(
|
|
41
|
+
projection_matrix: mat4x4f,
|
|
42
|
+
position_ws: vec3f,
|
|
43
|
+
surface_normal: vec3f,
|
|
44
|
+
light: ${INCIDENT_LIGHT_STRUCT.wgsl_ref},
|
|
45
|
+
atlas_aabb: vec4f,
|
|
46
|
+
) -> f32 {
|
|
47
|
+
const TRANSITION_TEXELS = 2.5;
|
|
48
|
+
const RECEIVER_BIAS = 0.9;
|
|
49
|
+
|
|
50
|
+
let row_x = vec3f(projection_matrix[0].x, projection_matrix[1].x, projection_matrix[2].x);
|
|
51
|
+
let row_y = vec3f(projection_matrix[0].y, projection_matrix[1].y, projection_matrix[2].y);
|
|
52
|
+
let row_z = vec3f(projection_matrix[0].z, projection_matrix[1].z, projection_matrix[2].z);
|
|
53
|
+
|
|
54
|
+
// NDC spans 2 across the tile
|
|
55
|
+
let texel_world_size = max(2.0 / (length(row_x) * atlas_aabb.z), 2.0 / (length(row_y) * atlas_aabb.w));
|
|
56
|
+
|
|
57
|
+
// the transition in depth units: an orthographic depth changes by |row_z| a world unit along the light
|
|
58
|
+
// never zero, as Unreal's ComputeTransitionSize keeps it, so a degenerate projection cannot make inf × 0
|
|
59
|
+
let transition = max(TRANSITION_TEXELS * texel_world_size * length(row_z), 1e-5);
|
|
60
|
+
|
|
61
|
+
let n_dot_l = saturate(dot(surface_normal, light.direction));
|
|
62
|
+
let transition_scale = mix(1.0 - RECEIVER_BIAS, 1.0, n_dot_l) / transition;
|
|
63
|
+
|
|
64
|
+
let clip = projection_matrix * vec4(position_ws, 1.0);
|
|
65
|
+
let ndc = clip.xyz / clip.w;
|
|
66
|
+
|
|
67
|
+
// past the far plane, held level with a texel nothing was drawn into
|
|
68
|
+
let depth = max(ndc.z, 0.0);
|
|
69
|
+
|
|
70
|
+
// texel centres at whole numbers
|
|
71
|
+
let texel_position = ndc_to_uv(ndc.xy) * atlas_aabb.zw - 0.5;
|
|
72
|
+
let base = floor(texel_position);
|
|
73
|
+
let fraction = texel_position - base;
|
|
74
|
+
|
|
75
|
+
let first = vec2i(base) - vec2i(2);
|
|
76
|
+
let tile_min = vec2i(atlas_aabb.xy);
|
|
77
|
+
let tile_last = vec2i(atlas_aabb.zw) - vec2i(1);
|
|
78
|
+
|
|
79
|
+
var sum = 0.0;
|
|
80
|
+
|
|
81
|
+
for (var j = 0; j < 6; j++) {
|
|
82
|
+
let weight_y = select(select(1.0, fraction.y, j == 5), 1.0 - fraction.y, j == 0);
|
|
83
|
+
|
|
84
|
+
for (var i = 0; i < 6; i++) {
|
|
85
|
+
let weight_x = select(select(1.0, fraction.x, i == 5), 1.0 - fraction.x, i == 0);
|
|
86
|
+
|
|
87
|
+
let texel = clamp(first + vec2i(i, j), vec2i(0), tile_last) + tile_min;
|
|
88
|
+
let texel_depth = textureLoad(shadowmapAtlas, texel, 0);
|
|
89
|
+
|
|
90
|
+
// reverse-Z: a texel nearer the light than the receiver has the larger depth
|
|
91
|
+
sum += weight_x * weight_y * saturate((depth - texel_depth) * transition_scale + 1.0);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let filtered = sum * (1.0 / 25.0);
|
|
96
|
+
|
|
97
|
+
// Unreal's ApplyPCFOverBlurCorrection
|
|
98
|
+
return filtered * filtered;
|
|
99
|
+
}
|
|
100
|
+
`, [
|
|
101
|
+
INCIDENT_LIGHT_STRUCT.declaration_chunk,
|
|
102
|
+
chunk_ndc_to_uv,
|
|
103
|
+
]
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
chunk_sample_shadowmap_cascade.requireResource(SHADOWMAP_ATLAS_RESOURCE);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A cascade caster's vertex in clip space, pushed away from the light by {@link chunk_shadow_caster_depth_bias}.
|
|
3
|
+
*
|
|
4
|
+
* ```wgsl
|
|
5
|
+
* fn shadow_cascade_caster_position(node_global: mat4x4f, position_os: vec3f, normal_os: vec3f) -> vec4f
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Reads `camera.view_projection_matrix` and the `view`'s `width` and `height`, the cascade's tile. The view is
|
|
9
|
+
* orthographic and reverse-Z, so the light's direction is the matrix's third row and a texel's world size is
|
|
10
|
+
* the tile's NDC span, 2, over its width in texels.
|
|
11
|
+
*
|
|
12
|
+
* @type {CodeChunk}
|
|
13
|
+
*/
|
|
14
|
+
export const chunk_shadow_cascade_caster_position: CodeChunk;
|
|
15
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
16
|
+
//# sourceMappingURL=chunk_shadow_cascade_caster_position.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_shadow_cascade_caster_position.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;GAYG;AACH,mDAFU,SAAS,CAgCjB;0BA9CwB,uCAAuC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
chunk_compute_normal_matrix_from_m4
|
|
3
|
+
} from "../../../shader/chunk/geometry/mat4/chunk_compute_normal_matrix_from_m4.js";
|
|
4
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
5
|
+
import { chunk_shadow_caster_depth_bias } from "./chunk_shadow_caster_depth_bias.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A cascade caster's vertex in clip space, pushed away from the light by {@link chunk_shadow_caster_depth_bias}.
|
|
9
|
+
*
|
|
10
|
+
* ```wgsl
|
|
11
|
+
* fn shadow_cascade_caster_position(node_global: mat4x4f, position_os: vec3f, normal_os: vec3f) -> vec4f
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Reads `camera.view_projection_matrix` and the `view`'s `width` and `height`, the cascade's tile. The view is
|
|
15
|
+
* orthographic and reverse-Z, so the light's direction is the matrix's third row and a texel's world size is
|
|
16
|
+
* the tile's NDC span, 2, over its width in texels.
|
|
17
|
+
*
|
|
18
|
+
* @type {CodeChunk}
|
|
19
|
+
*/
|
|
20
|
+
export const chunk_shadow_cascade_caster_position = CodeChunk.from(
|
|
21
|
+
//language=WGSL
|
|
22
|
+
`
|
|
23
|
+
fn shadow_cascade_caster_position(node_global: mat4x4f, position_os: vec3f, normal_os: vec3f) -> vec4f {
|
|
24
|
+
let vp = camera.view_projection_matrix;
|
|
25
|
+
|
|
26
|
+
let row_x = vec3f(vp[0].x, vp[1].x, vp[2].x);
|
|
27
|
+
let row_y = vec3f(vp[0].y, vp[1].y, vp[2].y);
|
|
28
|
+
let light_direction = normalize(vec3f(vp[0].z, vp[1].z, vp[2].z));
|
|
29
|
+
|
|
30
|
+
let texel_world_size = max(
|
|
31
|
+
2.0 / (length(row_x) * f32(view.width)),
|
|
32
|
+
2.0 / (length(row_y) * f32(view.height))
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// a node scaled to nothing on an axis has no normal matrix: push it by the constant alone, as a normal along the
|
|
36
|
+
// light would be, rather than lose the vertex to a NaN
|
|
37
|
+
let transformed = compute_normal_matrix_from_m4(node_global) * normal_os;
|
|
38
|
+
let normal_ws = select(light_direction, normalize(transformed), dot(transformed, transformed) > 0.0);
|
|
39
|
+
let position_ws = (node_global * vec4(position_os, 1.0)).xyz;
|
|
40
|
+
|
|
41
|
+
// straight away from the light, which in an orthographic view moves only the depth
|
|
42
|
+
let pushed = position_ws - light_direction * shadow_caster_depth_bias(normal_ws, light_direction, texel_world_size);
|
|
43
|
+
|
|
44
|
+
return vp * vec4(pushed, 1.0);
|
|
45
|
+
}
|
|
46
|
+
`, [
|
|
47
|
+
chunk_shadow_caster_depth_bias,
|
|
48
|
+
chunk_compute_normal_matrix_from_m4,
|
|
49
|
+
]
|
|
50
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How far a cascade's caster vertex is pushed away from the light, in world units: Unreal's cascaded
|
|
3
|
+
* shadow map caster bias (UE 5.4 `ShadowDepthVertexShader.usf`, `FProjectedShadowInfo::UpdateShaderDepthBias`)
|
|
4
|
+
* at its defaults, in texels of the cascade.
|
|
5
|
+
*
|
|
6
|
+
* ```wgsl
|
|
7
|
+
* fn shadow_caster_depth_bias(normal_ws: vec3f, light_direction_ws: vec3f, texel_world_size: f32) -> f32
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* `2.5 texels × (1 + 1.5 × min(tan θ, 1))`, θ the angle between the vertex normal and the light, either
|
|
11
|
+
* facing. The constant is `r.Shadow.CSMDepthBias` (10) times the light's `ShadowBias` (0.5) times the
|
|
12
|
+
* cascade's `WorldSpaceTexelScale`, half a texel, at `ShadowCascadeBiasDistribution` 1. The slope term is
|
|
13
|
+
* that times `r.Shadow.CSMSlopeScaleDepthBias` (3) times the light's `ShadowSlopeBias` (0.5), with the
|
|
14
|
+
* slope clamped at `r.Shadow.ShadowMaxSlopeScaleDepthBias` (1, 45°).
|
|
15
|
+
*
|
|
16
|
+
* It is the caster half of one scheme: the rasterizer adds no bias of its own, and the receiver
|
|
17
|
+
* ({@link chunk_sample_shadowmap_cascade}) takes no offset and compares softly instead.
|
|
18
|
+
*
|
|
19
|
+
* `light_direction_ws` is unit length.
|
|
20
|
+
*
|
|
21
|
+
* @type {CodeChunk}
|
|
22
|
+
*/
|
|
23
|
+
export const chunk_shadow_caster_depth_bias: CodeChunk;
|
|
24
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
25
|
+
//# sourceMappingURL=chunk_shadow_caster_depth_bias.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_shadow_caster_depth_bias.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,6CAFU,SAAS,CAmBhB;0BAzCuB,uCAAuC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How far a cascade's caster vertex is pushed away from the light, in world units: Unreal's cascaded
|
|
5
|
+
* shadow map caster bias (UE 5.4 `ShadowDepthVertexShader.usf`, `FProjectedShadowInfo::UpdateShaderDepthBias`)
|
|
6
|
+
* at its defaults, in texels of the cascade.
|
|
7
|
+
*
|
|
8
|
+
* ```wgsl
|
|
9
|
+
* fn shadow_caster_depth_bias(normal_ws: vec3f, light_direction_ws: vec3f, texel_world_size: f32) -> f32
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* `2.5 texels × (1 + 1.5 × min(tan θ, 1))`, θ the angle between the vertex normal and the light, either
|
|
13
|
+
* facing. The constant is `r.Shadow.CSMDepthBias` (10) times the light's `ShadowBias` (0.5) times the
|
|
14
|
+
* cascade's `WorldSpaceTexelScale`, half a texel, at `ShadowCascadeBiasDistribution` 1. The slope term is
|
|
15
|
+
* that times `r.Shadow.CSMSlopeScaleDepthBias` (3) times the light's `ShadowSlopeBias` (0.5), with the
|
|
16
|
+
* slope clamped at `r.Shadow.ShadowMaxSlopeScaleDepthBias` (1, 45°).
|
|
17
|
+
*
|
|
18
|
+
* It is the caster half of one scheme: the rasterizer adds no bias of its own, and the receiver
|
|
19
|
+
* ({@link chunk_sample_shadowmap_cascade}) takes no offset and compares softly instead.
|
|
20
|
+
*
|
|
21
|
+
* `light_direction_ws` is unit length.
|
|
22
|
+
*
|
|
23
|
+
* @type {CodeChunk}
|
|
24
|
+
*/
|
|
25
|
+
export const chunk_shadow_caster_depth_bias = CodeChunk.from(
|
|
26
|
+
//language=WGSL
|
|
27
|
+
`
|
|
28
|
+
fn shadow_caster_depth_bias(normal_ws: vec3f, light_direction_ws: vec3f, texel_world_size: f32) -> f32 {
|
|
29
|
+
const CONSTANT_TEXELS = 2.5;
|
|
30
|
+
const SLOPE_SCALE = 1.5;
|
|
31
|
+
const MAX_SLOPE = 1.0;
|
|
32
|
+
|
|
33
|
+
// cos(atan(MAX_SLOPE)): below it the slope is clamped anyway
|
|
34
|
+
const MIN_COS = 0.7071067812;
|
|
35
|
+
|
|
36
|
+
let cos_angle = max(abs(dot(normal_ws, light_direction_ws)), MIN_COS);
|
|
37
|
+
// saturate: the dot of two unit vectors can round past 1
|
|
38
|
+
let slope = min(sqrt(saturate(1.0 - cos_angle * cos_angle)) / cos_angle, MAX_SLOPE);
|
|
39
|
+
|
|
40
|
+
return CONSTANT_TEXELS * texel_world_size * (1.0 + SLOPE_SCALE * slope);
|
|
41
|
+
}
|
|
42
|
+
`);
|
package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `shadowmap_sample_directional` under {@link ShadowDirectionalTechnique.Cascades}. The light's
|
|
3
3
|
* `shadow_directional` record names its cascades as a range of `shadow_cascade` rows (atlas +
|
|
4
4
|
* view-projection each), with CSM cascade blending: {@link shadowmap_csm_compute_cascade_blended} picks
|
|
5
|
-
* among them, and the one or two it picks are read again here to sample.
|
|
5
|
+
* among them, and the one or two it picks are read again here to sample, by {@link chunk_sample_shadowmap_cascade}.
|
|
6
6
|
*
|
|
7
7
|
* A light whose record names no cascades — a frame where the renderer has just switched to virtual
|
|
8
8
|
* maps and not yet rebuilt them — finds no cascade and is lit.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
|
|
2
2
|
import { INCIDENT_LIGHT_STRUCT } from "../../../shader/chunk/light/INCIDENT_LIGHT_STRUCT.js";
|
|
3
3
|
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
4
|
-
import {
|
|
4
|
+
import { chunk_sample_shadowmap_cascade } from "./chunk_sample_shadowmap_cascade.js";
|
|
5
5
|
import { chunk_shadowmap_csm_compute_cascade_blended } from "./chunk_shadowmap_csm_compute_cascade_blended.js";
|
|
6
6
|
|
|
7
7
|
const SHADOW_DIRECTIONAL_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_directional');
|
|
@@ -11,7 +11,7 @@ const CASCADE_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_cascade');
|
|
|
11
11
|
* `shadowmap_sample_directional` under {@link ShadowDirectionalTechnique.Cascades}. The light's
|
|
12
12
|
* `shadow_directional` record names its cascades as a range of `shadow_cascade` rows (atlas +
|
|
13
13
|
* view-projection each), with CSM cascade blending: {@link shadowmap_csm_compute_cascade_blended} picks
|
|
14
|
-
* among them, and the one or two it picks are read again here to sample.
|
|
14
|
+
* among them, and the one or two it picks are read again here to sample, by {@link chunk_sample_shadowmap_cascade}.
|
|
15
15
|
*
|
|
16
16
|
* A light whose record names no cascades — a frame where the renderer has just switched to virtual
|
|
17
17
|
* maps and not yet rebuilt them — finds no cascade and is lit.
|
|
@@ -44,7 +44,7 @@ fn shadowmap_sample_directional(
|
|
|
44
44
|
return 1.0;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// Runtime-opaque upper bound keeps DXC from duplicating
|
|
47
|
+
// Runtime-opaque upper bound keeps DXC from duplicating sample_shadowmap_cascade twice per directional light.
|
|
48
48
|
let two = select(2u, shadowmap.cascade_count, shadowmap.cascade_count == 0x7fffffffu);
|
|
49
49
|
let sample_count = select(1u, two, cascade_info.blend > 0.0);
|
|
50
50
|
|
|
@@ -55,7 +55,7 @@ fn shadowmap_sample_directional(
|
|
|
55
55
|
let idx = select(cascade_info.index_0, cascade_info.index_1, c > 0u);
|
|
56
56
|
let cascade_meta = ${CASCADE_DESCRIPTOR.marshalling_method_read}(database, idx);
|
|
57
57
|
|
|
58
|
-
let v =
|
|
58
|
+
let v = sample_shadowmap_cascade(
|
|
59
59
|
cascade_meta.projection,
|
|
60
60
|
position_ws,
|
|
61
61
|
surface_normal_ws,
|
|
@@ -79,7 +79,7 @@ fn shadowmap_sample_directional(
|
|
|
79
79
|
`, [
|
|
80
80
|
SHADOW_DIRECTIONAL_DESCRIPTOR.chunk_read,
|
|
81
81
|
CASCADE_DESCRIPTOR.chunk_read,
|
|
82
|
-
|
|
82
|
+
chunk_sample_shadowmap_cascade,
|
|
83
83
|
chunk_shadowmap_csm_compute_cascade_blended,
|
|
84
84
|
]
|
|
85
85
|
);
|