metasurf

diff examples/metaballs/sdr/frag.glsl @ 0:7aa4627e492b

first commit
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Oct 2011 07:34:31 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/examples/metaballs/sdr/frag.glsl	Tue Oct 25 07:34:31 2011 +0300
     1.3 @@ -0,0 +1,19 @@
     1.4 +varying vec3 vpos, ldir, norm;
     1.5 +
     1.6 +void main()
     1.7 +{
     1.8 +	vec3 n = normalize(norm);
     1.9 +	vec3 l = normalize(ldir);
    1.10 +	vec3 v = -normalize(vpos);
    1.11 +	vec3 h = normalize(v + l);
    1.12 +
    1.13 +	const vec3 kd = vec3(0.42, 0.6, 0.43);
    1.14 +
    1.15 +	float diff = abs(dot(n, l));
    1.16 +	float spec = pow(abs(dot(n, h)), 60.0);
    1.17 +
    1.18 +	vec3 dcol = kd * diff;
    1.19 +	vec3 scol = vec3(0.8, 0.8, 0.8) * spec;
    1.20 +
    1.21 +	gl_FragColor = vec4(dcol + scol, 1.0);
    1.22 +}