Pixelate

A very simple pixel effect. Add the shader to a Sprite node with a set texture. Use the ‘Amount’ parameter to set the pixel size.

Shader code
/*
Shader from Godot Shaders - the free shader library.
godotshaders.com/shader/pixelate

This shader is under CC0 license. Feel free to use, improve and 
change this shader according to your needs and consider sharing 
the modified result to godotshaders.com.
*/

shader_type canvas_item;

uniform int amount = 40;

void fragment()
{
	vec2 grid_uv = round(UV * float(amount)) / float(amount);
	
	vec4 text = texture(TEXTURE, grid_uv);
	
	COLOR = text;
}
Tags
old, pixel, retro
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from godotshaders

2D wind sway

2D fire

Simple 2D dissolve

Related shaders

Pixelate

Palette Filter and Pixelate combined

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
rainlizard
rainlizard
5 months ago

Use textureLod 0 if you get lines around each pixel.