19 lines
924 B
Plaintext
19 lines
924 B
Plaintext
|
|
shader_type spatial;
|
||
|
|
render_mode unshaded;
|
||
|
|
varying vec3 wp;
|
||
|
|
float hash(vec2 p){vec3 q=fract(vec3(p.xyx)*0.1031);q+=dot(q,q.yzx+33.33);return fract((q.x+q.y)*q.z);}
|
||
|
|
float noise(vec2 p){vec2 i=floor(p);vec2 f=fract(p);f=f*f*(3.0-2.0*f);return mix(mix(hash(i),hash(i+vec2(1,0)),f.x),mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);}
|
||
|
|
void vertex(){wp=(MODEL_MATRIX*vec4(VERTEX,1.0)).xyz;}
|
||
|
|
void fragment(){
|
||
|
|
vec2 p=wp.xz*3.5; p+=vec2(TIME*0.16,-TIME*0.09);
|
||
|
|
vec2 warp=vec2(noise(p*0.6+TIME*0.09),noise(p*0.6+vec2(8.4,2.8)));
|
||
|
|
float v=noise(p+warp*2.5)*0.7+noise(p*2.0+warp)*0.3;
|
||
|
|
float crust=smoothstep(0.38,0.61,v);
|
||
|
|
float hot=1.0-smoothstep(0.16,0.34,v);
|
||
|
|
vec3 c=mix(vec3(0.62,0.035,0.002),vec3(1.0,0.30,0.012),hot);
|
||
|
|
c=mix(c,vec3(0.055,0.012,0.018),crust);
|
||
|
|
float stream=pow(0.5+0.5*sin(wp.z*2.4+wp.x*0.8-TIME*1.4+warp.x*5.0),12.0);
|
||
|
|
c+=vec3(0.35,0.10,0.008)*stream*(1.0-crust);
|
||
|
|
ALBEDO=c*.45; EMISSION=c*(0.15+hot*0.40);
|
||
|
|
}
|