deck.gl
deck.gl copied to clipboard
TextLayer text should not appear smaller when zooming in on it. [Bug]
Description
When displaying text using TextLayer I expect the text to stay constant in size independent of zoom. In the below codepen example I see that when zooming in the text becomes smaller. Observe for example the label "Z=-500" which is placed at [0, 0, -500]. Using the scroll wheel to zoom in it becomes almost unreadable small.
Flavors
- [ ] React
- [ ] Python/Jupyter notebook
- [ ] MapboxLayer
- [ ] GoogleMapsOverlay
- [ ] CartoLayer
- [ ] DeckLayer/DeckRenderer for ArcGIS
Expected Behavior
I expect text to have constant size in pixels independent of zoom.
Steps to Reproduce
Simple codepen example: https://codepen.io/nilscb/pen/mdpjayE?editors=0011
Environment
- Framework version: [email protected]
- Browser: google chrome Version 101.0.4951.54
- OS: Windows
Logs
No response
I can see how the behavior is confusing in your case. According to the documentation:
When pixel sizes are viewed from a perspective (e.g. MapView with pitch, FirstPersonView or OrbitView), the same size may appear bigger if the geometry is positioned closer to the camera, in order to preserve the sense of depth. In this case, one pixel at the focal point of the camera (usually the center of the viewport) is always rendered as one true CSS pixel.
The way OrbitView is currently implemented, let's call it "camera zoom" - increasing zoom brings the camera closer to the target, which changes the depth of objects in the scene. What you are looking for is a "picture zoom", which keeps the camera still and scales the drawing on the screen in 2D.
I made a codepen to illustrate the difference between these behaviors (note that panning is not implemented in the custom view):
https://codepen.io/Pessimistress/pen/qBxjyzR?editors=0010
To be honest I am not sure what correct behavior is, or if there is a "correct" behavior, since I don't have much experience dealing with game-engine-like scenarios. I'm open to suggestions how we can make the OrbitView more useful.
cc @danmarshall @ilan-gold
I also am not sure what is correct really....I have noticed this perhaps in other contexts but never thought much about it since I often don't put things behind the origin. That being said, given the name, OrbitView, the current behavior always felt natural. I would expect the behavior sought (the text far away to enlarge) out of FirstPersonView but not really OrbitView although perhaps implementing a happy medium like "camera zoom" could be nice.
Very nice and illustrative codepen you made! Your picture zoom works as I would expect. Maybe I can use your code and fix it that way. Its still a bit puzzling though that the original OrbitView doesn't quite work. Moving the camera closer to objects should make them bigger. And indeed it does too for every object in the scene even for most of the labels. Its only the labels that are further away from the camera than the target that gets smaller when zoomed in on. Anyway I will take inspiration from your custom OrbitView and try to solve it that way. Thanks a lot for informative feedback.