From: Frederic Bouvier Date: Wed, 28 Mar 2012 20:39:28 +0000 (+0200) Subject: Fix normal storage into texture data. Input [-1..1] should be output to [0..1] X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8a382cd536743e4cef5b16b37a11fa1282441c5b;p=flightgear.git Fix normal storage into texture data. Input [-1..1] should be output to [0..1] --- diff --git a/src/Main/renderer.cxx b/src/Main/renderer.cxx index 3f71d1f74..771f02317 100644 --- a/src/Main/renderer.cxx +++ b/src/Main/renderer.cxx @@ -817,7 +817,7 @@ const char *sunlight_frag_src = "" " if ( spec_emis.a < 0.1 )\n" " discard;\n" " vec3 normal;\n" - " normal.xy = texture2D( normal_tex, coords ).rg;\n" + " normal.xy = texture2D( normal_tex, coords ).rg * 2.0 - vec2(1.0,1.0);\n" " normal.z = sqrt( 1.0 - dot( normal.xy, normal.xy ) );\n" " float len = length(normal);\n" " normal /= len;\n" @@ -883,7 +883,7 @@ const char *fog_frag_src = "" " if ( initialized < 0.1 )\n" " discard;\n" " vec3 normal;\n" - " normal.xy = texture2D( normal_tex, coords ).rg;\n" + " normal.xy = texture2D( normal_tex, coords ).rg * 2.0 - vec2(1.0,1.0);\n" " normal.z = sqrt( 1.0 - dot( normal.xy, normal.xy ) );\n" " float len = length(normal);\n" " normal /= len;\n"