Skip to content

A mesh an edit wrote has no cutout map - #306

Merged
wryyx merged 1 commit into
meshy-dev:mainfrom
wryyx:cutout-maps-edits
Dec 2, 2026
Merged

wryyx merged 1 commit into
meshy-dev:mainfrom
wryyx:cutout-maps-edits

Conversation

@wryyx

@wryyx wryyx commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

A fault of #304, found the same day.

A cutout's maps are made of its triangles' texture coordinates when the scene is prepared, and an instance that an edit places takes those of the scene's instances of its mesh. It took them too when the edit had rewritten that mesh where it lies (a dynamicGeometry mesh whose geometry changes with the same sections): an emitter's shadow rays then asked the map of the triangles the mesh had had. A card's texture coordinates mirrored at run time kept its old picture of light and shadow on the ground.

The change

The edit state keeps the meshes whose triangles an edit wrote (a new mesh, a freed one's slot, one rewritten where it lies), and an instance of one takes no map. Its cutout is then opaque to an emitter's shadow rays, which is what #304 already does for a cutout whose material or texture was edited, until the scene is prepared again.

That is dark where the true picture is lit, not the wrong pattern. To make the map again at the edit needs the texture's pixels and room in the maps' stream at that time: not done here.

The test

shadow/cutout-emitter-geometry-edit-live: the card of shadow/cutout-emitter-side with its u mirrored after three frames, in place. It reads the point the old map lit against a point that a lamp under the card lights.

reads
main, hardware and software traversal 0.25 (the old map still asked)
this branch, both traversals 0.003 (the lamp's own light there: 0.0024)
the alpha tested (THREERT_APPROX=0), what a map made again would give 0.085

Checks

Unit suite 297 (on main with #305), render suite 277 (the cutout tests also under THREERT_HWRT=0), npm run typecheck, the two wasm32 builds. Measured on an Apple M4.

🤖 Generated with Claude Code

@wryyx
wryyx force-pushed the cutout-maps-edits branch from 87e6044 to 1d39a3e Compare December 2, 2026 16:27
A cutout's maps (renderer/src/cutout.rs) are made of its triangles' texture
coordinates when the scene is prepared, and an instance an edit places takes
those of the scene's instances of its mesh. It took them too when the edit
had rewritten that mesh where it lies (a `dynamicGeometry` mesh, the same
sections): an emitter's shadow rays then asked the map of the triangles the
mesh had had. A card's texture coordinates mirrored at run time kept its old
picture of light and shadow on the ground.

The edit state keeps the meshes whose triangles an edit wrote (a new mesh, a
freed one's slot, one rewritten where it lies), and an instance of one takes
no map: its cutout is opaque to those rays, as a cutout whose material or
texture was edited already is, until the scene is prepared again. To make
the map again at the edit needs the texture's pixels and room in the maps'
stream then: not done.

`shadow/cutout-emitter-geometry-edit-live`: the card of
`shadow/cutout-emitter-side` with its u mirrored after three frames. The
point the old map lit, against a point a lamp under the card lights: 0.25
before (under both traversals), 0.003 now; with the alpha tested 0.085.

Unit suite 297, render suite 277 (on main with meshy-dev#305).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@wryyx
wryyx force-pushed the cutout-maps-edits branch from 1d39a3e to 723f5d9 Compare December 2, 2026 16:27
@wryyx
wryyx merged commit ca6926b into meshy-dev:main Dec 2, 2026
10 checks passed
@wryyx
wryyx deleted the cutout-maps-edits branch December 2, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant