Simple Ellipse Shader

minimal code to get you started in whatever you need

Shader code
shader_type canvas_item;


uniform float height: hint_range(0.0, 1.0, 0.1) = 1.0;
uniform float width: hint_range(0.0, 1.0, 0.1) = 1.0;


void fragment() {
	float shrink_width = 2.0 / width;
	float shrink_height = 2.0 / height;
	float dist = distance(vec2(UV.x * shrink_width, UV.y * shrink_height), vec2(0.5 * shrink_width, 0.5 * shrink_height));
	COLOR.a = 1.0 - floor(dist);
}
Tags
circle, Ellipse
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 axilirate

Simple Energy Shield

Speed Lines Shader for Godot 4

Stylized Sky Shader With Clouds For Godot 4

Related shaders

Ellipse with customizable size, position, rotation, color

Pixel Circle & Ellipse

Simple Shadow Shader for 2D Sprites

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments