diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-04-14 14:52:09 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-04-14 17:20:36 +0000 |
commit | dfdf17a19d0c516757ba7a0833b267d40d52b9ae (patch) | |
tree | 291ad04d598a662119654ba1d782a8ad5b2d5ef0 | |
parent | 63df2136a1c0f68cc466864a07dd55f5bf7ca41f (diff) |
Use correct implicit geometric shadowing/masking term in BRDF
For an implicit BRDF shadowing/masking term, we should be using the
factor from the denominator so that they cancel out. Otherwise we get
overly strong specular highlights at glancing angles due to the
vDotN factor blowing up.
For more potential microfacet factors see:
http://graphicrants.blogspot.co.uk/2013/08/specular-brdf-reference.html
or
http://simonstechblog.blogspot.co.uk/2011/12/microfacet-brdf.html
Task-number: QTBUG-60179
Change-Id: I7899bd6983c3645f16ebc6d22db843b141fe913c
Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r-- | src/extras/shaders/gl3/metalrough.frag | 2 | ||||
-rw-r--r-- | src/extras/shaders/gl3/metalroughuniform.frag | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/extras/shaders/gl3/metalrough.frag b/src/extras/shaders/gl3/metalrough.frag index 225541775..e1eb6bab2 100644 --- a/src/extras/shaders/gl3/metalrough.frag +++ b/src/extras/shaders/gl3/metalrough.frag @@ -146,7 +146,7 @@ float geometricModel(const in float lDotN, // Implicit geometric model (equal to denominator in specular model). // This currently assumes that there is no attenuation by geometric shadowing or // masking according to the microfacet theory. - return 1.0; + return lDotN * vDotN; } vec3 specularModel(const in vec3 F0, diff --git a/src/extras/shaders/gl3/metalroughuniform.frag b/src/extras/shaders/gl3/metalroughuniform.frag index a851c957c..cccd31b52 100644 --- a/src/extras/shaders/gl3/metalroughuniform.frag +++ b/src/extras/shaders/gl3/metalroughuniform.frag @@ -141,7 +141,7 @@ float geometricModel(const in float lDotN, // Implicit geometric model (equal to denominator in specular model). // This currently assumes that there is no attenuation by geometric shadowing or // masking according to the microfacet theory. - return 1.0; + return lDotN * vDotN; } vec3 specularModel(const in vec3 F0, |