You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
833 B
Plaintext

shader_type spatial;
1 year ago
uniform vec3 target_position = vec3(0, 1.28, 1);
varying vec3 world_position;
1 year ago
uniform vec2 pixel_size = vec2(0.02, 0.02);
void vertex()
{
world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
}
1 year ago
void fragment() {
1 year ago
vec3 c = COLOR.rgb;
float offset_x = floor((world_position.x-target_position.x) / 0.64) * 0.64;
float offset_y = floor((world_position.y-target_position.y) / 0.64) * 0.64;
float offset_z = floor((world_position.z-target_position.z) / 0.64) * 0.64;
float brightness = clamp(1.0 + (offset_y)* 0.4,0.0,1.0);
float contrast = 1.0 - (abs(offset_y)) * 0.05;
float saturation = 1.0 - (abs(offset_y)) * 0.05;
c.rgb = mix(vec3(0.0), c.rgb, brightness);
c.rgb = mix(vec3(0.5), c.rgb, contrast);
c.rgb = mix(vec3(dot(vec3(1.0), c.rgb) * 0.33333), c.rgb, saturation);
ALBEDO = c.rgb;
}