25 lines
804 B
Plaintext
25 lines
804 B
Plaintext
shader_type spatial;
|
|
render_mode specular_disabled;
|
|
uniform vec3 albedo : source_color = vec3(0.8, 0.72, 0.52);
|
|
uniform float paint_strength : hint_range(0.0, 0.2) = 0.04;
|
|
varying vec3 paint_position;
|
|
|
|
void vertex() {
|
|
paint_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
|
}
|
|
|
|
void fragment() {
|
|
float brush = sin(paint_position.x * 2.1 + sin(paint_position.y * 3.0)) * sin(paint_position.z * 2.8 + paint_position.y);
|
|
ALBEDO = albedo * (1.0 + brush * paint_strength);
|
|
ROUGHNESS = 1.0;
|
|
}
|
|
|
|
void light() {
|
|
float ndl = dot(NORMAL, LIGHT);
|
|
float middle = smoothstep(-0.10, 0.03, ndl);
|
|
float sunny = smoothstep(0.48, 0.58, ndl);
|
|
vec3 shade = mix(vec3(0.26, 0.34, 0.40), vec3(0.74), middle);
|
|
shade = mix(shade, vec3(1.0, 0.97, 0.88), sunny);
|
|
DIFFUSE_LIGHT += shade * ATTENUATION * LIGHT_COLOR / PI;
|
|
}
|