Post Game jam commit

This commit is contained in:
Daniel Kauss Serna 2026-02-03 21:06:49 +01:00
commit 6db2131520
164 changed files with 172524 additions and 0 deletions

19
shaders/clouds.gdshader Normal file
View file

@ -0,0 +1,19 @@
shader_type canvas_item;
uniform sampler2D noise_texture: repeat_enable, filter_nearest;
uniform float density: hint_range(0.0, 1.0) = 0.25;
uniform vec2 speed = vec2(0.02, 0.01);
void fragment() {
vec2 uv1 = UV + speed * TIME;
vec2 uv2 = UV + speed * TIME * 0.3;
float n1 = texture(noise_texture, uv1).r;
float n2 = texture(noise_texture, uv2).r;
float noise = mix(n1, n2, sin(TIME * 0.1) * 0.5 + 0.5);
float fog = clamp(noise * 2.0 - 1.0, 0.0, 1.0);
COLOR.a *= fog * density;
}

View file

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

View file

@ -0,0 +1,28 @@
shader_type canvas_item;
uniform vec4 color : source_color = vec4(1.0);
uniform float diameter = 1.0;
uniform float thickness = 0.05;
uniform float frequency = 10.0;
uniform float phase = 0.0;
void fragment() {
vec2 pos = UV - vec2(0.5);
float outer_radius = diameter / 2.0;
float inner_radius = outer_radius - thickness;
float outer_circle = step(length(pos), outer_radius);
float inner_circle = step(length(pos), inner_radius);
float angle = atan(pos.y, pos.x);
if (angle < 0.0) {
angle += 2.0 * PI;
}
float wave = 0.5 * sin(frequency * angle + phase) + 0.5;
float ring = outer_circle - inner_circle;
ring *= step(0.5, wave);
COLOR = vec4(color.rgb, ring * color.a);
}

View file

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

13
shaders/fade_in.gdshader Normal file
View file

@ -0,0 +1,13 @@
shader_type canvas_item;
uniform sampler2D mask; // a texture
uniform float progress : hint_range(0.0, 1.0, 0.001);
void fragment() {
float mask_value = texture(mask, UV).r;
// ensure the progress is a bit bigger than the feather
float threshold = progress * 1.001;
// Fade alpha based on mask vs. threshold with a feather
COLOR.a *= smoothstep(threshold, threshold * 0.999, mask_value);
}

View file

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

33
shaders/fog.gdshader Normal file
View file

@ -0,0 +1,33 @@
shader_type canvas_item;
uniform vec2 center = vec2(0.5, 0.5);
uniform float radius : hint_range(0.0, 1.0) = 0.3;
uniform float softness : hint_range(0.0, 1.0) = 0.1;
// Use 'repeat_enable' to ensure the noise tiles seamlessly
uniform sampler2D noise_texture : repeat_enable, filter_nearest;
uniform float noise_strength : hint_range(0.0, 1.0) = 0.1;
uniform float noise_scale = 4.0; // New: Controls how "dense" the fog clouds are
void fragment() {
vec2 uv = UV;
// 1. Scale the UVs for the noise lookup.
// Higher scale = more frequent/smaller clouds.
vec2 noise_uv = (uv * noise_scale) + vec2(TIME * 0.05);
// 2. Center the noise!
// Texture returns 0.0 to 1.0. Subtracting 0.5 makes it -0.5 to 0.5.
// This allows the fog to distort BOTH inward and outward.
float noise = texture(noise_texture, noise_uv).r - 0.5;
float dist = distance(uv, center);
// 3. Apply the centered noise to the threshold
float fog_threshold = radius + (noise * noise_strength);
// 4. Smoothstep for the alpha transition
float alpha = smoothstep(fog_threshold - softness, fog_threshold, dist);
COLOR.a *= alpha;
}

1
shaders/fog.gdshader.uid Normal file
View file

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

13
shaders/glow.gdshader Normal file
View file

@ -0,0 +1,13 @@
shader_type canvas_item;
uniform float intensity : hint_range(1.0, 5.0, 0.1);
void fragment() {
vec4 col = texture(TEXTURE, UV);
vec3 glow_col = col.xyz * intensity;
COLOR = vec4(glow_col, col.w);}
//void light() {
// // Called for every pixel for every light affecting the CanvasItem.
// // Uncomment to replace the default light processing function with this one.
//}

View file

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

View file

