fix(presentation): simplify camera and engine effects

This commit is contained in:
Josh Creek
2026-08-08 08:44:26 +01:00
parent b7f646ba48
commit e0a1cbaf6d
14 changed files with 56 additions and 241 deletions
+5 -21
View File
@@ -1,37 +1,21 @@
shader_type canvas_item;
render_mode unshaded;
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
uniform float motion_blur_amount : hint_range(0.0, 0.03) = 0.0;
uniform sampler2D screen_texture : hint_screen_texture, filter_linear;
uniform float chromatic_aberration : hint_range(0.0, 0.02) = 0.0;
uniform float vignette_strength : hint_range(0.0, 1.0) = 0.22;
vec4 motion_sample(vec2 uv) {
// A restrained centre-directed velocity smear. The camera script scales it
// with ship speed/turbo; mipmapped screen reads soften the outer samples.
if (motion_blur_amount < 0.0001) {
return textureLod(screen_texture, uv, 0.0);
}
vec2 step_uv = (uv - vec2(0.5)) * motion_blur_amount;
vec4 color = textureLod(screen_texture, uv, 0.0) * 0.36;
color += textureLod(screen_texture, uv - step_uv * 0.35, 0.5) * 0.25;
color += textureLod(screen_texture, uv - step_uv * 0.7, 1.0) * 0.21;
color += textureLod(screen_texture, uv - step_uv, 1.5) * 0.18;
return color;
}
void fragment() {
vec2 radial = UV - vec2(0.5);
vec2 chroma = radial * chromatic_aberration;
vec4 center = motion_sample(UV);
vec4 center = texture(screen_texture, UV);
vec3 color = center.rgb;
// The branch is driven by one uniform for the whole draw, so non-turbo
// frames avoid eight redundant screen taps without causing warp divergence.
// frames avoid two redundant screen taps without causing warp divergence.
if (chromatic_aberration > 0.0001) {
color.r = motion_sample(UV + chroma).r;
color.b = motion_sample(UV - chroma).b;
color.r = texture(screen_texture, UV + chroma).r;
color.b = texture(screen_texture, UV - chroma).b;
}
// Aspect-correct vignette, always subtle and tightened slightly on turbo.