dungeon_crawler
view prototype/sdr/multi1.p.glsl @ 79:110b2af4b9d8
fixed the shader non-conformity by explicitly converting 2.2 to vec3 before passing it to pow for the texel inverse-gamma thing
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 27 Oct 2012 01:54:39 +0300 |
parents | |
children |
line source
1 /* multipass renderer shader 1: RGB: normal */
3 uniform sampler2D tex_norm;
5 varying vec3 pos, norm, tang;
7 void main()
8 {
9 vec3 n = normalize(norm);
10 vec3 t = normalize(tang);
11 vec3 b = cross(n, t);
13 mat3 tbn_mat = mat3(
14 t.x, t.y, t.z,
15 b.x, b.y, b.z,
16 n.x, n.y, n.z);
18 // grab normal from the normal map, remap it and transform it to view space
19 n = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0;
20 n = normalize(tbn_mat * n);
22 gl_FragColor = vec4(n, 0.0);
23 }