2024-05-05 09:08:24 +08:00
|
|
|
// LPV block brightness scale
|
2024-06-20 09:44:21 +08:00
|
|
|
const float LpvBlockBrightness = 1.0;
|
2024-05-05 09:08:24 +08:00
|
|
|
|
|
|
|
|
2024-06-19 10:23:29 +08:00
|
|
|
float lpvCurve(float values) {
|
2024-07-08 09:21:55 +08:00
|
|
|
// return values;
|
2024-06-19 10:23:29 +08:00
|
|
|
return pow(1.0 - sqrt(1.0-values), 2.0);
|
2024-05-05 09:08:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
2024-06-19 10:23:29 +08:00
|
|
|
vec3 texcoord = lpvPos / LpvSize3;
|
2024-05-05 09:08:24 +08:00
|
|
|
|
2024-06-19 10:23:29 +08:00
|
|
|
vec4 lpvSample = (frameCounter % 2) == 0
|
|
|
|
? textureLod(texLpv1, texcoord, 0)
|
|
|
|
: textureLod(texLpv2, texcoord, 0);
|
2024-05-05 09:08:24 +08:00
|
|
|
|
2024-06-19 10:23:29 +08:00
|
|
|
vec3 hsv = RgbToHsv(lpvSample.rgb);
|
|
|
|
hsv.z = lpvCurve(hsv.b) * LpvBlockSkyRange.x;
|
|
|
|
lpvSample.rgb = HsvToRgb(hsv);
|
2024-05-05 09:08:24 +08:00
|
|
|
|
2024-06-19 10:23:29 +08:00
|
|
|
return lpvSample;
|
2024-05-05 09:08:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
vec3 GetLpvBlockLight(const in vec4 lpvSample) {
|
|
|
|
return LpvBlockBrightness * lpvSample.rgb;
|
|
|
|
}
|
|
|
|
|
|
|
|
float GetLpvSkyLight(const in vec4 lpvSample) {
|
|
|
|
float skyLight = saturate(lpvSample.a);
|
|
|
|
return skyLight*skyLight;
|
|
|
|
}
|