dungeon_crawler

view prototype/sdr/multi2.p.glsl @ 65:fc2b3d06d07c

made the deferred renderer draw into a texture, so that I can reuse the depth buffer for geometric post effects (particles), and implement other per-pixel post effects eventually
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 02 Oct 2012 13:42:18 +0300
parents
children
line source
1 /* multipass renderer shader 2: RGB: diffuse color, A: shininess str. */
3 uniform sampler2D tex_dif;
5 varying vec3 pos, norm, tang;
7 const float fog_start = 3.0;
8 const float fog_end = 6.0;
10 void main()
11 {
12 float fog = clamp((fog_end + pos.z) / (fog_end - fog_start), 0.0, 1.0);
14 vec4 texel = texture2D(tex_dif, gl_TexCoord[0].st);
15 vec3 diffuse = fog * (gl_FrontMaterial.diffuse * texel).xyz;
16 vec3 spec = fog * gl_FrontMaterial.specular.xyz;
17 float sstr = (spec.x + spec.y + spec.z) / 3.0;
19 gl_FragColor = vec4(diffuse, sstr);
20 }