Files

16 lines
810 B
Plaintext
Raw Permalink Normal View History

shader_type spatial;
uniform sampler2D stone_tex : source_color, filter_linear_mipmap_anisotropic, repeat_enable;
uniform vec4 tint : source_color = vec4(0.45,0.42,0.48,1.0);
varying vec3 wp;
varying vec3 wn;
void vertex(){wp=(MODEL_MATRIX*vec4(VERTEX,1.0)).xyz; wn=normalize(mat3(MODEL_MATRIX)*NORMAL);}
void fragment(){
vec3 blend=pow(abs(wn),vec3(4.0)); blend/=max(dot(blend,vec3(1)),0.001);
vec3 tex=texture(stone_tex,wp.zy*0.32).rgb*blend.x+texture(stone_tex,wp.xz*0.32).rgb*blend.y+texture(stone_tex,wp.xy*0.32).rgb*blend.z;
float bevel=step(0.1,wn.y)*(1.0-step(0.98,wn.y));
ALBEDO=mix(tex,vec3(dot(tex,vec3(0.333))),0.5)*tint.rgb*3.0+vec3(0.015)*bevel;
float damp=smoothstep(.3,.85,sin(wp.x*.8+sin(wp.z*.6))*.5+.5)*step(.7,wn.y);
ALBEDO*=1.0-damp*.18;
ROUGHNESS=mix(.90,.65,damp);SPECULAR=.22;
}