Improved shaders_postprocessing example
This commit is contained in:
parent
c9d6b7e356
commit
65e6a6db53
1 changed files with 29214 additions and 26979 deletions
|
|
@ -13,7 +13,7 @@ uniform vec4 colDiffuse;
|
|||
// NOTE: Add here your custom variables
|
||||
|
||||
void main()
|
||||
{
|
||||
{
|
||||
vec3 color = texture2D(texture0, fragTexCoord).rgb;
|
||||
vec3 colors[3];
|
||||
colors[0] = vec3(0.0, 0.0, 1.0);
|
||||
|
|
@ -21,10 +21,11 @@ void main()
|
|||
colors[2] = vec3(1.0, 0.0, 0.0);
|
||||
|
||||
float lum = (color.r + color.g + color.b)/3.0;
|
||||
|
||||
vec3 tc = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
int ix = (lum < 0.5)? 0:1;
|
||||
|
||||
vec3 tc = mix(colors[ix], colors[ix+1], (lum-float(ix)*0.5)/0.5);
|
||||
|
||||
if (lum < 0.5) tc = mix(colors[0], colors[1], lum/0.5);
|
||||
else tc = mix(colors[1], colors[2], (lum - 0.5)/0.5);
|
||||
|
||||
gl_FragColor = vec4(tc, 1.0);
|
||||
}
|
||||
Loading…
Reference in a new issue