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
While using @googlemaps/three I've noticed that 3D objects rendered onto the map using
ThreeJSOverlayViewjitter.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-precisiondirectory in the linked repo).So I tried moving the world's origin closer to the camera for which the
anchorproperty ofThreeJSOverlayViewexists it seems. And indeed the jittering of the objects in this case is not observed (seesrc/rel-coordsdirectory in the linked repo). However the coordinates (computed usinglatLngToVector3Relative) 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 infp-precisionandrel-coordsin 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