2025-05-04 18:13:08 +01:00
|
|
|
shader_type spatial;
|
2025-05-04 20:48:31 +01:00
|
|
|
render_mode blend_mix, depth_prepass_alpha, cull_disabled; // blend_add
|
2025-05-04 18:13:08 +01:00
|
|
|
|
|
|
|
uniform vec4 albedo_color : source_color;
|
2025-05-04 20:48:31 +01:00
|
|
|
|
|
|
|
group_uniforms warp;
|
|
|
|
uniform bool enable_warp = false;
|
|
|
|
uniform vec3 warp_vector = vec3(1.0, 1.0, 1.0);
|
|
|
|
uniform float warp_strength : hint_range(0.0, 1.0) = 0.5;
|
|
|
|
uniform float warp_rate : hint_range(0.0, 200.0) = 0.5;
|
|
|
|
|
2025-05-04 18:13:08 +01:00
|
|
|
instance uniform float built_amount = 2.0;
|
|
|
|
|
|
|
|
varying float model_y;
|
|
|
|
|
|
|
|
// Called for every vertex the material is visible on.
|
|
|
|
void vertex() {
|
|
|
|
model_y = VERTEX.y;
|
2025-05-04 20:48:31 +01:00
|
|
|
if (enable_warp && VERTEX.y > built_amount) {
|
|
|
|
float offset = sin(pow(VERTEX.y, 2) * warp_rate * TIME) * pow(warp_strength, 2);
|
|
|
|
VERTEX += offset * warp_vector;
|
|
|
|
}
|
2025-05-04 18:13:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Called for every pixel the material is visible on.
|
|
|
|
void fragment() {
|
2025-05-04 20:48:31 +01:00
|
|
|
float base_opacity = 0.2;
|
2025-05-04 18:13:08 +01:00
|
|
|
|
|
|
|
if (model_y > built_amount) {
|
|
|
|
ALPHA = base_opacity;
|
|
|
|
} else {
|
|
|
|
ALPHA = 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ALBEDO.rgb = albedo_color.rgb;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called for every pixel for every light affecting the material.
|
|
|
|
//void light() {
|
|
|
|
//}
|