Skip to content
Advertisement

Ursina – Colorize custom model using MTL file

I’m using python 3.8, Windows 10, Ursina.

I have a custom 3D model, created with this tool. When exporting, it includes an MTL file (which I’m guessing it uses to store the shape colors).

When I go to load it in Ursina, it gives me the following error:

:gobj(error): Texture::read() - couldn't read: <path>/friendly.mtl
:gobj(error): Texture "<path>/friendly.mtl" exists but cannot be read.
:gobj(error): Texture extension "mtl" is unknown.  Supported texture types:

Where <path> is my (correct) folder path.

How can I load the MTL file into Ursina and apply it to my custom model?

Advertisement

Answer

ursina will load the mtl automatically as long as the name of the obj and mtl matches. It will then give it vertex colors based on the material colors defined in the mtl. Make you sure you use and updated version of ursina. You can get the most recent one from GitHub: pip install https://github.com/pokepetter/ursina/archive/master.zip --upgrade

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement