1
0
Fork 0

Rembrandt: Normalize normals before outputing them to gbuffer

This commit is contained in:
Frederic Bouvier 2012-04-04 20:07:49 +02:00
parent ec715cba3d
commit ceb1cb102b

View file

@ -16,7 +16,7 @@ void main() {
float shininess = gl_FrontMaterial.shininess; float shininess = gl_FrontMaterial.shininess;
float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb, vec3( 0.3, 0.59, 0.11 ) ); float emission = dot( gl_FrontLightModelProduct.sceneColor.rgb, vec3( 0.3, 0.59, 0.11 ) );
vec3 normal2 = (2.0 * gl_Color.a - 1.0) * ecNormal; vec3 normal2 = normalize( (2.0 * gl_Color.a - 1.0) * ecNormal );
gl_FragData[0] = vec4( (normal2.xy + vec2(1.0,1.0)) * 0.5, 0.0, 1.0 ); gl_FragData[0] = vec4( (normal2.xy + vec2(1.0,1.0)) * 0.5, 0.0, 1.0 );
gl_FragData[1] = vec4( gl_Color.rgb * texel.rgb, float( materialID ) / 255.0 ); gl_FragData[1] = vec4( gl_Color.rgb * texel.rgb, float( materialID ) / 255.0 );
gl_FragData[2] = vec4( specular, shininess / 255.0, emission, 1.0 ); gl_FragData[2] = vec4( specular, shininess / 255.0, emission, 1.0 );