diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-05-11 15:21:13 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-05-16 10:03:40 +0000 |
commit | cd18ac348388cbc55aef11cca3a9a291fd79fe76 (patch) | |
tree | 94acf842f65e3b8e6a6fceb65bb29c163b810fb6 | |
parent | afbf3d45f6e440b1d71d62a85289bd8fcc98a134 (diff) |
Ensure normal vector is normalized following interpolation
Fixes "per-vertex" appearance of specular highlight in
QMetalRoughMaterial.
Task-number: QTBUG-60181
Change-Id: I03fd54ff997242fd987174d453642bd00076e26f
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
-rw-r--r-- | src/extras/shaders/gl3/metalroughuniform.frag | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/extras/shaders/gl3/metalroughuniform.frag b/src/extras/shaders/gl3/metalroughuniform.frag index c9191adbf..f4bad0a00 100644 --- a/src/extras/shaders/gl3/metalroughuniform.frag +++ b/src/extras/shaders/gl3/metalroughuniform.frag @@ -338,9 +338,11 @@ void main() // Remap roughness for a perceptually more linear correspondence float alpha = remapRoughness(roughness); + + vec3 wNormal = normalize(worldNormal); vec3 worldView = normalize(eyePosition - worldPosition); for (int i = 0; i < envLightCount; ++i) { - cLinear += pbrIblModel(worldNormal, + cLinear += pbrIblModel(wNormal, worldView, baseColor.rgb, metalness, @@ -350,7 +352,7 @@ void main() for (int i = 0; i < lightCount; ++i) { cLinear += pbrModel(i, worldPosition, - worldNormal, + wNormal, worldView, baseColor.rgb, metalness, |