dungeon_crawler
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/prototype/sdr/multi1.p.glsl Tue Sep 25 06:19:37 2012 +0300 1.3 @@ -0,0 +1,23 @@ 1.4 +/* multipass renderer shader 1: RGB: normal */ 1.5 + 1.6 +uniform sampler2D tex_norm; 1.7 + 1.8 +varying vec3 pos, norm, tang; 1.9 + 1.10 +void main() 1.11 +{ 1.12 + vec3 n = normalize(norm); 1.13 + vec3 t = normalize(tang); 1.14 + vec3 b = cross(n, t); 1.15 + 1.16 + mat3 tbn_mat = mat3( 1.17 + t.x, t.y, t.z, 1.18 + b.x, b.y, b.z, 1.19 + n.x, n.y, n.z); 1.20 + 1.21 + // grab normal from the normal map, remap it and transform it to view space 1.22 + n = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0; 1.23 + n = normalize(tbn_mat * n); 1.24 + 1.25 + gl_FragColor = vec4(n, 0.0); 1.26 +}