Simple Energy Shield

A simple energy shield with changeable color.

my socials: https://axilirate.carrd.co/

Shader code
shader_type canvas_item;


uniform vec4 color: hint_color = vec4(1.0);


float circle(vec2 position, float radius, float feather)
{
	return smoothstep(radius, radius + feather, length(position - vec2(0.5)));
}


void fragment(){
	
	float outer = circle(vec2(UV.x, UV.y), 0.35, 0.01);
	
	float fade_effect = sin(TIME) * 0.01;
	
	float inner = 1.0 - circle(vec2(UV.x, UV.y), 0.275, 0.1 - fade_effect );
	
	COLOR = color;
	COLOR.a -= outer + inner;
	
}
Tags
circle shield, energy shield
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

Pixel Perfect outline Shader

Speed Lines Shader for Godot 4

Stylized Sky Shader With Clouds For Godot 4

Related shaders

Simple Energy Shield

Energy Beams

Hexagon Shield

Subscribe
Notify of
guest

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

This shader isn’t working… it hides my main object

Fez
Fez
11 months ago

How do i make it a half circle to use it in a platformer game

samuel
samuel
6 months ago

THis a new shader code for Godot 4.1.2 to work
I change the code of color to uniform vec4 color= vec4(1.0,1.0,1.0,1.0);

shader_type canvas_item;

uniform vec4 color= vec4(1.0,1.0,1.0,1.0);

float circle(vec2 position, float radius, float feather)
{
return smoothstep(radius, radius + feather, length(position – vec2(0.5)));
}

void fragment(){

float outer = circle(vec2(UV.x, UV.y), 0.35, 0.01);

float fade_effect = sin(TIME) * 0.01;

float inner = 1.0 – circle(vec2(UV.x, UV.y), 0.275, 0.1 – fade_effect );

COLOR = color;
COLOR.a -= outer + inner;

}

just_deli
just_deli
6 months ago

Hey i changed the Code a little bit so you can manipulate the values in the shader_parameters, also there is a better color_wheel

shader_type canvas_item;

uniform vec4 color : source_color = vec4(1.0, 1.0, 1.0, 1.0);

float circle(vec2 position, float radius, float feather)
{
return smoothstep(radius, radius + feather, length(position - vec2(0.5)));
}

uniform float outer_radius : hint_range(0,0.7,0.005) = 0.35;
uniform float inner_radius : hint_range(0,0.7,0.005) = 0.275;
uniform float fade_effect_amount : hint_range(0,0.1,0.005) = 0.01;
void fragment(){

float outer = circle(vec2(UV.x, UV.y), outer_radius, 0.01);

float fade_effect = sin(TIME) * fade_effect_amount;

float inner = 1.0 - circle(vec2(UV.x, UV.y), inner_radius, 0.1 - fade_effect );

COLOR = color;
COLOR.a -= outer + inner;

}