pub struct VirtualShadowMap { /* private fields */ }Expand description
4-Cascade Practical Split Cascaded Shadow Map with texel-snapped static page caching, real-mesh rasterization, and rotated 16-tap Vogel-disk PCF.
Implementations§
Source§impl VirtualShadowMap
Static page cache management, Practical Split cascade fitting, and 16-tap Vogel-disk PCF sampling for VirtualShadowMap.
impl VirtualShadowMap
Static page cache management, Practical Split cascade fitting, and 16-tap Vogel-disk PCF sampling for VirtualShadowMap.
Sourcepub fn compute_practical_splits(
near_plane: f32,
far_plane: f32,
lambda: f32,
) -> [f32; 4]
pub fn compute_practical_splits( near_plane: f32, far_plane: f32, lambda: f32, ) -> [f32; 4]
Computes the 4 Practical Split Scheme cascade split depths [d0, d1, d2, d3] between near_plane and far_plane.
§Arguments
f32- Camera near plane distance in meters.f32- Maximum directional shadow distance in meters.f32- Practical Split lambda in[0.0, 1.0](0.0uniform,1.0logarithmic).
§Returns
[f32; VSM_CASCADE_COUNT]- Strictly increasing far split distances for cascades0..4.
Sourcepub fn with_resolution(resolution: usize) -> Self
pub fn with_resolution(resolution: usize) -> Self
Sourcepub fn get_cascade_near(&self) -> &VsmCascade
pub fn get_cascade_near(&self) -> &VsmCascade
Returns a reference to the finest near contact cascade (cascades[0]).
§Returns
&VsmCascade- Near shadow cascade reference.
Sourcepub fn get_cascade_far(&self) -> &VsmCascade
pub fn get_cascade_far(&self) -> &VsmCascade
Returns a reference to the farthest skyline cascade (cascades[3]).
§Returns
&VsmCascade- Far shadow cascade reference.
Sourcepub fn cascade_light_view_proj(&self, cascade_idx: usize) -> Mat4
pub fn cascade_light_view_proj(&self, cascade_idx: usize) -> Mat4
Sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Invalidates all four static shadow cascades so the next update re-rasterizes static geometry cleanly.
Sourcepub fn update_from_world(&mut self, world: &World3D)
pub fn update_from_world(&mut self, world: &World3D)
Synchronizes all four Practical-Split shadow cascades with world, reusing cached static pages whenever sun, static epoch, and snapped centers are unchanged.
§Arguments
&World3D- Active 3D world supplying camera, sun, objects, and mesh library.
Sourcepub fn sample_visibility(
&self,
world_pos: Vec3,
normal: Vec3,
sun_dir: Vec3,
) -> f32
pub fn sample_visibility( &self, world_pos: Vec3, normal: Vec3, sun_dir: Vec3, ) -> f32
Samples multi-cascade rotated 16-tap Vogel-disk PCF shadow visibility at world_pos across all 4 cascades with smooth inter-cascade boundary blending.
§Arguments
Vec3- World-space surface position.Vec3- Unit outward surface normal.Vec3- Unit directional sun vector.
§Returns
f32- Smooth sun visibility in[0.22, 1.0](1.0outside all four cascades).
Source§impl VirtualShadowMap
Implements impl #impl_generics #name #ty_generics #where_clause.
impl VirtualShadowMap
Implements impl #impl_generics #name #ty_generics #where_clause.