dungeon_crawler

view prototype/sdr/multi1.p.glsl @ 60:aa86119e3295

added multipass deferred
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Sep 2012 06:19:37 +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 }