metasurf

diff examples/volume/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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/examples/volume/sdr/frag.glsl	Tue Oct 25 13:30:03 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.87, 0.82, 0.74);
    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 +}