metasurf
view examples/metaballs/sdr/frag.glsl @ 3:52664d3451ad
added volume rendering example
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 25 Oct 2011 13:30:03 +0300 |
parents | |
children |
line source
1 varying vec3 vpos, ldir, norm;
3 void main()
4 {
5 vec3 n = normalize(norm);
6 vec3 l = normalize(ldir);
7 vec3 v = -normalize(vpos);
8 vec3 h = normalize(v + l);
10 const vec3 kd = vec3(0.42, 0.6, 0.43);
12 float diff = abs(dot(n, l));
13 float spec = pow(abs(dot(n, h)), 60.0);
15 vec3 dcol = kd * diff;
16 vec3 scol = vec3(0.8, 0.8, 0.8) * spec;
18 gl_FragColor = vec4(dcol + scol, 1.0);
19 }