diff --git a/data/Source/System/Shaders/Modules/PBR.xdi b/data/Source/System/Shaders/Modules/PBR.xdi index 6e588e0b07..98003fa9a8 100644 --- a/data/Source/System/Shaders/Modules/PBR.xdi +++ b/data/Source/System/Shaders/Modules/PBR.xdi @@ -69,29 +69,19 @@ vec3 CalculateLighting(vec3 N, vec3 V, vec3 L, vec3 albedo, float metallic, floa return (kD * albedo / PI + specular) * radiance * NdotL; } -vec3 CalculateReflection(vec3 N, vec3 V, vec3 albedo, float metallic, float roughness) +vec3 CalculateReflection(vec3 N, vec3 V, vec3 albedo, float metallic) { // Use the view reflection vector as light direction. const vec3 L = -reflect(V, N); - const vec3 H = normalize(V + L); - const float NdotL = max(dot(N, L), 0.0f); - const float NdotV = max(dot(N, V), 0.0f); - - const vec3 F0 = mix(vec3(0.04), albedo, metallic); - const vec3 F = FresnelSchlick(max(dot(H, V), 0.0), F0); + const float HdotV = max(dot(H, V), 0.0f); - const float NDF = DistributionGGX(N, H, roughness); - const float G = GeometrySmith(N, V, L, roughness); - - const vec3 numerator = NDF * G * F; - const float denominator = 4.0f * NdotV * NdotL + 0.0001f; - const vec3 specular = numerator / denominator; + const vec3 F0 = mix(vec3(0.1f), albedo, metallic); + const vec3 F = FresnelSchlick(HdotV, F0); - return clamp(specular, 0.0f, 1.0f); + return clamp(F * 1.0f, 0.0f, 1.0f); } - ]]> diff --git a/data/Source/System/World/Light/Shaders/Deferred/Lights.xdi b/data/Source/System/World/Light/Shaders/Deferred/Lights.xdi index 500b867cda..e5239cb550 100644 --- a/data/Source/System/World/Light/Shaders/Deferred/Lights.xdi +++ b/data/Source/System/World/Light/Shaders/Deferred/Lights.xdi @@ -766,8 +766,8 @@ {BC1582DC-5A5D-F347-8685-1ED14D2FF1B4} - 6534 - 1794 + 6865 + 1744 @@ -1549,8 +1549,8 @@ Check max shadow distance {F9E67DE5-3704-224A-96AE-9228482CEB38} - 6314 - 1767 + 6393 + 1703 L_Irradiance @@ -2418,8 +2418,8 @@ $Output = vec4(Lout.xyz, 0.0f); {6493D852-89DC-7D45-96A5-43172F633200} - 6612 - 1889 + 6405 + 1751 L_Albedo @@ -2427,8 +2427,8 @@ $Output = vec4(Lout.xyz, 0.0f); {D6AA86B0-7BAA-E947-B1A8-45729FA00832} - 6814 - 1814 + 6616 + 1699 @@ -2465,10 +2465,6 @@ $Output = vec4(Lout.xyz, 0.0f); {CD77DAB2-298A-A04F-BA9E-C535D9F7039D} Metallic - - {0AE24D2B-EF65-2A44-8272-F5B8084A3051} - Roughness - @@ -2483,17 +2479,16 @@ const vec3 N = $N.xyz; const vec3 V = $V.xyz; const vec3 albedo = $Albedo.xyz; const float metallic = $Metallic.x; -const float roughness = $Roughness.x; const vec3 r = CalculateReflection( N, V, albedo, - metallic, - roughness + metallic ); $Output = vec4(r, 0.0f); + ]]> @@ -2501,8 +2496,8 @@ $Output = vec4(r, 0.0f); {06A6E503-4F41-E447-8982-C83339D34812} - 5708 - 1882 + 5769 + 1961 L_Albedo @@ -2510,8 +2505,8 @@ $Output = vec4(r, 0.0f); {D5188A3E-251B-894A-95B6-11FB8E397D9F} - 5689 - 1919 + 5753 + 1995 L_Metalness @@ -2519,26 +2514,17 @@ $Output = vec4(r, 0.0f); {1B2864A9-E4FE-C24E-BF5A-36D2EA6A4C70} - 5673 - 1959 + 5753 + 1893 L_ViewNormal - - {9225CBF0-0C5E-A24E-8CF7-F01164FDB458} - - - 5673 - 1999 - - L_Roughness - {BD6C147B-861D-F14A-A9F2-5584F1DF6D5D} - 5657 - 2039 + 5737 + 1927 L_ViewDirection @@ -4502,16 +4488,6 @@ $Output = vec4(r, 0.0f); {CD77DAB2-298A-A04F-BA9E-C535D9F7039D} - - - - {84BF3C26-64A7-4032-B775-1D369052B243} - - - - {0AE24D2B-EF65-2A44-8272-F5B8084A3051} - - @@ -4524,7 +4500,7 @@ $Output = vec4(r, 0.0f); - + {84BF3C26-64A7-4032-B775-1D369052B243} @@ -4538,28 +4514,28 @@ $Output = vec4(r, 0.0f); {26124FFB-5851-A149-800A-2611E58573AD} - + {D2D716D6-C4A1-471F-894A-D718515F6281} - - {9E839249-E9B9-4736-8BDD-A95A1C892B42} + + {32FD3DAA-16C1-44C8-8A1E-E9ECF97F31D2} - - {69997292-C813-490C-910C-620B9AD3A2BB} + + {11585EBC-914D-4E6D-A10D-D01694FF9840} - + {9E839249-E9B9-4736-8BDD-A95A1C892B42} - - {9F45B2C3-B513-4646-B0C1-663748FD169C} + + {69997292-C813-490C-910C-620B9AD3A2BB} @@ -4568,24 +4544,24 @@ $Output = vec4(r, 0.0f); {84BF3C26-64A7-4032-B775-1D369052B243} - - {3DE04294-4DEA-4A13-A460-2274647357EA} + + {69997292-C813-490C-910C-620B9AD3A2BB} - - {32FD3DAA-16C1-44C8-8A1E-E9ECF97F31D2} + + {9E839249-E9B9-4736-8BDD-A95A1C892B42} - - {69997292-C813-490C-910C-620B9AD3A2BB} + + {3DE04294-4DEA-4A13-A460-2274647357EA} - - {9E839249-E9B9-4736-8BDD-A95A1C892B42} + + {32FD3DAA-16C1-44C8-8A1E-E9ECF97F31D2} @@ -4594,12 +4570,12 @@ $Output = vec4(r, 0.0f); - - {32FD3DAA-16C1-44C8-8A1E-E9ECF97F31D2} + + {9E839249-E9B9-4736-8BDD-A95A1C892B42} - - {11585EBC-914D-4E6D-A10D-D01694FF9840} + + {9F45B2C3-B513-4646-B0C1-663748FD169C}