metasurf
view examples/metaballs/sdr/frag.glsl @ 11:430d8dde62aa
random changes
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 23 Aug 2015 07:17:56 +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 }