obj no texture

Hello, i have question with .obj format.
I use panda 1.10.0

Why i have no texture with this format ?

If i convert obj to egg (with bin obj2egg), texture work in panda, but with obj no.

I have .mtl file for texture, can i say to panda that texture is in this file ?

When i load obj file:

m = loader.loadModel("resources/myfile.obj")

Can i to apply a mtl file ?

The obj2egg included with the SDK does not currently support textures or .mtl files, sorry. You might have more luck exporting via a different format, or using one of the other .obj importers found around the forums.

Or you could compile the latest Git version of Panda from source with the Assimp loader which allows loading .obj files with materials. This is currently experimental.

ok, but for export with “obj2egg.exe” How to store the textures ?

I use this command:
obj2egg.exe mymodel.obj mymodel.egg

Can i specify mtl file ?

The obj2egg included with the SDK does not currently support textures or .mtl files, sorry.

ok.

I would also like to load .obj models with textures. I managed to use treeform’s converter as well as some of the blender exporters to convert OBJs to .egg or .bam which then load properly with textures. I also figured out how to compile panda3d from source with assimp support. However, I don’t know how to load an .obj model using the assimp loader. I assume the assimp loader is not automatically used when I call

base.loader.loadModel('model.obj')

, or is it?

In the meantime I tried loading a blender file (a format that assimp supports) with the same command as above and it would not succeed and output a list of formats that panda3d supports. By the fact that this list is much shorter than the list of formats that assimp supports and also the fact that blender files are not supported when using the default loader command, I assume that the assimpl loader has to be invoked in another way. It could also be, that something went wrong during compilation of panda3d with assimp support, but everything seemed fine there. Could somebody explain me how to load obj files using assimp?

In order to activate the assimp loader plug-in, you need to add “load-file-type p3assimp” to your config.prc file.

I’m not sure, but since there are now two plug-ins that can load .obj, you may or may not need to tell Panda to force it to use this plug-in for the particular format using “load-file-type obj p3assimp”. Worth a try if you run into trouble.

That worked, thanks :slight_smile:

I installed panda3d by pip on mac. I modified the config.prc, but nothing happened
Do i need to build panda3d by myself if I want to use assimp for loadModel() function?

If you installed the latest version of Panda3D, Assimp is already enabled.