dungeon_crawler

annotate prototype/sdr/post.p.glsl @ 78:12a1dcfe91fa

gamma correct rendering
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 26 Oct 2012 21:22:14 +0300
parents d89b403f630b
children
rev   line source
nuclear@65 1 uniform sampler2D fbtex;
nuclear@72 2 uniform sampler3D paltex;
nuclear@65 3
nuclear@65 4 void main()
nuclear@65 5 {
nuclear@72 6 // lookup the render output color for this pixel
nuclear@77 7 vec4 fbcolor = texture2D(fbtex, gl_TexCoord[0].st);
nuclear@77 8 vec3 tc = (fbcolor.xyz * 15.0 + 0.5) / 16.0;
nuclear@72 9 // use that color as an index into the palette
nuclear@77 10 vec3 color = texture3D(paltex, tc).xyz;
nuclear@77 11 // gamma-correction
nuclear@78 12
nuclear@78 13 gl_FragColor = vec4(color, fbcolor.a);
nuclear@78 14 //gl_FragColor = vec4(pow(color, 1.0 / 2.2), fbcolor.a);
nuclear@78 15 //gl_FragColor = vec4(sqrt(color), fbcolor.a);
nuclear@65 16 }