Pixel Circle & Ellipse
A pixelated circle, pure and simple. Great for pixel art. You can modify and use this for:
- Fake Shadows
- Base for other more complex shaders
- Bullets
- … and much more!
How to use:
- Drag and Drop Godot Icon into the 2D viewport (add it to the game).
- Apply this shader to the godot icon.
- Change its parameter shaders
- Color and alpha
- Elipse Factor (45 for a circle)
- Radius
It’s a circle, go nuts.
Inspired by https://godotshaders.com/shader/circular-life-bar/
Shader code
// Released under MIT License, Tengku Izdihar, 2025
shader_type canvas_item;
uniform float radius :hint_range(0, 1) = 0.05;
uniform vec4 circle_color : source_color = vec4(1);
uniform float elipse_factor :hint_range(0, 90) = 60;
void fragment(){
vec2 pixelNumber = vec2(textureSize(TEXTURE, 0));
vec2 pixelated_UV = round(UV * pixelNumber) / pixelNumber;
vec2 uv = (pixelated_UV * 2.0 - 1.0);
float ef = radians(elipse_factor);
uv.x *= cos(ef);
uv.y *= sin(ef);
float circle = ceil(length(uv) - radius);
circle = 1. - circle;
circle = clamp(circle, 0, circle_color.a);
COLOR = circle_color;
COLOR.a = circle;
}