perf: clash-detection broadphase + raster material tints#393
Merged
Conversation
…es in vcad-render Clash detection ran a blind O(n²) pairwise BRep intersection across all scene roots. On a many-root document this dominates everything: an imported chip die (~88k roots, zero actual overlaps) spent 84% of its samples inside boolean_op/face_aabb and would never finish — 3.8 billion kernel booleans. Two fixes: - evaluate_document: compute each root's AABB once, sort by min-x, and sweep — only AABB-overlapping pairs reach the kernel. AABB-disjoint pairs intersect to empty anyway, so results are identical. 2,000 disjoint roots: minutes → 0.23 s. - vcad-render: pass skip_clash_detection — a static SVG renderer never displays clash meshes. The 88k-root die now renders in 5.2 s. Adds clash_broadphase integration tests (overlap detection incl. same-x pairs and order independence, disjoint scenes, pair counts, and a 2,000-root wall-clock regression bound). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
render_jpeg_str dropped material colors on the floor — the raster path was hardcoded monochrome for mecheval reference images. Route the document's tints through to the shared raster impl and sample each part's tinted shading ramp (same ramp the SVG path uses). Untinted parts keep the original two-stop monochrome shade byte-for-byte, and render_jpeg_solids stays monochrome, so mecheval reference renders are unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
What shippedThis is an internal performance and correctness fix with no new user-facing features, but it resolves a real-world problem where large imported designs would never finish rendering.
Plain-English summary generated by Choji from this pull request. |
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.
What
Three renderer/eval fixes found by tracing why a large imported document never finished rendering:
vcad-eval):evaluate_documentran a blind O(n²) pairwise BRepintersectionacross all scene roots. On a many-root document this dominates everything — an imported chip die (~88k roots, zero actual overlaps) sat at 84% of profile samples insideboolean_op/face_aabband would effectively never finish (3.8 billion kernel booleans). Now: per-root AABBs computed once, sorted by min-x, sweep-and-prune — only genuinely overlapping boxes reach the kernel. AABB-disjoint pairs intersect to empty anyway, so results are identical.vcad-renderskips clash detection — a static renderer never displays clash meshes (the flag existed, nothing set it).vcad-render --jpeg):render_jpeg_strsilently dropped document material colors — hardcoded monochrome. Tinted parts now sample the same tinted shading ramp as the SVG path. Untinted parts keep the original shade byte-for-byte, andrender_jpeg_solidsstays monochrome, so mecheval reference images are unchanged.Numbers
vcad-render)evaluate_document)Testing
clash_broadphaseintegration suite: overlap still detected (incl. same-x-extent pairs and root-order independence), disjoint scenes produce zero clashes, per-pair counts, and a 2,000-root wall-clock regression bound.cargo test -p vcad-eval -p vcad-rendergreen; clippy-D warningsclean (incl.--all-features).Found while importing a real OpenLane/sky130 GDS via #387 — the two PRs are independent but this one is what makes big imported layouts actually render.
🤖 Generated with Claude Code