@woosh/meep-engine 3.76.0 → 3.78.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/editor/particles/effect/ParticleReferenceSimulation.d.ts +11 -0
- package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
- package/editor/particles/effect/ParticleReferenceSimulation.js +14 -0
- package/editor/view/particles/effect/ParticleGraphEditorView.js +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/asset/loaders/GroomAssetLoader.d.ts +1 -1
- package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/GroomAssetLoader.js +16 -2
- package/src/engine/graphics/ecs/hair/Hair.d.ts +7 -0
- package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -1
- package/src/engine/graphics/ecs/hair/Hair.js +9 -0
- package/src/engine/graphics/ecs/hair/HairDynamics.d.ts +63 -0
- package/src/engine/graphics/ecs/hair/HairDynamics.d.ts.map +1 -0
- package/src/engine/graphics/ecs/hair/HairDynamics.js +82 -0
- package/src/engine/graphics/hair/Groom.d.ts +45 -0
- package/src/engine/graphics/hair/Groom.d.ts.map +1 -1
- package/src/engine/graphics/hair/Groom.js +56 -0
- package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +27 -1
- package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/hair/GroomSerializationAdapter.js +105 -32
- package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts +8 -0
- package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.js +31 -0
- package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +85 -0
- package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_bind_to_mesh.js +216 -0
- package/src/engine/graphics/hair/groom_build_group.d.ts +7 -2
- package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -1
- package/src/engine/graphics/hair/groom_build_group.js +11 -2
- package/src/engine/graphics/hair/groom_build_guides.d.ts +43 -0
- package/src/engine/graphics/hair/groom_build_guides.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_build_guides.js +267 -0
- package/src/engine/graphics/hair/groom_root_spacing.d.ts +6 -4
- package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -1
- package/src/engine/graphics/hair/groom_root_spacing.js +199 -66
- package/src/engine/graphics3/HairColliderSystem.d.ts +59 -0
- package/src/engine/graphics3/HairColliderSystem.d.ts.map +1 -0
- package/src/engine/graphics3/HairColliderSystem.js +270 -0
- package/src/engine/graphics3/HairSystem.d.ts +21 -4
- package/src/engine/graphics3/HairSystem.d.ts.map +1 -1
- package/src/engine/graphics3/HairSystem.js +270 -4
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- 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/assets/textures/hair_scattering.bin +0 -0
- package/src/shade/playground/hair/main.js +27 -4
- package/src/shade/playground/hair_skinned/index.html +192 -0
- package/src/shade/playground/hair_skinned/main.d.ts +7 -0
- package/src/shade/playground/hair_skinned/main.d.ts.map +1 -0
- package/src/shade/playground/hair_skinned/main.js +481 -0
- package/src/shade/playground/hair_skinned/skinned_hair.d.ts +49 -0
- package/src/shade/playground/hair_skinned/skinned_hair.d.ts.map +1 -0
- package/src/shade/playground/hair_skinned/skinned_hair.js +362 -0
- package/src/shade/playground/sparks/README.md +36 -0
- package/src/shade/playground/sparks/index.html +145 -0
- package/src/shade/playground/sparks/main.d.ts +7 -0
- package/src/shade/playground/sparks/main.d.ts.map +1 -0
- package/src/shade/playground/sparks/main.js +312 -0
- package/src/shade/playground/sparks/sparks_effect.d.ts +72 -0
- package/src/shade/playground/sparks/sparks_effect.d.ts.map +1 -0
- package/src/shade/playground/sparks/sparks_effect.js +180 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +18 -3
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts +3 -2
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.js +74 -3
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +13 -3
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +16 -5
- package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +8 -8
- package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +2 -2
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +4 -2
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +7 -3
- package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +1 -1
- package/src/shade/renderer/extension/ShadowAtlas.d.ts +77 -0
- package/src/shade/renderer/extension/ShadowAtlas.d.ts.map +1 -0
- package/src/shade/renderer/extension/ShadowAtlas.js +135 -0
- 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 +7 -7
- 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_clipmap/GPUProbeClipmapGI.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +37 -7
- 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 +132 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +6 -2
- package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts +0 -18
- package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/sharc/sharc_constants.js +1 -21
- package/src/shade/renderer/hair/GPUHairSystem.d.ts +121 -2
- package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
- package/src/shade/renderer/hair/GPUHairSystem.js +1187 -56
- package/src/shade/renderer/hair/HAIR.d.ts +22 -3
- package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
- package/src/shade/renderer/hair/HAIR.js +25 -4
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -1
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +33 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +4 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -1
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +24 -2
- package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +139 -0
- package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -0
- package/src/shade/renderer/hair/HAIR_SIMULATION.js +160 -0
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +9 -2
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -1
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +40 -13
- package/src/shade/renderer/hair/chunk_hair_guide.d.ts +59 -0
- package/src/shade/renderer/hair/chunk_hair_guide.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_guide.js +179 -0
- package/src/shade/renderer/hair/chunk_hair_volume.d.ts +4 -3
- package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -1
- package/src/shade/renderer/hair/chunk_hair_volume.js +21 -12
- package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -1
- package/src/shade/renderer/hair/hair_lighting.js +16 -7
- package/src/shade/renderer/hair/hair_scattering_lut.js +13 -13
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts +32 -0
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_shadow_draw.js +123 -0
- package/src/shade/renderer/hair/shader_hair_classes.d.ts +2 -1
- package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_classes.js +6 -2
- package/src/shade/renderer/hair/shader_hair_cull.d.ts +8 -2
- package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_cull.js +74 -17
- package/src/shade/renderer/hair/shader_hair_lod.d.ts +9 -3
- package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_lod.js +125 -31
- package/src/shade/renderer/hair/shader_hair_roots.d.ts +36 -0
- package/src/shade/renderer/hair/shader_hair_roots.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_roots.js +261 -0
- package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +44 -0
- package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_shadow_list.js +240 -0
- package/src/shade/renderer/hair/shader_hair_simulate.d.ts +55 -0
- package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_simulate.js +563 -0
- package/src/shade/renderer/hair/shader_hair_volume.d.ts +3 -3
- package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_volume.js +4 -17
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +8 -3
- package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -1
- package/src/shade/renderer/loader/usd/usd_groom_extension.js +58 -5
- 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 +28 -0
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +22 -0
- package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.js +4 -0
- package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts +32 -0
- package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts.map +1 -0
- package/src/shade/renderer/particles/graph/groups/particle_groups_scene.js +80 -0
- package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_node_parameters.js +1 -0
- package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_node_presentation.js +12 -0
- package/src/shade/renderer/particles/graph_particles.d.ts +5 -1
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +18 -3
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts +25 -0
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/InstructionStream.js +25 -0
- package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +9 -0
- package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/ParticleVMISA.js +20 -0
- package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts +9 -0
- package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts.map +1 -0
- package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.js +29 -0
- package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts +2 -1
- package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +27 -5
- package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +1 -1
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +5 -0
- package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +7 -0
- package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/EmitterRegistry.js +10 -0
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +5 -0
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/ParticleEmitter.js +5 -0
- package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts +8 -0
- package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/ProgramHeap.js +25 -0
- package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit.js +9 -3
- package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +4 -2
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts +2 -2
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +10 -4
- package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +4 -2
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +14 -1
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
- package/src/shade/renderer/particles/vm/ParticleVMReference.js +34 -1
- package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
- package/src/shade/renderer/particles/vm/chunk_particle_vm.js +10 -0
- package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts +39 -0
- package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts.map +1 -0
- package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.js +90 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +4 -1
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +14 -2
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +1 -1
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +9 -3
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +4 -2
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -4
- 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 +26 -16
- 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/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/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/scene/GPUSceneContext.d.ts +7 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +18 -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/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts +20 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.js +134 -0
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +15 -0
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +83 -5
- 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_directional_atlas_casters.d.ts +10 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.js +22 -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/water/query/GPUWaterQueries.d.ts +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
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
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shape_record_signed_distance_gradient(kind, parameters, p) -> vec4<f32>`: the unit outward gradient of a core
|
|
3
|
+
* shape record's signed distance at a point, in `xyz`, and the distance, in `w`, in the record's own local frame.
|
|
4
|
+
*
|
|
5
|
+
* The WGSL twin of `shape_record_signed_distance_gradient_array` (`core/geom/3d/shape/record/`), branch for branch:
|
|
6
|
+
* each analytic kind's `sdf3_*_gradient_array`, with the same degenerate normal where the gradient is undefined (a
|
|
7
|
+
* point on a sphere's centre or a capsule's axis segment), and a hull's gradient as the normal of the plane its
|
|
8
|
+
* distance is the maximum over.
|
|
9
|
+
*
|
|
10
|
+
* ## Seam
|
|
11
|
+
*
|
|
12
|
+
* As `chunk_shape_record_signed_distance`'s: a hull's planes come from `fn shape_record_plane(index: u32) ->
|
|
13
|
+
* vec4<f32>`, which the enclosing shader defines, `(n, offset)` a plane, at most `SHAPE_RECORD_HULL_PLANE_LIMIT`
|
|
14
|
+
* (${SHAPE_RECORD_HULL_PLANE_LIMIT}) of them from `parameters.x`.
|
|
15
|
+
*
|
|
16
|
+
* @type {CodeChunk}
|
|
17
|
+
*/
|
|
18
|
+
export const chunk_shape_record_signed_distance_gradient: CodeChunk;
|
|
19
|
+
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
20
|
+
//# sourceMappingURL=chunk_shape_record_signed_distance_gradient.d.ts.map
|
package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_shape_record_signed_distance_gradient.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;GAgBG;AACH,0DAFU,SAAS,CA4GW;0BA9HJ,6BAA6B"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { SHAPE_RECORD_HULL_PLANE_LIMIT } from "../../../../../core/geom/3d/shape/record/ShapeRecord.js";
|
|
2
|
+
import {
|
|
3
|
+
SDF3_DEGENERATE_NORMAL_X,
|
|
4
|
+
SDF3_DEGENERATE_NORMAL_Y,
|
|
5
|
+
SDF3_DEGENERATE_NORMAL_Z,
|
|
6
|
+
SDF3_EPSILON
|
|
7
|
+
} from "../../../../../core/geom/3d/shape/sdf/sdf3_degenerate_normal.js";
|
|
8
|
+
import { CodeChunk } from "../../compiler/CodeChunk.js";
|
|
9
|
+
import { chunk_shape_record_kind } from "./chunk_shape_record_kind.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `shape_record_signed_distance_gradient(kind, parameters, p) -> vec4<f32>`: the unit outward gradient of a core
|
|
13
|
+
* shape record's signed distance at a point, in `xyz`, and the distance, in `w`, in the record's own local frame.
|
|
14
|
+
*
|
|
15
|
+
* The WGSL twin of `shape_record_signed_distance_gradient_array` (`core/geom/3d/shape/record/`), branch for branch:
|
|
16
|
+
* each analytic kind's `sdf3_*_gradient_array`, with the same degenerate normal where the gradient is undefined (a
|
|
17
|
+
* point on a sphere's centre or a capsule's axis segment), and a hull's gradient as the normal of the plane its
|
|
18
|
+
* distance is the maximum over.
|
|
19
|
+
*
|
|
20
|
+
* ## Seam
|
|
21
|
+
*
|
|
22
|
+
* As `chunk_shape_record_signed_distance`'s: a hull's planes come from `fn shape_record_plane(index: u32) ->
|
|
23
|
+
* vec4<f32>`, which the enclosing shader defines, `(n, offset)` a plane, at most `SHAPE_RECORD_HULL_PLANE_LIMIT`
|
|
24
|
+
* (${SHAPE_RECORD_HULL_PLANE_LIMIT}) of them from `parameters.x`.
|
|
25
|
+
*
|
|
26
|
+
* @type {CodeChunk}
|
|
27
|
+
*/
|
|
28
|
+
export const chunk_shape_record_signed_distance_gradient = CodeChunk.from(
|
|
29
|
+
//language=WGSL
|
|
30
|
+
`
|
|
31
|
+
fn shape_record_signed_distance_gradient(kind: u32, parameters: vec4<f32>, p: vec3<f32>) -> vec4<f32> {
|
|
32
|
+
let degenerate = vec3<f32>(${SDF3_DEGENERATE_NORMAL_X}.0, ${SDF3_DEGENERATE_NORMAL_Y}.0, ${SDF3_DEGENERATE_NORMAL_Z}.0);
|
|
33
|
+
let epsilon = ${SDF3_EPSILON};
|
|
34
|
+
|
|
35
|
+
if (kind == SHAPE_RECORD_SPHERE) {
|
|
36
|
+
let length_ = length(p);
|
|
37
|
+
|
|
38
|
+
if (length_ < epsilon) {
|
|
39
|
+
return vec4<f32>(degenerate, -parameters.x);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return vec4<f32>(p / length_, length_ - parameters.x);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (kind == SHAPE_RECORD_CAPSULE) {
|
|
46
|
+
let half = parameters.y * 0.5;
|
|
47
|
+
let dy = select(select(0.0, p.y - half, p.y > half), p.y + half, p.y < -half);
|
|
48
|
+
let q = vec3<f32>(p.x, dy, p.z);
|
|
49
|
+
let length_ = length(q);
|
|
50
|
+
|
|
51
|
+
if (length_ < epsilon) {
|
|
52
|
+
return vec4<f32>(degenerate, -parameters.x);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return vec4<f32>(q / length_, length_ - parameters.x);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (kind == SHAPE_RECORD_BOX) {
|
|
59
|
+
let q = abs(p) - parameters.xyz;
|
|
60
|
+
let e = max(q, vec3<f32>(0.0));
|
|
61
|
+
let outside = length(e);
|
|
62
|
+
let sign_ = select(vec3<f32>(1.0), vec3<f32>(-1.0), p < vec3<f32>(0.0));
|
|
63
|
+
|
|
64
|
+
if (outside > epsilon) {
|
|
65
|
+
return vec4<f32>(sign_ * e / outside, outside);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (q.x >= q.y && q.x >= q.z) {
|
|
69
|
+
return vec4<f32>(sign_.x, 0.0, 0.0, q.x);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (q.y >= q.z) {
|
|
73
|
+
return vec4<f32>(0.0, sign_.y, 0.0, q.y);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return vec4<f32>(0.0, 0.0, sign_.z, q.z);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (kind == SHAPE_RECORD_CYLINDER) {
|
|
80
|
+
let s = length(p.xz);
|
|
81
|
+
let radial = s - parameters.x;
|
|
82
|
+
let axial = abs(p.y) - parameters.y * 0.5;
|
|
83
|
+
|
|
84
|
+
var u = vec2<f32>(1.0, 0.0);
|
|
85
|
+
|
|
86
|
+
if (s >= epsilon) {
|
|
87
|
+
u = p.xz / s;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let axis_sign = select(1.0, -1.0, p.y < 0.0);
|
|
91
|
+
let ext_r = max(radial, 0.0);
|
|
92
|
+
let ext_a = max(axial, 0.0);
|
|
93
|
+
let outside = sqrt(ext_r * ext_r + ext_a * ext_a);
|
|
94
|
+
|
|
95
|
+
if (outside > epsilon) {
|
|
96
|
+
let wr = ext_r / outside;
|
|
97
|
+
let wa = ext_a / outside;
|
|
98
|
+
|
|
99
|
+
return vec4<f32>(u.x * wr, axis_sign * wa, u.y * wr, outside);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (radial >= axial) {
|
|
103
|
+
return vec4<f32>(u.x, 0.0, u.y, radial);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return vec4<f32>(0.0, axis_sign, 0.0, axial);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (kind == SHAPE_RECORD_PLANE) {
|
|
110
|
+
return vec4<f32>(parameters.xyz, dot(p, parameters.xyz) - parameters.w);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// SHAPE_RECORD_CONVEX_HULL: the plane the distance is the maximum over
|
|
114
|
+
let first = u32(parameters.x);
|
|
115
|
+
let count = min(u32(parameters.y), ${SHAPE_RECORD_HULL_PLANE_LIMIT}u);
|
|
116
|
+
|
|
117
|
+
var best = vec4<f32>(0.0, 0.0, 0.0, -3.402823466e+38);
|
|
118
|
+
|
|
119
|
+
for (var i = 0u; i < ${SHAPE_RECORD_HULL_PLANE_LIMIT}u; i++) {
|
|
120
|
+
if (i >= count) {
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
let plane = shape_record_plane(first + i);
|
|
125
|
+
let distance = dot(p, plane.xyz) - plane.w;
|
|
126
|
+
|
|
127
|
+
if (distance > best.w) {
|
|
128
|
+
best = vec4<f32>(plane.xyz, distance);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return best;
|
|
133
|
+
}
|
|
134
|
+
`, [chunk_shape_record_kind]);
|
|
@@ -194,6 +194,21 @@ export class GPUSceneShadowmapContext {
|
|
|
194
194
|
depth: number;
|
|
195
195
|
movers: number;
|
|
196
196
|
}): void;
|
|
197
|
+
/**
|
|
198
|
+
* The views {@link draw} rasterized straight into the atlas this frame — every cascade of a directional map and
|
|
199
|
+
* a spot map's one, not a virtual map's pages nor a point map's faces — each with its camera and its rectangle.
|
|
200
|
+
* The first {@link drawn_view_count} entries are this frame's; the array is kept and refilled each call. A
|
|
201
|
+
* `ShadowAtlasViewSource`.
|
|
202
|
+
*
|
|
203
|
+
* @returns {import("../../extension/ShadowAtlas.js").ShadowAtlasView[]}
|
|
204
|
+
*/
|
|
205
|
+
drawn_views(): import("../../extension/ShadowAtlas.js").ShadowAtlasView[];
|
|
206
|
+
/**
|
|
207
|
+
* How many of {@link drawn_views}'s entries are this frame's, as its last call found.
|
|
208
|
+
*
|
|
209
|
+
* @returns {number}
|
|
210
|
+
*/
|
|
211
|
+
get drawn_view_count(): number;
|
|
197
212
|
/**
|
|
198
213
|
*
|
|
199
214
|
* @param {Light} light
|
|
@@ -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;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;qCAx0EY,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";
|
|
@@ -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,6 +177,7 @@ 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);
|
|
@@ -1128,6 +1134,75 @@ export class GPUSceneShadowmapContext {
|
|
|
1128
1134
|
}
|
|
1129
1135
|
}
|
|
1130
1136
|
|
|
1137
|
+
/**
|
|
1138
|
+
* The views {@link draw} rasterized straight into the atlas this frame — every cascade of a directional map and
|
|
1139
|
+
* a spot map's one, not a virtual map's pages nor a point map's faces — each with its camera and its rectangle.
|
|
1140
|
+
* The first {@link drawn_view_count} entries are this frame's; the array is kept and refilled each call. A
|
|
1141
|
+
* `ShadowAtlasViewSource`.
|
|
1142
|
+
*
|
|
1143
|
+
* @returns {import("../../extension/ShadowAtlas.js").ShadowAtlasView[]}
|
|
1144
|
+
*/
|
|
1145
|
+
drawn_views() {
|
|
1146
|
+
const views = this.#drawn_views;
|
|
1147
|
+
const frame_index = this.#current_frame_index;
|
|
1148
|
+
const maps = this.#registry.maps;
|
|
1149
|
+
|
|
1150
|
+
let count = 0;
|
|
1151
|
+
|
|
1152
|
+
for (let i = 0; i < maps.length; i++) {
|
|
1153
|
+
const map = maps[i];
|
|
1154
|
+
const light = map.light;
|
|
1155
|
+
|
|
1156
|
+
if (
|
|
1157
|
+
map.last_updated_frame_index !== frame_index
|
|
1158
|
+
|| map.isVirtualShadowMap === true
|
|
1159
|
+
|| (light.isDirectionalLight !== true && light.isSpotLight !== true)
|
|
1160
|
+
) {
|
|
1161
|
+
continue;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
for (let v = 0; v < map.views.length; v++) {
|
|
1165
|
+
let entry = views[count];
|
|
1166
|
+
|
|
1167
|
+
if (entry === undefined) {
|
|
1168
|
+
entry = { camera: null, camera_buffer: null, viewport: [0, 0, 0, 0] };
|
|
1169
|
+
views[count] = entry;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
const rect = map.layout[v];
|
|
1173
|
+
|
|
1174
|
+
entry.camera = map.views[v].camera;
|
|
1175
|
+
entry.camera_buffer = this.shadow_view_manager.obtain(map.views[v]).camera.gpu_buffer;
|
|
1176
|
+
entry.viewport[0] = rect.x0;
|
|
1177
|
+
entry.viewport[1] = rect.y0;
|
|
1178
|
+
entry.viewport[2] = rect.width;
|
|
1179
|
+
entry.viewport[3] = rect.height;
|
|
1180
|
+
|
|
1181
|
+
count++;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
this.#drawn_view_count = count;
|
|
1186
|
+
|
|
1187
|
+
return views;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* How many of {@link drawn_views}'s entries are this frame's, as its last call found.
|
|
1192
|
+
*
|
|
1193
|
+
* @returns {number}
|
|
1194
|
+
*/
|
|
1195
|
+
get drawn_view_count() {
|
|
1196
|
+
return this.#drawn_view_count;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* @type {import("../../extension/ShadowAtlas.js").ShadowAtlasView[]}
|
|
1201
|
+
*/
|
|
1202
|
+
#drawn_views = [];
|
|
1203
|
+
|
|
1204
|
+
#drawn_view_count = 0;
|
|
1205
|
+
|
|
1131
1206
|
/**
|
|
1132
1207
|
*
|
|
1133
1208
|
* @param {Light} light
|
|
@@ -1544,8 +1619,11 @@ export class GPUSceneShadowmapContext {
|
|
|
1544
1619
|
view_ctx.update();
|
|
1545
1620
|
|
|
1546
1621
|
const job = new RasterizationJob();
|
|
1547
|
-
|
|
1548
|
-
|
|
1622
|
+
// a directional light's cascades are biased the way Unreal biases them, in the vertex stage of an
|
|
1623
|
+
// orthographic view; a spot light keeps the rasterizer's bias
|
|
1624
|
+
const cascade = map.light.isDirectionalLight === true;
|
|
1625
|
+
job.opaque_pass = cascade ? shadow_cascade_rasterization_pass_descriptor : shadow_rasterization_pass_descriptor;
|
|
1626
|
+
job.alpha_tested_pass = cascade ? shadow_cascade_alpha_tested_pass_descriptor : shadow_rasterization_alpha_tested_pass_descriptor;
|
|
1549
1627
|
job.cull_policy = SHADOW_CULL_POLICY;
|
|
1550
1628
|
job.render_target = this.#render_target;
|
|
1551
1629
|
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"}
|