Simple 2D dissolve

A simple dissolve shader. Add a SimplexNoise or any texture to Dissolve Texture to define the dissolve pattern.

Shader code
shader_type canvas_item;

uniform sampler2D dissolve_texture : hint_albedo;
uniform float dissolve_value : hint_range(0,1);

void fragment(){
    vec4 main_texture = texture(TEXTURE, UV);
    vec4 noise_texture = texture(dissolve_texture, UV);
    main_texture.a *= floor(dissolve_value + min(1, noise_texture.x));
    COLOR = main_texture;
}
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 godotshaders

Invert color

2D wind sway

2D fire

Related shaders

2D Burn/dissolve with direction (V 1.0)

Dissolve/Add details Pixel Art

Pixelated Dissolve with Block Size

guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
RafaFiedo
4 years ago

It’s a great simple shader!

Here you can find usage and explanation of how it is working
https://youtu.be/vz5VkRyDH54

niwho
2 years ago
 main_texture.a  = step(dissolve_value , dissovle);// another simple way
Alkaliii
2 years ago

4 Godot 4

shader_type canvas_item;

uniform sampler2D dissolve_texture : source_color;
uniform float dissolve_value : hint_range(0.0,1.0);

void fragment(){
    vec4 main_texture = texture(TEXTURE, UV);
    vec4 noise_texture = texture(dissolve_texture, UV);
    main_texture.a *= floor(dissolve_value + min(1, noise_texture.x));
    COLOR.a *= main_texture.a;
}
Warp Wizard
Warp Wizard
1 year ago

A beginner here.

I’m using this shader to dissolve a label. The text of a Label is set to a certain color. When I set up the shader it changes it to white. I’ve tried many things to change it back to the desired color and nothing works.

I’ve even tried setting it in the shader code, which works, but then the dissolve effect doesn’t work.

Any help would be appreciated! Thanks.