Skip to content

Objects noticeably jitter / anchor issue #189

@MadOPcode

Description

@MadOPcode

While using @googlemaps/three I've noticed that 3D objects rendered onto the map using ThreeJSOverlayView jitter.
https://drive.google.com/file/d/1uacSEtHdXIxr5tLRQtKwhRqog6vY_w5T/view?usp=sharing
Apparently this is related to the fact that the objects and the camera are too far from the world's origin. So when the vertices' positions are computed by the shader there's not enough fp precision (see src/fp-precision directory in the linked repo).
So I tried moving the world's origin closer to the camera for which the anchor property of ThreeJSOverlayView exists it seems. And indeed the jittering of the objects in this case is not observed (see src/rel-coords directory in the linked repo). However the coordinates (computed using latLngToVector3Relative) at which the objects are rendered are way off (except for the object which is located exactly at the anchor's position). Compare positions of red boxes which are not in the initial center in fp-precision and rel-coords in the linked repo.
So how to go about these issues?

Environment details

Windows 10 x64, Chrome (latest)

Steps to reproduce

Just clone the repo linked below and follow the README.

Code example

Here's the repo with the described issues:
https://github.com/MadOPcode/googlemaps-threejsoverlayview-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    releasedtriage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions