Skip to content

OrthoPerspectiveCamera: near/far planes are hard-coded (1…1000 perspective, 0.1…1000 ortho) and never adapt — large models clip #780

Description

@stokuewe

Versions

@thatopen/components 3.4.8 (behaviour verified against the published dist/index.mjs). Found while adopting the library as the one rendering seam of a construction-planning app — we deliberately run the camera stack unpatched, so fixes here are inherited directly on the next bump.

What happens

SimpleCamera.setupCamera() constructs the perspective camera as

new THREE.PerspectiveCamera(60, aspect, 1, 1000)

and OrthoPerspectiveCamera.newOrthoCamera() constructs the orthographic camera with near = 0.1, far = 1000.

Nothing in the library ever updates these planes afterwards: updateAspect only touches aspect, and setOrthoPerspCameraAspect only touches left/right/top/bottom. A user can overwrite camera.three.near/far manually, but the values are restored to the hard-coded defaults whenever the cameras are rebuilt.

Why it matters

  • Any scene larger than 1 km gets visibly far-plane-clipped. A 600 m long building viewed diagonally with some standoff already exceeds 1000 m — common for infrastructure and site-scale IFC models.
  • Geometry closer than 1 m near-plane-clips in perspective mode (interior walkthroughs).

Repro (library only)

  1. Load a model wider than ~600 m (or any scene of that size).
  2. world.camera = new OBC.OrthoPerspectiveCamera(components); fit the model.
  3. Orbit: far parts of the model disappear (far = 1000 clipping).

Suggested fix

Make near/far part of the camera config (or derive far from the scene bounding sphere on fit), and preserve user-set values across projection switches. Source home: packages/core/src/core/OrthoPerspectiveCamera/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions