dungeon_crawler

view prototype/sdr/multi2.p.glsl @ 60:aa86119e3295

added multipass deferred
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Sep 2012 06:19:37 +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 }