magic-pixels
    Preparing search index...

    Type Alias LightUniforms

    The lights of a frame, flattened into the arrays the built-in light uniforms are uploaded from. Everything is in view space, so a shader can combine it with the vPosition and vNormal the built-in vertex shader produces, and every colour is premultiplied by the light's intensity.

    Directional lights are given by the direction they shine in (the node's -Z axis), so the vector towards the light, L in the lighting equations, is its negation.

    type LightUniforms = {
        ambientLightColor: number[];
        directionalLightColors: number[];
        directionalLightCount: number;
        directionalLightDirections: number[];
        pointLightColors: number[];
        pointLightCount: number;
        pointLightPositions: number[];
        pointLightRanges: number[];
    }
    Index
    ambientLightColor: number[]

    sum of all ambient lights, vec3

    directionalLightColors: number[]

    colour × intensity, vec3 per light

    directionalLightCount: number
    directionalLightDirections: number[]

    direction each directional light shines in, vec3 per light

    pointLightColors: number[]

    colour × intensity, vec3 per light

    pointLightCount: number
    pointLightPositions: number[]

    position of each point light, vec3 per light

    pointLightRanges: number[]

    cutoff distance per light, 0 for none, float per light