Player shader

This commit is contained in:
Marco 2025-06-26 10:58:27 +02:00
commit 6162d11165
19 changed files with 480 additions and 24 deletions

46
Shaders/Blink_3D.gdshader Normal file
View file

@ -0,0 +1,46 @@
shader_type spatial;
render_mode unshaded, cull_disabled;
//uniform bool active = false;
//uniform vec4 flash_color: source_color = vec4(1.0, 0.2, 0.2, 1.0);
//uniform sampler2D tex: source_color;
uniform sampler2D tex : source_color, filter_nearest;
uniform vec4 blink_color : source_color = vec4(1.0, 0.2, 0.2, 1.0);
uniform float blink_intensity = 0.0;
uniform float teleport_progress = 0.0;
uniform float scanline_density = 50.0;
void fragment() {
vec4 color = texture(tex, UV);
// Apply blink effect based on alpha
color = mix(color, blink_color, blink_intensity * color.a);
// Scanline effect: horizontal lines that control alpha
float scanline = mod(UV.y * scanline_density, 1.0);
float cutoff = smoothstep(0.0, 1.0, UV.y - teleport_progress);
float alpha_multiplier = step(scanline, cutoff);
color.a *= alpha_multiplier;
// Determine final output
/*if (active) {
ALBEDO = flash_color.rgb;
} else {
ALBEDO = color.rgb;
}*/
ALBEDO = color.rgb;
ALPHA = color.a;
/*
if (active) {
vec4 color = texture(tex, UV);
ALPHA = color.a;
ALBEDO = vec3(flash_color.r, flash_color.g, flash_color.b);
} else {
vec4 color = texture(tex, UV);
ALPHA = color.a;
ALBEDO = vec3(color.r, color.g, color.b);
}*/
}

View file

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