Simplified 3D Wave Effect
Gradient-Based Wave Effect for quick VFX or general usage. I’ve used it to make some simple Electric Effects.
All examples used a PlaneMesh with Subdivide Width=10
and Subdivide Depth=10
or more.
Video Example (Old)
⚡️Shader Showcase⚡️
A quick electric wave effect with some customization.
Once you use AnimationPlayer to tween the size and shape, you got a good start.#Astraheim #GodotEngine #madewithgodot #indiegame pic.twitter.com/k11ge2aQ9I
— Vesper (@Vesperibus) March 5, 2024
Shader code
// Credits
// Made by Vesper | https://vesperum.itch.io/ | https://twitter.com/Vesperibus
// Enjoy!
shader_type spatial;
render_mode unshaded, cull_back;
group_uniforms Wave;
uniform float x_deviation = 0.2;
uniform float x_deviation_random = 0.2;
uniform float z_deviation = 0.2;
uniform float z_deviation_random = 0.2;
// I recommend using uv values above 10 for a good spread
// It loops back when using high numbers so don't bother going above 200
uniform vec2 uv_scale = vec2(10.0, 0.0);
uniform float time_scale = 10.0;
uniform sampler2D noiseTexture;
group_uniforms Color;
uniform vec4 color_begin : source_color = vec4(1.0, 1.0, 1.0, 1.0);
uniform vec4 color_end : source_color = vec4(1.0, 1.0, 1.0, 1.0);
// By default it spreads the color from -z to z
// Enable to swap from -x to x
uniform bool swap_xz = false;
void vertex() {
float time = TIME * time_scale;
float noise_sample = texture(noiseTexture, UV).r;
float random_x = noise_sample * time;
random_x *= x_deviation_random;
VERTEX.x += x_deviation * sin(time + random_x) * sin(VERTEX.z * uv_scale.y);
float random_z = noise_sample * time;
random_z *= z_deviation_random;
VERTEX.z += z_deviation * sin(time + random_z) * sin(VERTEX.x * uv_scale.x);
}
void fragment() {
vec2 uv = (1.0 - UV);
vec4 c = vec4(0.0);
if (swap_xz) {
c = mix(color_begin, color_end, uv.x);
} else {
c = mix(color_begin, color_end, uv.y);
}
ALBEDO = c.rgb;
ALPHA = c.a;
}
Alright! I’ve been looking for a ghidorah-like effect for my dream game and its in the form of this shader.
Glad to help! :3