Skip to content

Scene: PerspectiveCamera.setFocalLength and filmGauge, as three.js has them - #116

Merged
doodlewind merged 4 commits into
meshy-dev:mainfrom
kvnloo:fix/trt-compat-camera
Nov 24, 2026
Merged

doodlewind merged 4 commits into
meshy-dev:mainfrom
kvnloo:fix/trt-compat-camera

Conversation

@kvnloo

@kvnloo kvnloo commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

three.js's PerspectiveCamera.setFocalLength(focalLength) sets fov from the film height, filmGauge / max(aspect, 1), with filmGauge defaulting to 35 (r187 PerspectiveCamera.js#L121, #L164-L172). packages/scene has neither, so three.js code that sets a lens in millimetres throws setFocalLength is not a function.

Change: filmGauge = 35 and setFocalLength on PerspectiveCamera in core.ts. copy/clone carry filmGauge along with the other fields.

Test: one node:test case in a new file, packages/scene/test/three-compat-camera.test.ts. It checks that a landscape camera (film height = 35 / aspect) and a portrait camera (full gauge) get three.js's FOV. It's in its own file so it merges independently of the other open three.js-parity PRs, which all edit three-compat.test.ts.

The engine still reads only fov, aspect, near and far; filmGauge isn't sent anywhere.

Tier T (packages/scene TypeScript; no kernel, IR or export changes).

Merge gate

Runs were on a clean Linux box (Node 24.22.1) from a fresh clone.

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.

2 participants