projectchrono/chrono

Textures are not showing up for .OBJ files that contain them.

m4rr5 opened this issue · 1 comments

m4rr5 commented

As can be seen in for example the City Bus Demo that is part of the latest 7.0.3 release, but also in many other demos, loading an .OBJ file does not render any of its textures. This seems to happen for all objects that are loaded as ChTriangleMeshConnected.

image

A workaround (as suggested by @rserban on the mailing list) is to let irrlicht load them by loading them as ChObjFileShape (which apparently basically lets irrlicht load them instead of chrono). For reference, this bus should show up somewhat like this:

image

Correct, this is something that needs to be fixed in Chrono::Irrlicht.
A couple of things:

  • This only affects the Irrlicht run-time visualization.
    For example, models are loaded and rendered correctly with the OptiX renderer (in Chrono::Sensor)
  • Switching to using a ChObjFileShape and letting Irrlicht load the OBJ and MTL files itself does not always work.
    Indeed, if the mesh is too large, Irrlicht will render garbage; this is because their OBJ reader loads a mesh with a limited-sized buffer. The code I added for connected meshes (which does not yet work when it comes to materials and textures) uses Irrlicht dynamic buffers and should address this limitation