shader_type spatial; render_mode diffuse_burley, specular_disabled; uniform sampler2D limestone : source_color, filter_linear_mipmap_anisotropic, repeat_enable; uniform vec3 stone_color : source_color = vec3(.23, .24, .27); uniform bool build_tile = false; varying vec3 world_position; float grain(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); } void vertex() { world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; } void fragment() { vec2 p = world_position.xz; float fine = grain(floor(p * 38.0)); float slabs = grain(floor(p / 2.0)); vec2 cell = abs(fract(p / 2.0) - .5); float seam = smoothstep(.478, .498, max(cell.x, cell.y)); vec2 edge = min(UV, 1.0 - UV); float rim = 1.0 - smoothstep(.008, .025, min(edge.x, edge.y)); vec3 surface = texture(limestone, p * .26).rgb; ALBEDO = stone_color * (.73 + surface * .6 + slabs * .08); ALBEDO *= 1.0 - seam * (build_tile ? .06 : .35); if (build_tile) { ALBEDO += vec3(.045, .055, .040) * rim; } ROUGHNESS = .93; }