Simple Energy Shield

Simple 3D shader to create a force-field effect inspired by Faultless Defense from Guilty Gear Xrd.

It’s put on a sphere in the screenshots but it should work on any kind of mesh (applying it to character models creates a ghost-like effect)

Has adjustable parameters for base color, emission color, emission strength, and rim steepness.

Shader code
shader_type spatial;
//Simple 3D shader to create a force-field effect inspired by Faultless Defense from Guilty Gear Xrd.
//In summary, it takes logic used for simple rim lighting and uses it to create the alpha instead.

render_mode blend_mix,depth_draw_always,cull_back,diffuse_burley,specular_schlick_ggx;//depth_test_disable;
uniform vec4 albedo : hint_color;
uniform vec4 emission_color : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float emission_amount: hint_range(0.0, 16.0) = 5.0f; 
uniform float rim_steepness : hint_range(0.0f, 16.0f) = 3.0f; //higher values mean a smaller rim.
uniform vec3 uv_scale;
uniform vec3 uv_offset;


void vertex() {
	UV=UV*uv_scale.xy+uv_offset.xy;
}

void fragment() {
	vec2 base_uv = UV;
	vec4 albedo_tex = texture(texture_albedo,base_uv);
	ALBEDO = albedo.rgb * albedo_tex.rgb;
	EMISSION = emission_color.rgb * emission_amount;
	float PI = 3.14159265359;
	float NdotV = dot(NORMAL, VIEW);
	float rim_light = pow(1.0 - NdotV, rim_steepness);
	ALPHA = rim_light * emission_color.a / PI;
}
Tags
block, bubble, energy, energy bubble, energy shield, faultless defence, faultless defense, force, force field, force shield, ghost, glow, rim, Shield, soul, souls, specter, spectre, spirit
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.

Related shaders

Simple Energy Shield

Energy Beams

Shield with impact waves

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Lamery
Lamery
5 months ago

I’m porting a Roblox game to Godot, and this shader works wonderfully for replicating Roblox’s ForceField material.