Skip to content
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

Cars - on parking lots / Instancing #21

Open
DerKarlos opened this issue Nov 24, 2023 · 5 comments
Open

Cars - on parking lots / Instancing #21

DerKarlos opened this issue Nov 24, 2023 · 5 comments

Comments

@DerKarlos
Copy link
Owner

OSM data includes parking areas. We would like to have some random cars on some lots.
Can a glb file have references/links to other glb files / GPU-instances?

In the BabylonJS frontend, the tiles contain center positions of all lots.
The frontend loads a GLB file, makes some copies to change the colors.
It and randomly places instances on some of slots.
The position size and the angle is lightly variated by random to make an irregular view.
We could also have different car glb/shapes if it is a good user device.
As I assume, the glb standard can't do all this, it may be done by the tile generation already:
translation, orientation, size. color? A GPU may be able to use the same geometry with different materials.

( Later we may have cars, driving around autonomous, showing actual town-traffic jams
and a control, to drive a car, in a multiuser race :-)

@oli-obk
Copy link
Collaborator

oli-obk commented Nov 24, 2023

We could load the raw osm files for this information.

Though I don't know yet how to map the osm2world tile coordinates to lat/lon in order to know which osm file to load

@DerKarlos
Copy link
Owner Author

What? Sure, we always can get and render extras directly from OSM.
But I mean, if GLB can have such references, Tobias will add them in the new tiles.
If not, GLB can always have user-defined data, Tobias will use.
And the Bevy Loader may just place the cars.
Or we may do it by digging in the loaded GLB.

@oli-obk
Copy link
Collaborator

oli-obk commented Nov 25, 2023

The issue with putting this information into the glb files is that we then have to "reverse engineer" the information to be able to figure out road lane directions and intersections.

If we load the data directly from osm in its raw form, we can make cars drive on the roads much more precisely (and we can iterate faster, because we are not reliant on someone else developing code for us and then generating the glb files for us)

@DerKarlos
Copy link
Owner Author

Tobias is already doing all this in his old tiles. And if he does it into the GLB,
we just have to read the user-data and place the cars.
Or the standard GLB can have references and the bevy-loader will process it.
Let's wait until it's in the tile

@DerKarlos DerKarlos changed the title Cars - on parking lots Cars - on parking lots / Instancing Nov 26, 2023
@DerKarlos
Copy link
Owner Author

The gltf format does NOT have references to other Gltf-Files
But Extentions can be defined and coded. A list of car positions could be added and read in the frontend.
https://community.khronos.org/t/instancing-in-gltf/106027

Another idea is instancing. Not only cars, even trees and street lamps
Inside gltf, anything is instanced! Meshes instance materials, scenes instance nodes.
So the car could simply be a Mesh and many nodes with translation etc. can reference to the car mesh.
Or multiple car meshes with different colours/materials, but the same shape.
If this is done by Tobias, we don't need to code anything extra.
👉 The GPU knows instances as well. The gltf loader may use them or not.
https://community.khronos.org/t/instancing-in-gltf/106027

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants