Files
Diabolo/Demon_v0.19/burn.gdshader
T

21 lines
709 B
Plaintext

shader_type spatial;
render_mode cull_back;
uniform vec4 base_color:source_color=vec4(0.4,0.3,0.3,1);
uniform float progress=0.0;
uniform float base_y=0.0;
uniform sampler2D albedo_texture:source_color,filter_linear_mipmap;
uniform bool use_texture=false;
varying vec3 wp;
void vertex(){wp=(MODEL_MATRIX*vec4(VERTEX,1.0)).xyz;}
void fragment(){
float n=sin(wp.x*37.0+wp.z*23.0)*sin(wp.y*43.0)*0.09;
float edge=wp.y-base_y+n-progress*3.4;
if(edge<0.0) discard;
float glow=1.0-smoothstep(0.0,0.3,edge);
vec3 original=base_color.rgb;
if(use_texture){original*=texture(albedo_texture,UV).rgb;}
ALBEDO=mix(original,vec3(0.08,0.015,0.012),progress);
EMISSION=vec3(1.0,0.15,0.01)*glow*4.0;
ROUGHNESS=0.9;
}