oculus1

view sdr/phong.p.glsl @ 16:f3672317e5c2

made teapots many sizes and more colorful, added phong shader
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 21 Sep 2013 05:22:48 +0300
parents
children
line source
1 varying vec3 vpos, norm, ldir;
3 void main()
4 {
5 vec3 v = -normalize(vpos);
6 vec3 n = normalize(norm);
7 vec3 l = normalize(ldir);
8 vec3 h = normalize(v + l);
10 float ndotl = max(dot(n, l), 0.0);
11 float ndoth = max(dot(n, h), 0.0);
13 vec3 diff = gl_FrontMaterial.diffuse.rgb * gl_LightSource[0].diffuse.rgb * ndotl;
14 vec3 spec = gl_FrontMaterial.specular.rgb * gl_LightSource[0].specular.rgb *
15 pow(ndoth, gl_FrontMaterial.shininess);
17 gl_FragColor.rgb = diff + spec;
18 gl_FragColor.a = 1.0;
19 }