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;
}

Hi, I’m really new to shaders but I want to use this one to make a fake 2D shadow circle around my cursor (I’m making a spooky point-and-click game). I got a couple of questions:
First: how do I make those”radius”, “circle_color” and “eclipse_factor” properties shown in your preview appear in my Inspector?
Second: any idea how I can make the circle color be transparent and everything outside the circle be black?
I figured out how to reverse the color to the outside of the circle, now Im trying to understand how to move the circle to the position of my mouse cursor, since its a spooky point and click game, I want the fake light to illuminate the area around the cursor.
I think its something with:
but not sure how to use this. should I send the position of the center of the radius to a gdscript script with get_global_mouse_position() ?