metasurf

annotate examples/volume/sdr/frag.glsl @ 4:2c575855f707

added simple example
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Oct 2011 23:21:32 +0300
parents
children
rev   line source
nuclear@3 1 varying vec3 vpos, ldir, norm;
nuclear@3 2
nuclear@3 3 void main()
nuclear@3 4 {
nuclear@3 5 vec3 n = normalize(norm);
nuclear@3 6 vec3 l = normalize(ldir);
nuclear@3 7 vec3 v = -normalize(vpos);
nuclear@3 8 vec3 h = normalize(v + l);
nuclear@3 9
nuclear@3 10 const vec3 kd = vec3(0.87, 0.82, 0.74);
nuclear@3 11
nuclear@3 12 float diff = abs(dot(n, l));
nuclear@3 13 float spec = pow(abs(dot(n, h)), 60.0);
nuclear@3 14
nuclear@3 15 vec3 dcol = kd * diff;
nuclear@3 16 vec3 scol = vec3(0.8, 0.8, 0.8) * spec;
nuclear@3 17
nuclear@3 18 gl_FragColor = vec4(dcol + scol, 1.0);
nuclear@3 19 }