Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

shadows.wgsl

Import path

Constants

flip_z

#
const flip_z: vec3<f32> = vec3<f32>(1.0, 1.0, -1.0)

Functions

fetch_point_shadow

#
fn fetch_point_shadow (
light_id: u32
frag_position: vec4<f32>
surface_normal: vec3<f32>
) -> f32

fetch_spot_shadow

#
fn fetch_spot_shadow (
light_id: u32
frag_position: vec4<f32>
surface_normal: vec3<f32>
near_z: f32
) -> f32

get_cascade_index

#
fn get_cascade_index (
light_id: u32
view_z: f32
) -> u32

world_to_directional_light_local

#

The depth is stored in the return value’s z coordinate. If the return value’s w coordinate is 0.0, then we landed outside the shadow map entirely.

fn world_to_directional_light_local (
light_id: u32
cascade_index: u32
offset_position: vec4<f32>
) -> vec4<f32>

sample_directional_cascade

#
fn sample_directional_cascade (
light_id: u32
cascade_index: u32
frag_position: vec4<f32>
surface_normal: vec3<f32>
) -> f32

fetch_directional_shadow

#
fn fetch_directional_shadow (
light_id: u32
frag_position: vec4<f32>
surface_normal: vec3<f32>
view_z: f32
) -> f32

cascade_debug_visualization

#
fn cascade_debug_visualization (
output_color: vec3<f32>
light_id: u32
view_z: f32
) -> vec3<f32>