@ -0,0 +1,39 @@
shader_type canvas_item;
uniform float wind_speed = 1.0;
uniform float wind_strength = 10.0;
uniform sampler2D noise_tex : repeat_enable;
uniform vec2 frame_size = vec2(16.0, 16.0);
uniform vec2 sheet_size = vec2(64.0, 16.0);
void vertex() {
float rnd_offset = INSTANCE_CUSTOM.r;
float tex_idx = INSTANCE_CUSTOM.g;
float state = INSTANCE_CUSTOM.b;
if (state < 0.5) {
vec2 world_pos = (MODEL_MATRIX * vec4(VERTEX, 0.0, 1.0)).xy;
float noise = texture(noise_tex, world_pos * 0.005 + vec2(TIME * wind_speed * 0.1)).r;
if (VERTEX.y < 0.0) {
VERTEX.x += sin(TIME * wind_speed) * (wind_strength * noise) + rnd_offset;
}
}
if (state > 0.5) {
VERTEX.y *= 0.2;
VERTEX.y += 5.0;
}
float columns = sheet_size.x / frame_size.x;
float col_idx = mod(tex_idx, columns);
UV.x = (UV.x / columns) + (col_idx / columns);
}
void fragment() {
vec2 uv = vec2(UV.x, 1.0 - UV.y);
vec4 col = texture(TEXTURE, uv);
vec3 glow_col = col.xyz * 2.;
COLOR = vec4(glow_col, col.w);
}

View file

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

62
shaders/outline.gdshader Normal file
View file

@ -0,0 +1,62 @@
shader_type canvas_item;
uniform vec4 color : source_color = vec4(1.0);
uniform float width : hint_range(0, 10) = 1.0;
uniform int pattern : hint_range(0, 2) = 0; // diamond, circle, square
uniform bool inside = false;
uniform bool add_margins = true; // only useful when inside is false
void vertex() {
if (add_margins) {
VERTEX += (UV * 2.0 - 1.0) * width;
}
}
bool hasContraryNeighbour(vec2 uv, vec2 texture_pixel_size, sampler2D texture) {
for (float i = -ceil(width); i <= ceil(width); i++) {
float x = abs(i) > width ? width * sign(i) : i;
float offset;
if (pattern == 0) {
offset = width - abs(x);
} else if (pattern == 1) {
offset = floor(sqrt(pow(width + 0.5, 2) - x * x));
} else if (pattern == 2) {
offset = width;
}
for (float j = -ceil(offset); j <= ceil(offset); j++) {
float y = abs(j) > offset ? offset * sign(j) : j;
vec2 xy = uv + texture_pixel_size * vec2(x, y);
if ((xy != clamp(xy, vec2(0.0), vec2(1.0)) || texture(texture, xy).a <= 0.0) == inside) {
return true;
}
}
}
return false;
}
void fragment() {
vec2 uv = UV;
if (add_margins) {
vec2 texture_pixel_size = vec2(1.0) / (vec2(1.0) / TEXTURE_PIXEL_SIZE + vec2(width * 2.0));
uv = (uv - texture_pixel_size * width) * TEXTURE_PIXEL_SIZE / texture_pixel_size;
if (uv != clamp(uv, vec2(0.0), vec2(1.0))) {
COLOR.a = 0.0;
} else {
COLOR = texture(TEXTURE, uv);
}
} else {
COLOR = texture(TEXTURE, uv);
}
if ((COLOR.a > 0.0) == inside && hasContraryNeighbour(uv, TEXTURE_PIXEL_SIZE, TEXTURE)) {
COLOR.rgb = inside ? mix(COLOR.rgb, color.rgb, color.a) : color.rgb;
COLOR.a += (1.0 - COLOR.a) * color.a;
}
}

View file

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

View file

@ -0,0 +1,22 @@
shader_type canvas_item;
// SUPER IMPORTANT, ELSE WE APPLY LIGHTNING TWICE!!
render_mode unshaded;
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
uniform vec2 cam_pos;// move by a "sub_pixel" which is actually a full res pixel
uniform vec2 scaling;
void fragment() {
// move by a "sub_pixel" which is actually a full res pixel
vec2 sub_uv = SCREEN_UV + (cam_pos * SCREEN_PIXEL_SIZE);
// number of downscaled pixles in UV coords
vec2 pixels = SCREEN_PIXEL_SIZE * scaling;
// round down and read in the center of the pixel
vec2 pixel_uv = floor(sub_uv / pixels) + 0.5;
COLOR = texture(screen_texture, pixel_uv * pixels) ;
}

View file

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

View file

