dungeon_crawler
view 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 |
line source
1 uniform sampler2D fbtex;
2 uniform sampler3D paltex;
4 void main()
5 {
6 // lookup the render output color for this pixel
7 vec4 fbcolor = texture2D(fbtex, gl_TexCoord[0].st);
8 vec3 tc = (fbcolor.xyz * 15.0 + 0.5) / 16.0;
9 // use that color as an index into the palette
10 vec3 color = texture3D(paltex, tc).xyz;
11 // gamma-correction
13 gl_FragColor = vec4(color, fbcolor.a);
14 //gl_FragColor = vec4(pow(color, 1.0 / 2.2), fbcolor.a);
15 //gl_FragColor = vec4(sqrt(color), fbcolor.a);
16 }