Interface ShadowConfig

Config for external resources required for the aerial perspective lookup table to take shadowing into account and for render volumetric shadows when rendering the sky / atmosphere using full-screen ray marching.

To integrate user-controlled shadow maps into the sky / atmosphere rendering passes, WGSL code needs to be injected into the shader code and the layouts of the respective sky rendering pipelines need to be created using external bind group layouts.

interface ShadowConfig {
    bindGroupLayouts: GPUBindGroupLayout[];
    bindGroups: GPUBindGroup[];
    wgslCode: string;
}

Properties

bindGroupLayouts: GPUBindGroupLayout[]

A list of bind group layouts specifying all resources required to respect user-controlled shadow map(s) when rendering the aerial perspective lookup table or when doing full-screen ray marching.

This should not contain more than maxBindGroups - 1 bind group layouts, where maxBindGroups is the maximum number of bind group layouts per pipeline layout supported by the device.

bindGroups: GPUBindGroup[]

A list of bind groups generated using the bindGroupLayouts, containing all resources required by the user-controlled shadow mapping implementation.

wgslCode: string

The shader code to inject into the aerial perspective & full-screen ray marching pipelines.

This needs to provide at least a function with the following signature:

 fn get_shadow(world_space_position: vec3<f32>, light_index: u32) -> f32

The function should return a floating point value in the range [0, 1], where 1 implies that the world space position given (world_space_position) is not in shadow. The light_index parameter refers to the index of the atmosphere light, where 0 refers to Uniforms.sun and 1 refers to Uniforms.moon.

It should also include the bind groups matching the given bindGroupLayouts. The bind groups must not use bind group index 0.