First, the shader from GDQUEST!
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);
}
I think the shader is good. I and watched the example and it works. What I don't understand, is how this script is working. I understand the math behind it, but I can't figure out how it's keeping the fading and emmision progressing. Should it be adding the value onto EMISSION and ALPHA, rather than having an assign operator?