3D burn dissolve

A dissolve shader with a burn effect for 3D models. Add a SimplexNoise to Dissolve Texture

This shader comes from GD Quest’s library of free shaders.

Shader code
shader_type spatial;
render_mode depth_draw_alpha_prepass, cull_disabled;

uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;

uniform vec4 emission_color : hint_color = vec4(1);
uniform float emission_amount;

uniform sampler2D dissolve_texture;
uniform float burn_size : hint_range(0,2);
uniform float dissolve_amount : hint_range(0,1);


void fragment() {
	vec4 albedo_tex = texture(texture_albedo,UV);
	ALBEDO = albedo.rgb * albedo_tex.rgb;
	
	float sample = texture(dissolve_texture, UV).r;
	float emission_value = 1.0 - smoothstep(dissolve_amount, dissolve_amount + burn_size, sample);
	EMISSION = vec3(emission_value * emission_amount * emission_color.rgb);
	ALPHA = smoothstep(dissolve_amount - burn_size, dissolve_amount, sample);
}
Tags
burn, dissolve
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 hancan

2D outline stroke

Waving flag

Related shaders

Burn/Dissolve

2D dissolve with burn edge

燃烧/burn 2d

Subscribe
Notify of
guest

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Karl
Karl
1 year ago

Godot 4 version

shader_type spatial;
render_mode depth_prepass_alpha, cull_disabled;

uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : hint_default_white;

uniform vec4 emission_color : source_color = vec4(1);
uniform float emission_amount;

uniform sampler2D dissolve_texture;
uniform float burn_size : hint_range(0,2);
uniform float dissolve_amount : hint_range(0,1);

void fragment() {
   vec4 albedo_tex = texture(texture_albedo,UV);
   ALBEDO = albedo.rgb * albedo_tex.rgb;

   float sample = texture(dissolve_texture, UV).r;
   float emission_value = 1.0 – smoothstep(dissolve_amount, dissolve_amount + burn_size, sample);
   EMISSION = vec3(emission_value * emission_amount * emission_color.rgb);
   ALPHA = smoothstep(dissolve_amount – burn_size, dissolve_amount, sample);
}

Michael
Michael
1 year ago

I had to use depth_draw_always instead of depth_prepass_alpha to get transparency to work in Godot 4 (4.0.stable).

Last edited 1 year ago by Michael
Karl
Karl
1 year ago
Reply to  Michael

You’re right, I had put the transparency on in the Geometry, with that at zero you get no transparency with my version. But using depth_draw_always works all the time.