From aa899f044f3c5d0e9ab6b3c8ccebdf2bd80d97d7 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Sun, 17 Sep 2023 20:14:37 -0400 Subject: [PATCH] SSR now keeps albedo color properly instead of fading to black --- Editor/resources/Shaders/combine.shader | 2 +- Editor/resources/Shaders/deferred.shader | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Editor/resources/Shaders/combine.shader b/Editor/resources/Shaders/combine.shader index df932b51..4e42e6ac 100644 --- a/Editor/resources/Shaders/combine.shader +++ b/Editor/resources/Shaders/combine.shader @@ -27,5 +27,5 @@ void main() vec4 a = texture(u_Source, UV); vec4 b = texture(u_Source2, UV); - FragColor = vec4(vec3(a.rgb + b.rgb / 2.0), a.a * b.a); + FragColor = vec4(vec3(a.rgb + (b.rgb) / 2.0), a.a); } \ No newline at end of file diff --git a/Editor/resources/Shaders/deferred.shader b/Editor/resources/Shaders/deferred.shader index c9d14654..bc6ee17a 100644 --- a/Editor/resources/Shaders/deferred.shader +++ b/Editor/resources/Shaders/deferred.shader @@ -272,7 +272,7 @@ void main() // scale light by NdotL float NdotL = max(dot(N, L), 0.0); - Lo += (kD * albedo / PI) * radiance * NdotL;// note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again + Lo += (kD * albedo / PI + specular) * radiance * NdotL;// note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again } /// ambient lighting (we now use IBL as the ambient term) @@ -282,7 +282,7 @@ void main() vec3 kD = 1.0 - kS; kD *= 1.0 - metallic; - vec3 ambient = (kD * albedo) * (ao) * ssao; + vec3 ambient = (vec3(0.5) * albedo) * (ao)*ssao; vec3 color = (ambient) + Lo; // Display CSM splits..