Objectfile doesnt load materials

Hi,

I have created a model using MilkShape3D and exported it to a Wavefront OBJ file.

When i load it in a java program it doesnt load the materials i have created (the materials file (.mtl) is in the same directory).

How do i load the materials?

Thanks!

I’m in doubt wether the common obj loader is documented to support all material types?

Java3D sample ‘ObjLoad’ can load with *.mtl, so basically it should work. Are you sure the mtl files are in the same directory as the obj file? And not tied to certain access pathes?
Tried to load your file with ObjLoad?

Sorry, cannot help better…

Yes, the mtl file is in the same directory.
It’s with the sample ‘ObjLoad’ I try to load this model.
The material is only a diffuse color i’ve changed.

Hm, I’m out of low-level 3D business for some time now… but I remember vaguely (DirectX3?) that vertex colors (provided by the material?) have been replaced completely with the calculated light values under some renderstate conditions.

No idea how that could map to Java3D, but as a rough guess you could try to omit the lights in ObjLoad.

Isn’t it so that materials and lights go hand in hand, the final pixel is calculated with both the material and light?

same here: ObjLoader ignores mtls. even if vertices are grouped accordingly to the docs, shape3ds are created correctly, but all with a std mtl…

Sure? I loaded the minimart.obj/mtl sample, which looks VERY different depending on wether the mtl file is there or not! That’s why I thought that ObjLoad DOES care for mtl!?

I guess it has s.th. to do with the index-sets (groups)…
if you have an .obj + .mtl with different multiple index-sets with an explicit material please send it to me.
I may recognize any differences between my .objs

It seems like ObjectFile care for mtl, because the model is all white when a mtl file is in the same directory as the obj file.

But the ObjectFile isn’t showing me the material i have created…