Added warping to hologram shader

This commit is contained in:
CloudyBuhtz 2025-05-04 20:48:31 +01:00
parent 4a5304d949
commit 412736b9d5
1 changed files with 13 additions and 2 deletions

View File

@ -1,7 +1,14 @@
shader_type spatial;
render_mode blend_mix, depth_prepass_alpha;
render_mode blend_mix, depth_prepass_alpha, cull_disabled; // blend_add
uniform vec4 albedo_color : source_color;
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;
instance uniform float built_amount = 2.0;
varying float model_y;
@ -9,11 +16,15 @@ varying float model_y;
// Called for every vertex the material is visible on.
void vertex() {
model_y = VERTEX.y;
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;
}
}
// Called for every pixel the material is visible on.
void fragment() {
float base_opacity = 0.25;
float base_opacity = 0.2;
if (model_y > built_amount) {
ALPHA = base_opacity;