@ -0,0 +1,30 @@
shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
uniform float brightness : hint_range(0.0, 2.0) = 1.0;
uniform float contrast : hint_range(0.0, 2.0) = 1.0;
uniform float saturation : hint_range(0.0, 2.0) = 1.0;
void fragment() {
// 1. Get the screen color
vec4 tex_color = textureLod(screen_texture, SCREEN_UV, 0.0);
vec3 color = tex_color.rgb;
// 2. Adjust Brightness
// Simply multiply by the brightness factor
color *= brightness;
// 3. Adjust Contrast
// Interpolate between a neutral gray (0.5) and the current color
color = mix(vec3(0.5), color, contrast);
// 4. Adjust Saturation
// Calculate grayscale (luminance) using standard weights
float luminance = dot(color, vec3(0.2126, 0.7152, 0.0722));
vec3 grayscale = vec3(luminance);
// Interpolate between grayscale and color
color = mix(grayscale, color, saturation);
COLOR = vec4(color, tex_color.a);
}

View file

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

View file

@ -0,0 +1,21 @@
shader_type canvas_item;
uniform vec4 replace : source_color = vec4(0.0);
uniform float intensity : hint_range(0.0, 5.0, 0.1);
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
vec4 tex_color = texture(TEXTURE, UV);
float color_diff = distance(tex_color.rgb, replace.rgb);
if (color_diff < 0.03) {
COLOR = tex_color * intensity;
} else
{
COLOR = tex_color;
}
}

View file

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

66
shaders/water.gdshader Normal file
View file

@ -0,0 +1,66 @@
shader_type canvas_item;
// --- Uniforms ---
uniform vec4 target_color : source_color = vec4(0.0, 0.0, 1.0, 1.0);
uniform float tolerance : hint_range(0.0, 1.0) = 0.1;
uniform vec4 water_deep_color : source_color = vec4(0.0, 0.4, 0.8, 1.0);
uniform vec4 foam_color : source_color = vec4(1.0, 1.0, 1.0, 1.0);
// --- Functions ---
vec2 random(vec2 uv) {
return vec2(fract(sin(dot(uv.xy, vec2(12.9898,78.233))) * 43758.5453123));
}
float worley(vec2 uv, float columns, float rows) {
vec2 index_uv = floor(vec2(uv.x * columns, uv.y * rows));
vec2 fract_uv = fract(vec2(uv.x * columns, uv.y * rows));
float minimum_dist = 1.0;
for (int y= -1; y <= 1; y++) {
for (int x= -1; x <= 1; x++) {
vec2 neighbor = vec2(float(x),float(y));
vec2 point = random(index_uv + neighbor);
vec2 diff = neighbor + point - fract_uv;
float dist = length(diff);
minimum_dist = min(minimum_dist, dist);
}
}
return minimum_dist;
}
float noise(vec2 uv) {
vec2 uv_index = floor(uv);
vec2 uv_fract = fract(uv);
vec2 blur = smoothstep(0.0, 1.0, uv_fract);
return mix( mix( dot( random(uv_index + vec2(0.0,0.0) ), uv_fract - vec2(0.0,0.0) ),
dot( random(uv_index + vec2(1.0,0.0) ), uv_fract - vec2(1.0,0.0) ), blur.x),
mix( dot( random(uv_index + vec2(0.0,1.0) ), uv_fract - vec2(0.0,1.0) ),
dot( random(uv_index + vec2(1.0,1.0) ), uv_fract - vec2(1.0,1.0) ), blur.x), blur.y) + 0.5;
}
varying vec2 world_pos;
void vertex() {
world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0, 1.0)).xy;
}
void fragment() {
vec4 tex_color = texture(TEXTURE, UV);
float color_diff = distance(tex_color.rgb, target_color.rgb);
if (color_diff < tolerance) {
vec2 w_uv = world_pos * 0.01;
float noise_value = noise(world_pos * 0.1 - TIME * 0.1) * 0.1;
w_uv.x += noise_value;
float worley_val = worley(w_uv + TIME * 0.1, 6.0, 10.0);
vec4 final_water = mix(water_deep_color, foam_color, step(0.7, worley_val));
COLOR = vec4(final_water.rgb, tex_color.a);
} else {
COLOR = tex_color;
}
}

View file

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

View file

@ -0,0 +1,21 @@
shader_type canvas_item;
uniform sampler2D noise_texture: repeat_enable, filter_nearest;
uniform float strength = 0.1;
uniform float borderScale = 2.;
void vertex() {
VERTEX.xy *= vec2(borderScale);
}
void fragment() {
vec2 uv = UV * borderScale - (0.5 * (borderScale - 1.0));
float noise_value = texture(noise_texture, uv + TIME * 0.3).r * 2. * PI;
vec2 displacement = vec2(noise_value * strength, 0.0);
vec2 d_uv = uv + displacement;
COLOR = texture(TEXTURE, d_uv);
}

View file

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