Normalize normals when they are used to get more precision
This commit is contained in:
parent
5771dd98c7
commit
1c98cf0b61
@ -15,8 +15,6 @@ void main()
|
||||
vec3 Frag_normal = normalize(cross(Frag_tangent, bitangent));
|
||||
vec3 Frag_bitangent = cross(Frag_normal, Frag_tangent);
|
||||
|
||||
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal;
|
||||
FragmentNormal = normalize(FragmentNormal);
|
||||
|
||||
Normal = 0.5 * FragmentNormal + 0.5, gl_FragCoord.z;
|
||||
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal;
|
||||
Normal = 0.5 * FragmentNormal + 0.5;
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ out vec3 Normal;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Normal = 0.5 * normalize(nor) + 0.5;
|
||||
Normal = 0.5 * nor + 0.5;
|
||||
}
|
||||
|
@ -9,6 +9,6 @@ void main() {
|
||||
vec4 col = texture(tex, uv);
|
||||
if (col.a < 0.5)
|
||||
discard;
|
||||
Normal = 0.5 * normalize(nor) + 0.5;
|
||||
Normal = 0.5 * nor + 0.5;
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,7 @@ out vec4 Specular;
|
||||
void main() {
|
||||
vec2 texc = uv;
|
||||
float z = texture(dtex, texc).x;
|
||||
vec3 norm = texture(ntex, texc).xyz;
|
||||
norm = (norm - 0.5) * 2.0;
|
||||
vec3 norm = normalize(2. * texture(ntex, texc).xyz - 1.);
|
||||
|
||||
vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0f;
|
||||
xpos = invproj * xpos;
|
||||
|
@ -28,8 +28,7 @@ void main() {
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 norm = texture(ntex, uv).xyz;
|
||||
norm = (norm - 0.5) * 2.0;
|
||||
vec3 norm = normalize(2. * texture(ntex, uv).xyz - 1.);
|
||||
|
||||
// Normalized on the cpu
|
||||
vec3 L = direction;
|
||||
|
Loading…
Reference in New Issue
Block a user