dungeon_crawler

annotate prototype/sdr/multi1.p.glsl @ 76:f379c00eb07f

added samurai's texel center fix for the color grading palette lookup
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 23 Oct 2012 14:57:08 +0300
parents
children
rev   line source
nuclear@60 1 /* multipass renderer shader 1: RGB: normal */
nuclear@60 2
nuclear@60 3 uniform sampler2D tex_norm;
nuclear@60 4
nuclear@60 5 varying vec3 pos, norm, tang;
nuclear@60 6
nuclear@60 7 void main()
nuclear@60 8 {
nuclear@60 9 vec3 n = normalize(norm);
nuclear@60 10 vec3 t = normalize(tang);
nuclear@60 11 vec3 b = cross(n, t);
nuclear@60 12
nuclear@60 13 mat3 tbn_mat = mat3(
nuclear@60 14 t.x, t.y, t.z,
nuclear@60 15 b.x, b.y, b.z,
nuclear@60 16 n.x, n.y, n.z);
nuclear@60 17
nuclear@60 18 // grab normal from the normal map, remap it and transform it to view space
nuclear@60 19 n = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0;
nuclear@60 20 n = normalize(tbn_mat * n);
nuclear@60 21
nuclear@60 22 gl_FragColor = vec4(n, 0.0);
nuclear@60 23 }