summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-08-23 04:17:12 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-08-23 04:17:12 -0700
commit0079dcd6a451bb356e9197d40181913ddad63e72 (patch)
tree6c4d3be38d2d47ec8a4a565b786fd42e5baa6deb /indra/newview/app_settings/shaders
parent459faa8f7f93b4a0f83b8862eb6b4679ed3635e6 (diff)
SL-17766: PBR: Add V_GGX references
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl18
1 files changed, 18 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 46463818f8..8ecdafa167 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -392,17 +392,35 @@ float D_GGX( float nh, float alphaRough )
}
// NOTE: This is different from the GGX texture
+// See:
+// Real Time Rendering, 4th Edition
+// Page 341
+// Equation 9.43
+// Also see:
+// https://google.github.io/filament/Filament.md.html#materialsystem/specularbrdf/geometricshadowing(specularg)
+// 4.4.2 Geometric Shadowing (specular G)
float V_GGX( float nl, float nv, float alphaRough )
{
+#if 1
+ // Note: When roughness is zero, has discontuinity in the bottom hemisphere
float rough2 = alphaRough * alphaRough;
float ggxv = nl * sqrt(nv * nv * (1.0 - rough2) + rough2);
float ggxl = nv * sqrt(nl * nl * (1.0 - rough2) + rough2);
+
float ggx = ggxv + ggxl;
if (ggx > 0.0)
{
return 0.5 / ggx;
}
return 0.0;
+#else
+ // See: smithVisibility_GGXCorrelated, V_SmithCorrelated, etc.
+ float rough2 = alphaRough * alphaRough;
+ float ggxv = nl * sqrt(nv * (nv - rough2 * nv) + rough2);
+ float ggxl = nv * sqrt(nl * (nl - rough2 * nl) + rough2);
+ return 0.5 / (ggxv + ggxl);
+#endif
+
}
// NOTE: Assumes a hard-coded IOR = 1.5