Documentation
    Preparing search index...

    Variable SHADOW_FACTOR_WGSLConst

    SHADOW_FACTOR_WGSL: "fn shadowFactor(worldPosition : vec3<f32>, n : vec3<f32>) -> f32 {\n let lightSpace = lights.shadowMatrix * vec4<f32>(worldPosition + n * lights.shadowParams.y, 1.0);\n let ndc = lightSpace.xyz / lightSpace.w;\n // x and depth map [-1, 1] onto [0, 1]; v flips for the top-left map origin.\n let c = vec3<f32>(ndc.x * 0.5 + 0.5, 0.5 - ndc.y * 0.5, ndc.z * 0.5 + 0.5);\n if (any(c < vec3<f32>(0.0)) || any(c > vec3<f32>(1.0))) {\n return 1.0;\n }\n let receiver = c.z - lights.shadowParams.x;\n var lit = 0.0;\n for (var y = -1; y <= 1; y = y + 1) {\n for (var x = -1; x <= 1; x = x + 1) {\n let tap = c.xy + vec2<f32>(f32(x), f32(y)) * lights.shadowParams.z;\n lit = lit + textureSampleCompareLevel(shadowMap, shadowSampler, tap, receiver);\n }\n }\n return lit / 9.0;\n}"

    The receiver-side factor — SHADOW_GLSL's shadowFactor, tap for tap; the module header walks the two deliberate differences (the v flip, the comparison evaluated by the sampler instead of in the loop body).