1
0
Fork 0

Fix normal storage into texture data. Input [-1..1] should be output to [0..1]

This commit is contained in:
Frederic Bouvier 2012-03-28 22:39:28 +02:00
parent 55105baa25
commit 8a382cd536

View file

@ -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"