From 6381065eea35f90b6594b03ed7dfaf0335ce6253 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 2 Mar 2025 00:29:04 -0600 Subject: [PATCH] proper correction for missing direct light suface coloration --- .../BaseGame/game/core/rendering/shaders/gl/lighting.glsl | 4 ++-- Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl index e49bf308d..8de548cf1 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl @@ -226,7 +226,7 @@ float getDistanceAtt( vec3 unormalizedLightVector , float invSqrAttRadius ) vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) { //diffuse term - vec3 Fd = surface.albedo.rgb * M_1OVER_PI_F; + vec3 Fd = surface.baseColor.rgb * M_1OVER_PI_F * surface.ao; //GGX specular vec3 F = F_Schlick(surface.f0, surface.f90, surfaceToLight.HdotV); @@ -237,7 +237,7 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) if(isCapturing == 1) return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness); else - return Fd + Fr + surface.f0 * surface.ao; + return Fd + Fr; } vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow) diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl index ecf846a21..d65b44d9d 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl @@ -227,7 +227,7 @@ float getDistanceAtt( float3 unormalizedLightVector , float invSqrAttRadius ) float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) { //diffuse term - float3 Fd = surface.albedo.rgb * M_1OVER_PI_F; + float3 Fd = surface.baseColor.rgb * M_1OVER_PI_F * surface.ao; //GGX specular float3 F = F_Schlick(surface.f0, surface.f90, surfaceToLight.HdotV); @@ -238,7 +238,7 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) if(isCapturing == 1) return lerp(Fd + Fr,surface.baseColor.rgb,surface.metalness); else - return Fd + Fr + surface.f0 * surface.ao; + return Fd + Fr; } float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow)