Module shader

Source
Expand description

Shader functions for the lighting system.

Directional lights are in lux, spot and point lights are in candelas. Conversion happens in the PBR shader during radiance accumulation.

More info is here https://www.realtimerendering.com/blog/physical-units-for-lights.

§Note

The glTF spec 1 says directional light is in lux, whereas spot and point are in candelas. The same goes for this library’s shaders, but not a ton of work has gone into verifying that conversion from these units into radiometric units is accurate in any way. The shaders roughly do a conversion by dividing by 683 2 or some other constant involving 683 3.

More work needs to be done here. PRs would be very appreciated.

Structs§

Candela
A unit of luminous intensity, lumen per steradian (lm/sr).
DirectionalLightDescriptor
LightDescriptor
A generic light that is used as a slab pointer to a specific light type.
LightTile
A tile of screen space used to cull lights.
LightTilingDescriptor
Descriptor of the light tiling operation, which culls lights by accumulating them into lists that illuminate tiles of the screen.
LightingDescriptor
Lux
A unit of illuminance, lumen per meter squared (lm/m^2).
PointLightDescriptor
ShadowCalculation
Parameters to the shadow mapping calculation function.
ShadowMapDescriptor
SpotLightCalculation
Contains values needed to determine the outgoing radiance of a fragment.
SpotLightDescriptor
Description of a spot light.

Enums§

LightStyle

Functions§

dequantize_depth_u32_to_f32
Reconstructs a previously quantized depth from a u32.
light_tiling_bin_lights
light_tiling_clear_tiles
light_tiling_compute_tile_min_and_max_depth
Compute the min and max depth value for a tile.
light_tiling_compute_tile_min_and_max_depth_multisampled
Compute the min and max depth value for a tile, multisampled.
light_tiling_depth_pre_pass
Depth pre-pass for the light tiling feature.
quantize_depth_f32_to_u32
Quantizes a fragment depth from f32 to u32.
radius_of_illumination
Returns the radius of illumination in meters.
shadow_mapping_fragment
shadow_mapping_vertex
Shadow mapping vertex shader.

Type Aliases§

DepthImage2d
DepthImage2dMultisampled