metasurf
view examples/metaballs/sdr/frag.glsl @ 9:1fd80c90d566
added website in the readme file
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 17 Apr 2014 13:46:04 +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 }