dungeon_crawler
view prototype/sdr/multi1.p.glsl @ 75:b05ab29cd17d
color grading done
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 22 Oct 2012 03:55:00 +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 }