mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
11 lines
No EOL
351 B
Text
11 lines
No EOL
351 B
Text
group_uniforms uv_pixelate;
|
|
uniform int uv_pixelate_size: hint_range(4, 512) = 32;
|
|
group_uniforms;
|
|
|
|
vec2 uv_pixelate(vec2 uv, vec2 viewport_size)
|
|
{
|
|
float aspect_ratio = viewport_size.x / viewport_size.y;
|
|
vec2 pixel_size = vec2(float(uv_pixelate_size), float(uv_pixelate_size) * aspect_ratio);
|
|
uv = floor(uv * pixel_size) / pixel_size;
|
|
return uv;
|
|
} |