Randoloot/resources/effects/mineral_deposit.gdshader
2026-10-18 15:11:06 +02:00

16 lines
642 B
Plaintext

shader_type canvas_item;
uniform vec4 ground_tint : source_color = vec4(0.3,0.32,0.22,1.0);
varying vec4 vertex_tint;
void vertex() { vertex_tint=COLOR; }
void fragment() {
vec4 ore=texture(TEXTURE,UV);
float radius=length((UV-vec2(0.5))*vec2(2.0,2.25));
float fringe=smoothstep(0.40,0.82,radius);
float feather=1.0-smoothstep(0.65,0.96,radius);
float luminosity=dot(ore.rgb,vec3(0.299,0.587,0.114));
vec3 soil=ground_tint.rgb*(0.60+luminosity*0.85);
// Only the dispersed soil rim changes hue; the central ore stays legible.
vec3 color=mix(ore.rgb,soil,fringe*0.66);
COLOR=vec4(color*vertex_tint.rgb,ore.a*vertex_tint.a*feather);
}