Add a vignette to simulate a real camera
This commit is contained in:
parent
4fd6d29462
commit
4b92ee1716
@ -14,13 +14,13 @@ varying vec2 uv;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 texc = uv;
|
vec4 col = texture(tex, uv);
|
||||||
//texc.y = 1.0 - texc.y;
|
|
||||||
|
|
||||||
|
// Compute the vignette
|
||||||
vec4 col = texture(tex, texc);
|
vec2 inside = uv - 0.5;
|
||||||
|
float vignette = 1 - dot(inside, inside);
|
||||||
//col = col / (1 - col);
|
vignette = clamp(pow(vignette, 0.8), 0, 1);
|
||||||
|
vignette = vignette + vignette - 0.5;
|
||||||
|
|
||||||
float inBlack = inlevel.x;
|
float inBlack = inlevel.x;
|
||||||
float inWhite = inlevel.z;
|
float inWhite = inlevel.z;
|
||||||
@ -32,5 +32,5 @@ void main()
|
|||||||
col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
||||||
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
|
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
|
||||||
|
|
||||||
FragColor = vec4(col.rgb, 1.0);
|
FragColor = vec4(col.rgb * vignette, 1.0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user