Repository navigation
The bones were culled against the origin, not the body - #30
Merged
Merged
Conversation
At some camera angles the amber bones vanished while the joints stayed. The bones are one LineSegments whose vertices are rewritten in place every frame; applyFrame sets needsUpdate, which re-uploads them to the GPU and does not touch the bounding sphere. three computes that sphere once, lazily, on its first cull test — and at that moment the buffer is still zero-filled, so it caches centre (0,0,0) radius 0, a point at the world origin, and keeps it for the life of the figure. The renderer then asks whether the origin is in view and throws the whole figure's bones away whenever the answer is no. The joints survive because each is its own Mesh with its own moving transform, so its bounds travel with it. That asymmetry is the symptom: lines gone, nodes still there, depending on where you orbit. Reproduced against the installed three with the body 4 m out and the camera orbiting it at the renderer's own 3.55 m and 46 degrees: bones lost at five of eight angles with the body fully on screen, none after the fix. It needs the body away from the origin to appear, which is why nothing showed it until now — the fixtures travel 0.46 m at most and keep the origin inside the figure, while a real model covers 2-4 m and separates the two. Fixed by not culling either line object. Recomputing the sphere would also work, but it would have to be remembered at every site that writes positions — applyFrame is reached from seek, seekSegment and loadSequence as well — and forgetting one is how this arose. There are at most five line objects on the stage, so culling them buys nothing worth that risk. The ghost-cloud's bones are built the same way and each sibling has its own, so they could blink out one at a time. That is worst precisely where travel is what is being read, since roughly three quarters of the spread between siblings is how far each one goes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yJSPiRjB5WvTH2x4LB8V6
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.
At some camera angles the amber bones vanished while the joint spheres stayed on screen.
Cause
The bones are one
LineSegmentswhose vertices are rewritten in place every frame.applyFramesetsneedsUpdate, which re-uploads them to the GPU and does not touch the bounding sphere. three computes that sphere once, lazily, on its first cull test — and at that moment the buffer is still zero-filled, so it cachescentre (0,0,0) radius 0, a point at the world origin, and keeps it for the life of the figure.The renderer then asks "is the origin in view?" and throws away the whole figure's bones whenever the answer is no.
computeBoundingSphere,boundingSphereandfrustumCulledappeared nowhere inrenderer.ts.The joints survive because each is its own
Meshwith its own moving transform, so its bounds travel with it. That asymmetry is the symptom: lines gone, nodes still there, depending on where you orbit.Reproduced, and verified fixed
Against the installed three, body 4 m out, camera orbiting it at the renderer's own 3.55 m and 46°:
Every one of those rows has the body fully on screen.
Why nothing caught it before
It needs the body away from the origin to appear. The fixtures travel 0.46 m at most (
slip-away, the only one that travels at all) and keep the origin inside the figure, so fixture mode hides it completely. A real model covers 2–4 m and separates the two — so this is only reachable with the workers running, which is also why no test would have found it.The fix
frustumCulled = falseon both line objects.Recomputing the sphere would also work, but it would have to be remembered at every site that writes positions —
applyFrameis reached fromseek,seekSegmentandloadSequenceas well — and forgetting one is how this arose. There are at most five line objects on the stage, so culling them buys nothing worth that risk. Two constructors are harder to get wrong than four writers.Both sites, not just the visible one. The ghost-cloud's bones are built identically and each sibling has its own, so they could blink out one at a time. That is worst precisely where travel is what is being read, since roughly three quarters of the spread between siblings is how far each one goes.
Not in this PR
No test. This is a renderer property rather than pure logic, and the suite has no WebGL —
notation.test.tsdrives a hand-rolled DOM stub. The reproduction above runs against real three in Node and needs no GPU, so it could become the repo's first renderer test, butthreeis not currently importable fromnode --testwithout a path hack. Raising it rather than quietly skipping it.tscclean, 87 pass, 0 fail. Branched offmain, so it is independent of #29 and can go in first whatever is decided about the grid.🤖 Generated with Claude Code
https://claude.ai/code/session_014yJSPiRjB5WvTH2x4LB8V6