

// LPV block brightness scale
const float LpvBlockBrightness = 1.0;

vec4 SampleLpvLinear(const in vec3 lpvPos)
{
    vec3 texcoord = lpvPos / LpvSize3;

    vec4 lpvSample = (frameCounter % 2) == 0 ? textureLod(texLpv1, texcoord, 0) : textureLod(texLpv2, texcoord, 0);

    vec3 hsv = RgbToHsv(lpvSample.rgb);
    hsv.z *= hsv.z + hsv.z * 0.5;
    lpvSample.rgb = HsvToRgb(hsv);

    return lpvSample;
}

vec3 GetLpvBlockLight(const in vec4 lpvSample)
{
    return LpvBlockBrightness * lpvSample.rgb;
}

float GetLpvSkyLight(const in vec4 lpvSample)
{
    float skyLight = clamp(lpvSample.a, 0.0, 1.0);
    return skyLight * skyLight;
}