Repository navigation
Anti-alias wire edges and draw block wipeout frames above their mask - #3612
Merged
Merged
Conversation
Wire quads were hard-edged (about 1 px for thin wires), so angled lines stair-stepped. Pad the quad one pixel past the stroke and fade the edge pixels by coverage computed from the across coordinate and its screen gradient; round caps use the same distance. World-width bands keep their visible width. The coverage discard runs before the dash test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A wipeout frame inside a block took its mask's rank, so the mask pass tied the depth test and erased part of the anti-aliased frame; the outline drawn after it then showed as beads. It now sits half a rank above the mask, as the top-level path already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Wire quads are hard-edged: thin wires are about 1 px wide and the fragment shaders only discard (dash gaps, round
caps). MSAA 4x smooths the quad edge in four steps at best, so lines at an angle look stair-stepped, and block-heavy
drawings (many small angled outlines) look noticeably rougher than in other CAD applications.
A second problem shows once the edges are smooth: a WIPEOUT inside a block drew its frame at the mask's own rank
(
block_cachelocal rankd[0]; the top-level path already puts the frame half a rank above,depth_override 0.5).The mask pass ties the depth test and erases part of the anti-aliased frame, and the outline drawn after it shows as
beads.
Fix
wire.wgsl,wire_indexed.wgsl,block_wire.wgsl,block_wire_storage.wgsl): thequad is padded one pixel past the stroke and the fragment alpha is multiplied by an analytic edge coverage,
clamp(0.5 + (r - d) / px), withpxthe screen-space gradient of the across coordinate (DPI-independent). Roundcaps use the same distance. The coverage discard runs before the dash test. World-width bands keep their visible
width. The pipelines already blend alpha.
block_cache.rs): wipeout members getd[0] + 0.5 * d[1], as at thetop level.
Tests
cargo test --lib: 7102 passed, 0 failed (46 ignored)Manual check
after (the rest is the outline drawn over the frame).
OCS_MSAA=1) for thesame look and less VRAM.