2D shader: Out of body ghost effect (Pixel Art)

Create this awsome out of body ghost effect using a 2D canvas item shader. See video for instructions.

# Learn how to create 2D shaders like these

Want to master 2D shaders? Learn how to create stunning effects like these and more by gaining a deep understanding of the GDShader language in Godot:

https://godot2dshaders.com/

Shader code
shader_type canvas_item;

uniform float ghost_progress: hint_range(0.0, 1.0);

void fragment() {
	// Set original color pallete to purple
	vec3 purple_swizzle = COLOR.gbr;
	vec4 base_joe_tex = vec4(purple_swizzle, COLOR.a);

	// UV mapping to 'move texture up'
	vec2 fly_up_uv = vec2(UV.x, UV.y + ghost_progress / 2.0);
	// Sample color data from texture
	float mipmap_index = ghost_progress * 4.5;
	vec4 ghost_tex = textureLod(TEXTURE, fly_up_uv, mipmap_index);
	
	// Set ghost like propperties: light color and transparency
	ghost_tex.rgb = ghost_tex.rrr * 1.7;
	float ghost_opacity = 0.8;
	ghost_tex.a *= ghost_opacity - ghost_opacity * ghost_progress;
	
	COLOR.rgba = mix(ghost_tex.rgba, base_joe_tex.rgba, COLOR.a);
}
Tags
2d character shader, ability shader, ghost, on death effect, on death vfx, out of body, pixel art effect, pixel-art, vfx effect
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from GodotShaderBoy

Simple Thin Outline

Simple medium thick outline

The simplest outline shader (canvas_item)

Related shaders

Pixel Art Water

Sprite Water Reflection Pixel Art Pokémon Style

RotSprite-Like Algorithm for Cleaner Pixel Art Rotation

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments