GodotVR / godot_openxr_vendors

Godot 4 wrapper for OpenXR vendors loaders and extensions
MIT License
82 stars 17 forks source link

Generate normals and tangets for Meta's global scene mesh #154

Closed dsnopek closed 1 month ago

dsnopek commented 1 month ago

@Nitwel brought up on Discord that OpenXRFbSpatialEntity.create_mesh_instance() for the global scene mesh won't have normals or tangents and hence can't be correctly lit.

Since developers can access the raw data we get from the API via OpenXRFbSpatialEntity.get_triangle_mesh(), I think doing this extra bit of processing in create_mesh_instance() makes sense.

(I had thought this would maybe allow us to remove the "deindexing" that we're doing in scene_global_mesh.gd, because SurfaceTool has to deindex the mesh in order to generate the normals, however, it will automatically re-index it afterwards. I had considered purposefully deindexing it, but that increases the size of the mesh data by a lot, and I don't know if most folks will end up needing that anyway. So, I just stuck with what we previously had in scene_global_mesh.gd for now.)