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

Fire effect

Pixel transition

Related shaders

Pixelate

Palette Filter and Pixelate combined

Pixelate into view (Texture Resolution)

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
rainlizard
2 years ago

Use textureLod 0 if you get lines around each pixel.

CenTdemeern1
1 year ago
Reply to  rainlizard

Oh my god you’re a life saver