Repository navigation
Scene step D, fourth part: emitters on instances, a model's - #154
Merged
Merged
Conversation
…t stay in its mesh Static placements and a rigid model's moving nodes; a deforming mesh's are still flattened. Numbered among the mesh's; a rigid model's moved nodes fill their runs. Tests: geometry/emitter-model (analytic), the readback test with a model still / movable / posed (tests/render/data/panel.glb). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ertices is flattened with it; which emitters move, asserted Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ion part is what is flattened) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit e0856a9. Configure here.
| } | ||
| let count = (classed[0].len() + classed[1].len()) as u32; | ||
| meshes.push(InstMesh { first: first_pool, count, opaque: classed[0].len() as u32, rest_first: 0, rest_count: 0, lo, hi, deforms: false, emitters: 0 }); | ||
| meshes.push(InstMesh { first: first_pool, count, opaque: classed[0].len() as u32, rest_first: 0, rest_count: 0, lo, hi, deforms: false, emitters }); |
There was a problem hiding this comment.
Rigid nodes skip emitter-cutout flatten
Medium Severity
A rigid posed node's emitting triangles now stay in its mesh BLAS with cutouts, but the coincident-vertex flatten added for static models is not applied here. A cutout that lets a ray through still steps past an emitter at the same t, so a masked decal on an emitting quad of a moving node goes dark the way Zero Day did before that rule.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e0856a9. Configure here.
…el's moving node too The rule was in the still placement's branch only (review of #154). One function, flatten_coincident, for both branches; a structural test on tests/render/data/panel-decal.glb (panel.glb with a masked quad on the emitting one). Co-Authored-By: Claude Fable 5.2 <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.


Scene step D, fourth part: emitters on instances, for a model. Follows #152.
What
A model's triangles that only emit were flattened at every placement (world space, for light sampling: the reason #147 took away), and a movable or posed model re-transformed them on the CPU every frame. They stay in the model's mesh now, as real-time engines have them.
InstMesh::emitters, numbered among the mesh's triangles bynumber_emitters).fill_movedhas the fill pass take their runs again (move_instances,repose_rigid).Flattened a placement (the build's log): Tokyo 1,800,744 -> 0 triangles, Bistro 20,638 -> 0, Zero Day 10,105 -> 4, the crowd's Bistro's moving nodes 18,400 -> 0.
Timing (Metal, 1280x720 at scale 0.75, trace p50, alternating runs on a quiet machine)
Tokyo's cost is known and taken (the user's decision): it is the emitting triangles' being instanced. With every model flattened (
THREERT_INSTANCING=0) both builds read 4.44 to 4.48; instancing the other 21.3 M triangles costs nothing. The mechanism is not established. Ruled out, each by a build: the instance record's reads, the attributes' order, the light list's order,emit_mis's tree descents (main pays them too), the shadow rays' ends; it grows with the paths' depth. The mesh whole in its instance is the standard structure and what direct-light resampling and moving a still model in place need. The way back, if wanted, is merging still geometry whole, as its own measured step.Kabukichō's data is unchanged (its emitters are not in instanced models).
A regression found and fixed on the way
Zero Day read 4.3 % dark in a region: a masked decal on exactly the vertices of an emitting quad. A cutout hit that lets a ray through steps the ray past it, and past the emitter at the same distance once both are in one BLAS. The existing rule (a pool triangle on a flattened one's vertices is flattened with it) is extended to this pair. The guard is the unbiased check on Zero Day: PASS with the rule (worst region 1.009), FAIL without (0.969). A small render test for it could not be made to discriminate (in a small mesh the opaque quad is always met first) and was dropped.
From review (Bugbot): the rule was in the still placement's branch only. It is one function now (
flatten_coincident), used by a rigid model's moving nodes too, with a structural test (a_cutout_on_an_emitter_is_flattened_with_it,tests/render/data/panel-decal.glb); a mutant without the rule in either branch fails it. No picture changes (241 outputs: 221 byte-identical, 20 within their spread), and Zero Day, Bistro and the crowd flatten what they did.Checked
cargo test169 passed, test-render 241 pass; under software traversal the same 25 tests fail as before.geometry/emitter-model(a model's emitters, analytic;tests/render/data/panel.glb: a grey quad, an emitting quad, a clip); the readback test with a model still, movable (moved) and posed by a clip (its node moved), and which emitters carry the moving flag. Four mutants, each caught.cargo test168 passed; test-render natively fails the five that fail there on main, under software traversal the same 25 as main, value for value.🤖 Generated with Claude Code
Note
Medium Risk
Changes scene build, light-list layout, and live emitter updates for instanced models; touches traversal/light sampling with documented Tokyo trace cost (+2.9%) accepted.
Overview
Keeps a glTF model's pure emissive triangles in its instanced mesh instead of flattening them per placement. Each instance gets a contiguous run in the light list (
InstMesh::emitters,number_emitterson emitting materials only), matching typical engine behavior and avoiding per-frame CPU re-transform/upload for movable models.Still flattens glass and material-function triangles per placement; deforming meshes (skinned/shared pose) still flatten emitters. Introduces
mesh_class(replacesown_mesh_class) so emit-only materials stay in the pool as opaque/cutout, andflatten_coincidentso a cutout on the same vertices as an emitter is flattened together (fixes Zero Day decal/emitter interaction in one BLAS).Live path:
fill_movedcentralizes GPU refills of emitter runs when instances move (movable models, rigid animated nodes). Moving-instance tracking includes rigid model node instances.Adds
geometry/emitter-modelrender test, extended inplace light-list tests for still/movable/posed models, anda_cutout_on_an_emitter_is_flattened_with_it.Reviewed by Cursor Bugbot for commit fde6f22. Bugbot is set up for automated code reviews on this repo. Configure here.