Repository navigation
Builder: simplify 3-4 times faster, to the same meshes - #82
Merged
Merged
Conversation
Nearly all of a mesh's build is its simplification, and nearly all of that was working out again, for each of the ~80 collapse costs a collapse re-queues, each vertex's neighbours, UV seams, wedges and normal, each time allocating and sorting. They are now kept per vertex and worked out again only when its triangles change. Each edge is queued once rather than from both ends, and a group simplified towards several targets, as a tree's branches are, is simplified once, taking each result on the way down: the collapses come in the same order whatever the target. The meshes built are the same, byte for byte: oak, birch, bush and willow, a meadow patch and a terrain grid, and whole scenes with woods and a meadow. On one thread, a 256-cell terrain builds in 1.6 s rather than 6.0, an oak's wood in 0.47 s rather than 1.78. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…urhood From the review: several targets simplified in one run may now come in any order, each result handed back in its place, so a target ratio above 0.75 can't quietly reorder the branch tries; and in tests, after every collapse, each vertex's kept neighbourhood is checked against working it out afresh. 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.
What and why
The editor's phase 3 (woods and meadows baked in the browser) needs mesh building to be much faster, and the user asked for exactly that rather than a new file format of ready-made meshes. Profiling
solstice-builderon one thread showed simplification taking 97% of a build. Within it, 90% went on one thing: each vertex's neighbours, UV seams, wedges and normal were worked out again, with allocation and sorting, for every one of the ~84 collapse costs that each collapse re-queues.What changed in
simplify.rsanddag.rs:collapseforfrom,toand every corner of every triangle that touchedfrom.The meshes built are the same, byte for byte. The old and new builders were compared by hashing:
On one thread:
Leaves are thinned rather than simplified, so they were already fast. Willow's leaves (a million triangles) remain about 3 s, spread across welding and partitioning. Native bakes get the same speed-up, and so does the site's own build.
Verified
bash scripts/check-changed.sh --allon this head (f15d1d6) passes. That covers fmt, clippy, 1,002 workspace tests including the GPU tests on the RTX 5080, the four wasm32 builds with clippy, andnode apps/viewer/web/editor/test.mjs.Authorship
Written by: Claude Opus 5.5 through Claude Code
Reviewed by: Claude Sonnet 5.5. Nothing blocks merging. It verified:
moved_corner;RefCellpath can panic.Fixed from its points:
The several-target run assumed the targets descend, true only at the default ratio. They may now come in any order.
It suggested the check, in test builds, of every kept neighbourhood after each collapse. Added.
All code, text and comments in this pull request were written by a frontier AI model, with no human-written code, and will be reviewed by a frontier AI model before merging, as the Code of Conduct requires.
🤖 Generated with Claude Code