vrshoot

view sdr/default.p.glsl @ 1:e7ca128b8713

looks nice :)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 00:35:22 +0200
parents
children
line source
1 varying vec3 vpos, norm;
2 varying vec2 texcoord;
4 void main()
5 {
6 vec3 n = normalize(norm);
7 vec3 ldir = normalize(vec3(-0.5, 0.5, 2));
9 float ndotl = max(dot(n, ldir), 0.0);
11 vec3 color = vec3(0.8, 0.8, 0.8) * ndotl;
13 float hpat = smoothstep(0.49, 0.5, mod(texcoord.x * 8.0, 1.0));
14 float vpat = smoothstep(0.49, 0.5, mod(texcoord.y * 8.0, 1.0));
16 float pattern = 0.0;
17 if((hpat > 0.5 && vpat > 0.5) || (hpat < 0.5 && vpat < 0.5)) {
18 pattern = 1.0;
19 } else {
20 pattern = 0.0;
21 }
23 vec3 tex = vec3(pattern * 0.5 + 0.5);
26 gl_FragColor.rgb = color * tex;
27 gl_FragColor.a = 1.0;
28 }