3DTilesRendererJS icon indicating copy to clipboard operation
3DTilesRendererJS copied to clipboard

Google Maps Example wrong height with orthographic camera

Open mqrty opened this issue 7 months ago • 1 comments

Description

Hello, in the google maps example if you switch to the orthographic camera the height in the hash gets extreme. For example if you go here and enable the orthographic camera, the height will jump from about 3461 to 1630483.

Reproduction steps

  1. Go to google 3d tiles example
  2. Toggle orthographic camera
  3. Observe height

Code

See googleMapsExample.js

I guess you cannot just take camara.position directly when the camera is orthographic here:

const localCameraPos = camera.position.clone().applyMatrix4( tilesMatInv );

I would be very interested in the correct solution, in my app i work around the same problem by calling TransitionManager.syncCameras() and then reading TransitionManager.perspectiveCamera.position but i dont know whether thats the right approach.

Live example

https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/googleMapsExample.html#lat=40.7787&lon=-73.9645&height=3461.14&az=-17.85&el=-83.87&roll=18.26

Screenshots & Tile Set

No response

Library Version

v0.4.10

Three.js Version

r170

mqrty avatar Jun 05 '25 09:06 mqrty

Yes the lat / lon in the demo is designed to be applied to the perspective camera and was never updated to apply to the orthographic camera. The orthographic camera fundamentally works differently from the perspective camera in order to avoid rendering artifacts like near plane clipping - specifically it is pulled back significantly leading to a high height and an apparently inaccurate calculated latitude and longitude.

Calculating the perspective camera transformation to update the hash and seems like a fine solution to me. Would you like to make a PR with the change for the demo?

gkjohnson avatar Jun 05 '25 22:06 gkjohnson

Fixed in #1170

gkjohnson avatar Jun 29 '25 08:06 gkjohnson