intravenous

view sdr/vein.p.glsl @ 4:c6a6a64df6de

normalmap
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Apr 2012 05:20:03 +0300
parents 94d4c60af435
children aab0d8ea21cd
line source
1 uniform sampler2D tex_norm;
3 varying vec3 vpos, vnorm;
4 varying vec3 ldir, vdir;
6 void main()
7 {
8 vec3 tnorm = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0;
9 vec3 n = normalize(tnorm);
10 vec3 v = normalize(vdir);
11 vec3 l = v;//normalize(ldir);
12 vec3 h = normalize(l + v);
14 vec3 diff = vec3(0.8, 0.25, 0.2) * (1.0 - max(dot(l, n), 0.0));
15 vec3 spec = 0.5 * vec3(0.9, 0.4, 0.3) * pow(max(dot(h, n), 0.0), 10.0);
17 gl_FragColor = vec4(diff + spec, 1.0);
18 }