36 lines
756 B
Plaintext
36 lines
756 B
Plaintext
shader_type spatial;
|
|
render_mode cull_disabled;
|
|
|
|
instance uniform vec4 color: source_color = vec4(0.2, 0.4, 0.5, 0.75);
|
|
instance uniform float frequency = 1.0;
|
|
instance uniform float wavelength = 1.0;
|
|
instance uniform float amplitude = 1.0;
|
|
|
|
varying float displacement;
|
|
|
|
vec3 project(vec3 a, vec3 b) {
|
|
float m = length(b);
|
|
return dot(a, b)*b/(m*m);
|
|
}
|
|
|
|
void vertex() {
|
|
displacement = (
|
|
sin((frequency*TIME + VERTEX.x/wavelength)*TAU) +
|
|
cos((frequency*TIME + VERTEX.z/wavelength)*TAU)
|
|
)/2.0;
|
|
VERTEX.y += displacement*amplitude;
|
|
}
|
|
|
|
void fragment() {
|
|
float df = (1.0 - displacement)/2.0;
|
|
ALBEDO = color.rgb;
|
|
ALPHA = color.a;
|
|
CLEARCOAT = df;
|
|
CLEARCOAT_ROUGHNESS = df;
|
|
ROUGHNESS = df;
|
|
RIM = df;
|
|
RIM_TINT = df;
|
|
METALLIC = df;
|
|
SPECULAR = 1.0;
|
|
}
|