From 412736b9d5a70754c2af3bc9cb8c2b3c58a8785b Mon Sep 17 00:00:00 2001 From: CloudyBuhtz <76739432+CloudyBuhtz@users.noreply.github.com> Date: Sun, 4 May 2025 20:48:31 +0100 Subject: [PATCH] Added warping to hologram shader --- shaders/hologram.gdshader | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/shaders/hologram.gdshader b/shaders/hologram.gdshader index 36b806b..826b795 100644 --- a/shaders/hologram.gdshader +++ b/shaders/hologram.gdshader @@ -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;