From c3b0c87cfe6b3a15ae26b9c99832e928059c2d9f Mon Sep 17 00:00:00 2001 From: Timon Date: Fri, 22 May 2026 16:48:05 +0000 Subject: [PATCH] Antialias checkered artboard background edges (#4163) * Antialias checkered artboard background edges * Review --- .../wgpu-executor/src/background/checker_rect.wgsl | 11 +++++++++-- .../libraries/wgpu-executor/src/background/mod.rs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/node-graph/libraries/wgpu-executor/src/background/checker_rect.wgsl b/node-graph/libraries/wgpu-executor/src/background/checker_rect.wgsl index 79f7163c22..7dce58c939 100644 --- a/node-graph/libraries/wgpu-executor/src/background/checker_rect.wgsl +++ b/node-graph/libraries/wgpu-executor/src/background/checker_rect.wgsl @@ -44,6 +44,13 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { fn fs_main(in: VertexOutput) -> @location(0) vec4 { let tile = floor((in.document_position - uniforms.pattern_origin) / uniforms.checker_size); let parity = i32(tile.x + tile.y) & 1; - let luminance = vec3(select(1.0, 0.8, parity == 1)); - return vec4(luminance, 1.0); + let luminance = select(1.0, 0.8, parity == 1); + + let fw = fwidthFine(in.document_position); + let coverage_max = 1.0 - smoothstep(uniforms.rect_max - fw, uniforms.rect_max, in.document_position); + let coverage_min = smoothstep(uniforms.rect_min, uniforms.rect_min + fw, in.document_position); + let coverage = coverage_max * coverage_min; + let alpha = coverage.x * coverage.y; + + return vec4(vec3(luminance), alpha); } diff --git a/node-graph/libraries/wgpu-executor/src/background/mod.rs b/node-graph/libraries/wgpu-executor/src/background/mod.rs index 9fbfb64151..dd4df445ad 100644 --- a/node-graph/libraries/wgpu-executor/src/background/mod.rs +++ b/node-graph/libraries/wgpu-executor/src/background/mod.rs @@ -86,7 +86,7 @@ impl BackgroundCompositor { compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format, - blend: None, + blend: Some(wgpu::BlendState::ALPHA_BLENDING), write_mask: wgpu::ColorWrites::ALL, })], }),