diff --git a/uw8-window/src/gpu/crt.wgsl b/uw8-window/src/gpu/crt.wgsl index 22400a0..b04606c 100644 --- a/uw8-window/src/gpu/crt.wgsl +++ b/uw8-window/src/gpu/crt.wgsl @@ -29,7 +29,7 @@ fn sample_pixel(coords: vec2, offset: vec4) -> vec3 { if(is_outside) { return vec3(0.0); } else { - let f = max(vec4(0.01) / offset - vec4(0.003), vec4(0.0)); + let f = max(vec4(0.008) / offset - vec4(0.0024), vec4(0.0)); return textureLoad(screen_texture, coords, 0).rgb * (f.x + f.y + f.z + f.w); } } diff --git a/uw8-window/src/gpu/fast_crt.wgsl b/uw8-window/src/gpu/fast_crt.wgsl index 83bc536..2688cd6 100644 --- a/uw8-window/src/gpu/fast_crt.wgsl +++ b/uw8-window/src/gpu/fast_crt.wgsl @@ -29,6 +29,11 @@ fn row_factor(offset: f32) -> f32 { return 1.0 / (1.0 + offset * offset * 16.0); } +fn col_factor(offset: f32) -> f32 { + let offset = max(0.0, abs(offset) - 0.4); + return 1.0 / (1.0 + offset * offset * 16.0); +} + @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { let base = round(in.tex_coords) - vec2(0.5); @@ -39,8 +44,11 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { let v = base.y + bottom_factor / (bottom_factor + top_factor); - let u = in.tex_coords.x; + let left_factor = col_factor(frac.x); + let right_factor = col_factor(frac.x - 1.0); - return textureSample(screen_texture, linear_sampler, vec2(u, v) / vec2(320.0, 240.0)) * (top_factor + bottom_factor) * 2.0; + let u = base.x + right_factor / (right_factor + left_factor); + + return textureSample(screen_texture, linear_sampler, vec2(u, v) / vec2(320.0, 240.0)) * (top_factor + bottom_factor) * (left_factor + right_factor) * 1.1; }