dungeon_crawler

annotate prototype/sdr/multi2.p.glsl @ 74:5981917093ff

color grading palette output done, all is left is the input
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 21 Oct 2012 15:56:47 +0300
parents
children
rev   line source
nuclear@60 1 /* multipass renderer shader 2: RGB: diffuse color, A: shininess str. */
nuclear@60 2
nuclear@60 3 uniform sampler2D tex_dif;
nuclear@60 4
nuclear@60 5 varying vec3 pos, norm, tang;
nuclear@60 6
nuclear@60 7 const float fog_start = 3.0;
nuclear@60 8 const float fog_end = 6.0;
nuclear@60 9
nuclear@60 10 void main()
nuclear@60 11 {
nuclear@60 12 float fog = clamp((fog_end + pos.z) / (fog_end - fog_start), 0.0, 1.0);
nuclear@60 13
nuclear@60 14 vec4 texel = texture2D(tex_dif, gl_TexCoord[0].st);
nuclear@60 15 vec3 diffuse = fog * (gl_FrontMaterial.diffuse * texel).xyz;
nuclear@60 16 vec3 spec = fog * gl_FrontMaterial.specular.xyz;
nuclear@60 17 float sstr = (spec.x + spec.y + spec.z) / 3.0;
nuclear@60 18
nuclear@60 19 gl_FragColor = vec4(diffuse, sstr);
nuclear@60 20 }