More lighting changes

This commit is contained in:
Dynamitos
2025-03-13 08:23:00 +01:00
parent 80f86ca95c
commit 51d759639e
11 changed files with 18 additions and 20 deletions
-1
View File
@@ -31,6 +31,5 @@ float4 fragmentMain(in FragmentParameter params) : SV_Target
result += pLightEnv.pointLights[lightIndex].illuminate(lightingParams, brdf);
}
result += brdf.evaluateAmbient();
// gamma correction
return float4(result, brdf.getAlpha());
}
+1 -1
View File
@@ -101,5 +101,5 @@ float4 fragmentMain(
float factor = (output.texCoords.y - lowerLimit) / (upperLimit - lowerLimit);
factor = clamp(factor, 0.0, 1.0);
return lerp(float4(pSkyboxData.fogBlend.xyz, 1), finalColor, factor);
return lerp(float4(pSkyboxData.fogBlend.xyz, 1), finalColor, factor) * 100;
}
+6 -7
View File
@@ -84,14 +84,14 @@ float3 agxEotf(float3 val) {
val = mul(agx_mat_inv, val);
// sRGB IEC 61966-2-1 2.2 Exponent Reference EOTF Display
//val = pow(val, float3(2.2));
val = pow(val, float3(2.2));
return val;
}
float3 agxLook(float3 val, float avgLum) {
float3 agxLook(float3 val) {
const float3 lw = float3(0.2126, 0.7152, 0.0722);
float luma = dot(val, lw) / (9.6 * avgLum + 0.00001);
float luma = dot(val, lw);
// Default
float3 offset = pToneMappingParams.offset.xyz;
@@ -108,10 +108,9 @@ float3 agxLook(float3 val, float avgLum) {
float4 toneMapping(float2 uv : UV) : SV_Target
{
float3 hdrValue = pToneMappingParams.hdrInputTexture.Sample(pToneMappingParams.hdrSampler, uv).rgb;
float avgLum = pToneMappingParams.averageLuminance[0];
float3 value = agx(hdrValue);
value = agxLook(value, avgLum);
float3 value = agx(hdrValue / 1000);
value = agxLook(value);
value = agxEotf(value);
return float4(value, 1);
+2 -2
View File
@@ -15,7 +15,7 @@ struct DirectionalLight : ILightEnv
float3 illuminate<B:IBRDF>(LightingParameter params, B brdf)
{
float3 dir_WS = -normalize(direction.xyz);
return brdf.evaluate(params.viewDir_WS, dir_WS, color.xyz);
return brdf.evaluate(params.viewDir_WS, dir_WS, color.xyz * color.w);
}
};
@@ -29,7 +29,7 @@ struct PointLight : ILightEnv
float3 lightDir_WS = position_WS.xyz - params.position_WS;
float d = length(lightDir_WS);
float illuminance = max(1 - d / colorRange.w, 0);
return illuminance * brdf.evaluate(params.viewDir_WS, normalize(lightDir_WS), colorRange.xyz);
return illuminance * brdf.evaluate(params.viewDir_WS, normalize(lightDir_WS), colorRange.xyz * position_WS.w);
}
bool insidePlane(Plane plane, float3 position)