Files

16 lines
695 B
Plaintext
Raw Permalink Normal View History

shader_type spatial;
uniform sampler2D stone_tex : source_color, filter_linear_mipmap_anisotropic, repeat_enable;
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 b=pow(abs(wn),vec3(8.0));b/=max(dot(b,vec3(1.0)),0.001);
vec3 t=texture(stone_tex,wp.xz*.5).rgb*b.y+texture(stone_tex,wp.xy*.4).rgb*b.z+texture(stone_tex,wp.zy*.4).rgb*b.x;
vec2 q=abs(wn.y)>.7?wp.xz:vec2(abs(wn.x)>.7?wp.z:wp.x,wp.y*1.7);
q.x+=mod(floor(q.y),2.0)*.5;
vec2 edge=min(fract(q),1.0-fract(q));
float grout=smoothstep(.015,.045,min(edge.x,edge.y));
ALBEDO=mix(vec3(.045,.042,.035),t*.85,grout);
ROUGHNESS=.82;
}