summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-06-29 17:50:03 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-06-29 17:50:03 -0700
commitd1e078a1229fa61ba697e382fb42b6a6b11e8f97 (patch)
tree9e9e20013a16f7c394d309e91a65747520caf5e7 /indra/newview/app_settings
parent251b75ea2ed5e652c245f9bed33ff96092b830fe (diff)
SL-17274: PBR: Fix EMS being zero when using GGX approximation
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl6
1 files changed, 6 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 2749dfed30..44884e780f 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -23,6 +23,7 @@
* $/LicenseInfo$
*/
+#define PBR_GGX_APPROX 1
#define DEBUG_PBR_PACKORM0 0 // Rough=0, Metal=0
#define DEBUG_PBR_PACKORM1 0 // Rough=1, Metal=1
#define DEBUG_PBR_TANGENT1 1 // Tangent = 1,0,0
@@ -141,7 +142,9 @@ vec2 getGGX( vec2 brdfPoint )
{
// TODO: use GGXLUT
// texture2D(GGXLUT, brdfPoint).rg;
+#if PBR_GGX_APPROX
return getGGXApprox( brdfPoint);
+#endif
}
vec3 calcBaseReflect0(float ior)
@@ -274,6 +277,9 @@ void main()
// Reference: getIBLRadianceLambertian
vec3 FssEssLambert = specWeight * kSpec * vScaleBias.x + vScaleBias.y; // NOTE: Very similar to FssEssRadiance but with extra specWeight term
float Ems = (1.0 - vScaleBias.x + vScaleBias.y);
+#if PBR_GGX_APPROX
+ Ems = alphaRough; // With GGX approximation Ems = 0 so use substitute
+#endif
vec3 avg = specWeight * (reflect0 + (1.0 - reflect0) / 21.0);
vec3 AvgEms = avg * Ems;
vec3 FmsEms = AvgEms * FssEssLambert / (1.0 - AvgEms);