studio: scale the camera's near and far planes with the model fit (STUDIO-FIT-CLIP-PLANES) #2136
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2136"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by syfyra on 2026-11-25T22:29:18Z.
Claimed in the coordination issue as: STUDIO-FIT-CLIP-PLANES (claim comment to follow)
What and why
viewer/studio.htmlcreates its camera once withnear = 0.1andfar = 1000. The auto-fit inloadModelthen places it atmaxDim * (1.5, 1.2, 1.8), about 2.63 x maxDim from the model's centre, and never changes either plane. Every point of the model lies within half its box diagonal of that centre, so:mainClipping starts below about 6 cm and above about 290 m. The gallery sorts such models into categories of their own (
farlod,terrain,road,levelintools/gallery.py).The fit now sets
nearto 1/1000 andfarto 100 times its distance and callsupdateProjectionMatrix(), which leaves room to zoom 1000x in and 100x out from the fitted view.This is separate from #1490 (STUDIO-RESET-CAMERA-FIT, Reset Camera returning to the fitted view). Both extend the test harness's fake camera on the same line, so whichever lands second needs a one-line rebase of
tests/test_viewer_studio.cjs;viewer/studio.htmlmerges cleanly with it.Tested
node --test tests/test_viewer_studio.cjs(Node 26): a new test fits a 2 cm cube, a 5 x 1.5 x 2 m box and a 600 x 40 x 600 m tile and checks the model's whole depth range lies between the near and far planes and that the projection was rebuilt. It fails onmain(0.02 m: near 0.1 clips the model); with the change all 13 tests pass. The harness camera gainsnear,farandupdateProjectionMatrix.PerspectiveCamerathe page already uses.scripts/check_no_game_data.pyon both files.GPUs tested: n/a (viewer logic, Node harness)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:01:08Z.
Review: COMMENTED
Draft review against current
main: scalingcamera.near/camera.farwithfitDistanceinviewer/studio.html:779-785looks clean and clean-room verified, but this branch currently conflicts withmainand has no CI run yet. Please rebase onto currentmainand mark Ready for Review so CI runs green.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:23:09Z.
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.
(AI-assisted triage.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T13:00:45Z.
Review: CHANGES_REQUESTED
Now ready for review, requesting changes before merge:
CONFLICTING/DIRTY): conflicts withmaininviewer/studio.html/tests/test_viewer_studio.cjs. The camera near/far clip scaling inviewer/studio.html:779-785looks clean once rebased.mainand get fresh green CI.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T10:32:30Z.
For information: this pull request is carried in #3092, which merges your head (your commits are kept) into current
main, resolves the conflicts keeping both sides, and fixes the points raised in review here (details in its description). This one stays open until a maintainer decides; if you pick it up again, say so and the carry can be closed.AI-assisted (Claude Code, Claude Opus 5.5)