0

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?

Psychon Night
  • 53
  • 1
  • 8
  • Export your texture to a supported image format. Various material properties may have to be baked into the texture which you can do with 3D modeling tools like Blender. – Jan Wilamowski Jun 08 '22 at 01:39
  • I can't export it as an image texture because i'm stuck with that online tool, unfortunately. I don't have access to stuff like blender at this moment – Psychon Night Jun 08 '22 at 01:46
  • If I'm not mistaken, Panda3D (the underlying engine Ursina uses) also doesn't directly support loading .mtl files so you will have to convert it to another format. There is apparently a converter in Panda3D but that might no work either, see https://stackoverflow.com/questions/38201287/what-3d-editor-tool-should-i-use-with-panda3d – Jan Wilamowski Jun 08 '22 at 01:52
  • How did you get these errors? – pokepetter Jun 08 '22 at 09:55

1 Answers1

1

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

pokepetter
  • 1,383
  • 5
  • 8
  • Didn't seem to work... it's showing up as entirely white. I uninstalled my existing Ursina and used that command you sent to install the new one. Maybe it's just a problem with my MTL file... do you have any suggestions? – Psychon Night Jun 08 '22 at 15:42
  • Ah, I figured it out after a bit more fiddling. Definitely the right solution, thank you so much! – Psychon Night Jun 08 '22 at 16:08