DerKarlos / OSMeta

OSM "Metaverse"
Other
15 stars 2 forks source link

Cars - on parking lots / Instancing #21

Open DerKarlos opened 8 months ago

DerKarlos commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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