-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Imperative coordinates manipulation #61
Comments
Hey, thanks! Each |
Hey @RodrigoHamuy, this gives more insight into the issue I'm encountering, what's the basis of creating a new scene per coordinate? could it be an option to apply matrix transformations to added objects individually and use map.getLayer("THREE-Scene") to manage and manipulate one single three scene and camera? this way you'd open up the possibility of applying matrices to vectors, groups, geometries, meshes etc.. while preserving the current functionality of coordinate positioning... the coordinates component could simply be a group that nests it's children inside the scene with the correct transforms applied... it'd be really great to be able to set vector3's from coordinates so that objects can be created with attributes relative to map space coords... EDIT: the scene of a layer in mapbox can be retreived with the following...
|
Fair point. I first did indeed tried that: Each But apart from my struggle xD the other reason is that the current solution brings one good benefit imo: It keeps the understanding of the Up vector simple. If for example you use Environment Maps to reflect ground and sky, the Up vector only works in a point and what you see becomes progressively wrong as you move away from that point. For kilometers the difference can pass unnoticed, but will look very wrong if this Environment Map is shared between two points on opposite sides of the world. One would get the sky when looking up, while the other will get the floor when looking up. |
OK yes that sort of makes sense, i think something like the following could also calculate the up vector for an object positioned on any lat lng coordinate...
this could be even more optimized by reusing some of those vector3's... I kind of see what you mean by the Environment Maps issue, that's a tricky one because fmu the mapbox camera is being "rotated" or transformed under the "sphere" rather than the sphere being rotated around it's own polar / azimuth axes so would make sense that the under side would reflect the env maps floor, rather than sky, for instance if the env map was half "day" and half "night" this would reflect a real world scenario, as of course, one side of the planet is always unilluminated at any point in time... EDIT: there is also the option here of applying the env map to another larger sphere and having that sphere copy the cameras decomposed matrix rotation if you wanted to preserve the sky always being "up"... |
Yes, exactly. Altering a parent matrices requires a more complex env map if for example you just want the usual ground+sky, while current solution you can just drop Because of time limitations, I don't think I will be changing the strategy from updating only camera matrices to updating both camera matrices + parent objects, but happy to receive PRs with suggestions. Ideally, if we ever implement that, it should be a separated component so users can pick which one they want depending on their needs, since both have different pros and cons. I will be adding coordinates manipulation imperatively though as soon as I have some spare time, hopefully a quick win 🤞 |
You can now use the function |
Thank you! |
I've been exploring this library, and it's been a fantastic experience so far. I've noticed that updating object coordinates in the scene via props for moving objects (not mentioning even the interpolation now) can lead to frequent re-renders, impacting performance. To optimize this, I was thinking of leveraging the
useFrame
to directly manipulate the object coordinates. But after looking into the current implementation this doesn't sound as easy thing. Is it even possible in current state of mapbox layers? As I unterstand in general each object is new three scene.I'm curious to hear your thoughts on this and whether it aligns with the library's development goals. I appreciate the hard work you've put into this library, and I'm excited to see how it continues to evolve. 😊
The text was updated successfully, but these errors were encountered: