intravenous
diff 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 diff
1.1 --- a/sdr/vein.p.glsl Sun Apr 22 03:35:18 2012 +0300 1.2 +++ b/sdr/vein.p.glsl Sun Apr 22 05:20:03 2012 +0300 1.3 @@ -1,15 +1,18 @@ 1.4 +uniform sampler2D tex_norm; 1.5 + 1.6 varying vec3 vpos, vnorm; 1.7 varying vec3 ldir, vdir; 1.8 1.9 void main() 1.10 { 1.11 - vec3 n = normalize(vnorm); 1.12 - vec3 l = normalize(ldir); 1.13 + vec3 tnorm = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0; 1.14 + vec3 n = normalize(tnorm); 1.15 vec3 v = normalize(vdir); 1.16 + vec3 l = v;//normalize(ldir); 1.17 vec3 h = normalize(l + v); 1.18 1.19 - vec3 diff = vec3(0.8, 0.25, 0.2) * max(dot(l, n), 0.0); 1.20 - vec3 spec = vec3(0.6, 0.4, 0.32) * pow(max(dot(h, n), 0.0), 60.0); 1.21 + vec3 diff = vec3(0.8, 0.25, 0.2) * (1.0 - max(dot(l, n), 0.0)); 1.22 + vec3 spec = 0.5 * vec3(0.9, 0.4, 0.3) * pow(max(dot(h, n), 0.0), 10.0); 1.23 1.24 gl_FragColor = vec4(diff + spec, 1.0); 1.25 }