Work on vfx and sfx for traps.

This commit is contained in:
2025-12-28 08:59:19 -05:00
parent 55eb37ca74
commit e632e54cba
67 changed files with 1312 additions and 15 deletions

View File

@@ -0,0 +1,46 @@
shader_type spatial;
uniform sampler2D noise;
uniform sampler2D emissive_noise;
uniform sampler2D color_gradient;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture;
uniform vec4 emissive_color : source_color = vec4(1.0, 0.3, 1.0, 1.0);
uniform float noise_strength : hint_range(0.1,2) = 1;
uniform float edge_distance : hint_range(1, 10) = 1;
uniform vec2 oscillation_speed = vec2(1,1);
varying vec3 world_vertex;
void vertex() {
// Called for every vertex the material is visible on.
vec2 uv = UV + TIME * oscillation_speed;
float noise_val = texture(noise, uv).r;
VERTEX = VERTEX + NORMAL * noise_strength * noise_val;
world_vertex = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
}
void fragment() {
// Called for every pixel the material is visible on.
vec3 color;
vec3 e_col = emissive_color.rgb;
vec2 uv = UV;
float g_noise_val = texture(noise, vec2(uv.x + TIME * 0.2, 0.5)).r;
g_noise_val *= g_noise_val;
float e_noise_val = texture(noise, uv + TIME * 0.2).r;
vec3 gradient_col = texture(color_gradient, vec2(g_noise_val, 0)).rgb;
color = gradient_col;
ALBEDO = color;
e_col = e_col * smoothstep(COLOR.r,1.0, texture(emissive_noise, UV).r) * 20.0;
EMISSION = e_col.rgb;
float depth_tex = texture(DEPTH_TEXTURE, SCREEN_UV).r;
float prox_factor = 1.0 - smoothstep(depth_tex, depth_tex + edge_distance, VERTEX.z);
float a_noise_val = smoothstep(0, .8, texture(noise, uv + TIME * 0.1).r);
ALPHA = COLOR.a * a_noise_val * prox_factor;
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

@@ -0,0 +1 @@
uid://c4uv1a6c6l4w4

View File

@@ -0,0 +1,24 @@
shader_type spatial;
render_mode cull_disabled;
uniform sampler2D streaks_texture;
uniform sampler2D explosion_texture;
uniform vec4 streak_color : source_color;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
// Called for every pixel the material is visible on.
vec2 streak_uv = vec2(UV.x * .25 + floor(COLOR.r * 4.0) * .25, UV.y);
float n_val = texture(explosion_texture, UV).r;
float alpha = texture(streaks_texture, streak_uv).r * smoothstep(COLOR.a, 1, n_val);
ALBEDO = streak_color.rgb;
ALPHA = alpha;
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

@@ -0,0 +1 @@
uid://dkfrhh35nf022

View File

@@ -0,0 +1,29 @@
shader_type canvas_item;
uniform sampler2D chars;
uniform sampler2D noise_tex;
void fragment() {
// Random character
vec2 uv = fract(UV * 32.0); // loop uv 32 times for the characters (as the noise resolution is 32x32)
float noise = texture(noise_tex, UV).g;
noise = round(noise * 26.0) / 26.0; // make sure the color value are snapped by 0.1 (so its only 0.0, 0.1, 0.2, and so on) for perfect offset
uv.x = (uv.x / 26.0); // offset
uv.x += noise; // offset every character by the noise value
uv.x += round(TIME * 0.5 * 26.0)/26.0; // animate characters with TIME, then snapped by 0.1 so it doesnt slide. 0.5 is the speed, you might want to change that
// distortion
float rain = UV.y; // this is a vertical gradient
float distortion = texture(noise_tex, UV / vec2(1.0, 32.0)).g; // this will be used for distortion, using previous noise but only horizontal
distortion = round(distortion * 26.0) / 26.0; // for precision reason, you need to round your distortion too, otherwise some character wouldnt be fully shown
rain -= round(TIME * 0.2 * 32.0) / 32.0; // the 'rain' shouldn't move smoothly right? also, 0.2 is the speed
rain += distortion; // distort this gradient, turning it into a rain
rain = fract(rain); // loop the rain
rain = round(rain * 16.0) / 16.0; // pixelate the rain. Rounding by 32.0 or 8.0 is optional
rain = pow(rain, 3.0); // this is not necessary, i just think that it looks good
rain *= 2.0; // this is also not important, just making the characters brighter
COLOR.rgb = texture(chars, uv).rgb * rain * vec3(0.0, 1.0, 0.0); // finally multiply them together then multiply with green for the color
}

View File

@@ -0,0 +1 @@
uid://b202rwkcmmg56