DerKarlos / OSMeta

OSM "Metaverse"
Other
15 stars 2 forks source link

Why so many entities per GLB file tile? No multiple use of Texture-/Material-/-Handlers? #57

Open DerKarlos opened 7 months ago

DerKarlos commented 7 months ago

This may be a bit fuzzy. For each GLB-tile about 50 Bevy entities are added. Why? Assumption: One per texture. Ok, texture files need time to load and get into the GPU. But if the same texture is used by the next GPU again 50 Entities? We cache them, so the file is not loaded again.

Does the Bevy GPB Loader note, if the texture path is the same and reuses the previous generated handle? It should.

Texture-handles are used in materials/PBR bundles. Our tiles may use the same Texture for multiple materials but different RGB values. In our tiles only a limited amount of materials are used. Would Bevy / the loader see if it is an already existing material? Hardly, but it would be great. This feature could get added. We should investigate some day.

So is it one entity per texture file, texture use, material, material use? For each material use, the GPU needs an expensive draw call. The entity count seems to show them now.

oli-obk commented 7 months ago

I haven't checked, but I assume all triangles that show the wall texture are one entity, all triangles that show the roof texture are one entity,. ..

DerKarlos commented 7 months ago

Yes. I am just curious why? Because of the texture file, .... DrawCall. May be my assumptions about what an Entity is, are wrong: And independent acting "Thing", not a PBRbundle?

oli-obk commented 7 months ago

Well, you can only have one texture per mesh. While we could build one gigantic texture that merges all textures into one and then has a single mesh per tile, that's hard on our side and probably not easy on the osm2world side.

DerKarlos commented 7 months ago

This may get a bot off topic - so what:

A mash may have multiple materials. There is one mesh loaded in the GPU. And in the multi-material table are the vertice-indice ranges. But it still is one draw-all per material, not per mesh At last I did this with BabylonJS for my tiles.

Texture-Maps are a point. OSM2Word uses "repeat" vor u AND v in areas. You can't mix both. But Tobias could use it for small ways: All textures side by side, used by texture-map AND repeated up-down for long ways. And texture-maps could be used for trees, traffic signs etc. If you want to use it for building walls, you can't use the actual repeat for wide walls and many levels. One needs to ad extra vertices for each floor.