Repository navigation
Surface instances, phase 1: copies of a piece on another's surface (RFC 0022) - #241
Merged
Merged
Conversation
oxy_mesh::instances: where copies of a source piece go on a host (one per polygon, quads kept where the host has them; per point; or on one face group), anchored to host points and weights so they follow the host when it is sculpted; each copy's transform (up along the interpolated normal, forward along a world direction, the longest edge, the first edge or random; absolute or face-relative size; offset; spin; seeded size and spin variation); and realize() for Make real. instance_timing (this container, 4 cores): 100k copies re-placed after a host change in 5-8 ms (rayon), 10k in under 1 ms; anchors, needed only when the host's triangles change, 14-120 ms at 100k. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GEttLK8THCkZ7KHELbSp7g Signed-off-by: Claude <noreply@anthropic.com>
ViewportRenderer::set_instances uploads a set of model matrices; a DrawItem with `instances: Some(key)` draws its mesh once per matrix, in the matcap, wireframe and shadow passes. Instanced items use their own pipelines and *_instanced vertex entry points (the matrix in vertex slot 1, locations 5-8), so ordinary pieces keep exactly the vertex shaders they had: a first version that read an identity matrix for every piece cost 2-5% per frame on lavapipe (shading_timing); with separate pipelines, interleaved runs of main and this branch are the same within noise (plain 103.6-107.7 vs 103.8-105.2 ms, shadows 179.8-185.7 vs 181.8-185.0 ms). The demo screenshot is pixel-identical to before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GEttLK8THCkZ7KHELbSp7g Signed-off-by: Claude <noreply@anthropic.com>
…22, phase 1) Wire the placement core and the instanced renderer into the app, so a piece can be copied onto the faces, points or one face group of another as live copies that follow the surface. - oxy-doc: Instancer on the host piece, and a skippable INST section. Sources are saved by their place in the piece list, because piece ids aren't saved. Older versions skip INST and open the host and the hidden source as ordinary pieces. - oxy-history: Instancers and Visible steps, so adding, changing, removing and deleting a host are each one undo step. - oxy-app: the Instances section, Edit source (the source alone, active, with every tool), Make real as a background job that keeps the instancer and its source, and cached transforms. Transforms are worked out again and uploaded only when the host, the source or the settings change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GEttLK8THCkZ7KHELbSp7g Signed-off-by: Claude <noreply@anthropic.com>
Resolve the CHANGELOG and ROADMAP conflicts with View > Inactive pieces (keep both entries; Surface instances replaces its 'planned' note). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GEttLK8THCkZ7KHELbSp7g Signed-off-by: Claude <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.
First phase of Surface instances (RFC 0022): copy one piece onto the faces, points or one face group of another as live copies that follow the surface.
What's in it
oxy-mesh::instances): anchors (host points and weights) per polygon (quads kept), point or face group; per-copy transforms from the host's current surface: up along the interpolated normal, forward from a world direction (default), the longest edge, the first edge or random; size (share of the face or scene units), lift, turn, random size/turn with a seed;realizefor Make real (one face group per copy).shading_timingis unchanged within noise.Instancer { source, settings }on the host piece; new skippableINSTsection (layout in theformat.rsheader). Sources are saved by their place in the piece list. Older versions skip it and open the host and the hidden source as ordinary pieces.Step::InstancersandStep::Visible. Adding, changing (a slider drag is one step), removing, and deleting a host (its source is shown again) are each one undo step.Performance
Transforms are cached per instancer and worked out again only when the host, the source or the settings change. They are uploaded to the GPU only when they change. From the
instance_timingexample (release build, 4 cores):So sculpting a host with 100k copies adds that much per frame. With no instancers the per-frame cost is iterating the piece list.
Verified
cargo fmt --check,clippy -D warnings,cargo test --workspace,check_corpus_ip.py.INSTround trip, and an older reader skipping it (2)Not verified / limitations
Generated by Claude Code