Obj-Loader – Material Name


first of all: Gratulations and thank you for your great work with jme3. I am currently evaluating to use jme3 for my projects.
I found out that the name of the materials in the Wavefront loader is not stored. I would like to suggest the following change in the class MTLLoader. At the end of the routine createMaterial() , the follwoing line could be included:


Then the material name from the mtl file is available. Otherwise the material name was “null”.

Thanks and merry christmas


We could do that but in fact it would be misleading as not all material parameters can be imported or converted. You can only expect UV mapped diffuse, normal, specular and light maps to be imported, in some cases not even these. Check out this doc and the accompanying linked information, it explains a few things about the asset workflow and imports even if you don’t use blender.

Ok, thanks. I do not plan to use the sdk, since I want to import user models (Obj). In the current implementation (using xith3d), the shapes are recognized by their name in the object file, what is not possible in jme3, since the groups are regrouped according to their materials. I thought, I could use the name of the materials for that, but there will be other possibilities. My concern is to stay as close to the release version as possible.

This happens when you import your models in the engine too., the SDK does nothing different Please read that link.

I’m not sure how much work it needs, but wouldn’t be the direct approch, to modify the obj loader and do a own one, that simple does not merge the meshes?

Alternativly just extends the normal one for your own use, and include that line there. That way you wont have to change everything, but can still use unmodified jme