pixelated

This commit is contained in:
Piotr 2020-09-27 16:56:49 +02:00
parent 50e791a3fb
commit 9a156ecbec
1 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,9 @@ uniform float screen_width;
uniform float screen_height; uniform float screen_height;
uniform sampler2D screenTexture; uniform sampler2D screenTexture;
uniform float pixelWidth = 3.0;
uniform float pixelHeight = 3.0;
void main() void main()
{ {
vec2 uv = TexCoords.xy; vec2 uv = TexCoords.xy;
@ -14,6 +17,12 @@ void main()
float vig = uv.x*uv.y * 15.0; float vig = uv.x*uv.y * 15.0;
vig = pow(vig, 0.3); vig = pow(vig, 0.3);
float dx = pixelWidth*(1.0/screen_width);
float dy = pixelHeight*(1.0/screen_height);
FragColor = texture(screenTexture, TexCoords) * vig; vec2 coord = vec2(dx*floor(TexCoords.x/dx), dy*floor(TexCoords.y/dy));
vec3 tc = texture(screenTexture, coord).rgb;
FragColor = vec4(tc,1.0) * vig;
} }