More Advanced “Simple 2D dissolve”
A more advanced version of Simple 2D Dissolve that has more paramators for control over your shader, pretty simply you can control the order it disolves without having to create a custom texture,
- Dissolve Value
- controls how much of the texture is dissolved
- Mix Ratio
- controls the ratio of mixing, with 0 being all dissolve_noise and 1 being all dissolve_gradient
- Dissolve Noise
- noise texture* to control the pattern of dissolve
- Dissolve Gradient
- gradient texture* to control the pattern of dissolve
*you can use any texture, the shader just mixes the 2 with Mix Ratio as the factor
Shader code
shader_type canvas_item;
uniform float dissolve_value : hint_range(0.0, 1.0);
uniform float mix_ratio : hint_range(0, 1.0);
uniform sampler2D dissolve_noise;
uniform sampler2D dissolve_gradient;
void fragment() {
vec4 main_texture = texture(TEXTURE, UV);
vec4 a = texture(dissolve_noise, UV);
vec4 b = texture(dissolve_gradient, UV);
vec4 noise_texture = mix(a,b, mix_ratio);
main_texture.a *= floor(dissolve_value + min(1, noise_texture.x));
COLOR = main_texture;
}
