postfx subpixel

This commit is contained in:
2026-03-21 14:41:51 +01:00
parent e9fc2e8fa0
commit 06457654f4
5 changed files with 51 additions and 12 deletions

View File

@@ -61,7 +61,12 @@ fragment float4 postfx_fs(PostVOut in [[stage_in]],
color.b = scene.sample(samp, in.uv - float2( ca, 0.0)).b;
color.a = scene.sample(samp, in.uv).a;
float scan = 0.85 + 0.15 * sin(in.uv.y * 3.14159265 * u.screen_height);
float texHeight = float(scene.get_height());
float scaleY = u.screen_height / texHeight;
float screenY = in.uv.y * u.screen_height;
float posInRow = fmod(screenY, scaleY);
float scanLineDY = posInRow / scaleY - 0.5;
float scan = max(1.0 - scanLineDY * scanLineDY * 6.0, 0.12) * 3.5;
color.rgb *= mix(1.0, scan, u.scanline_strength);
float2 d = in.uv - float2(0.5, 0.5);
@@ -312,6 +317,8 @@ void SDL3GPUShader::render() {
return;
}
uniforms_.screen_height = static_cast<float>(sh);
// ---- Render pass: PostFX → swapchain ----
SDL_GPUColorTargetInfo color_target = {};
color_target.texture = swapchain;