Confused with the new material system

Lets take the tank as example!

Normally Ogre is build like this:



Now if the *.material does not exist, the “red material” is loaded

Ok, thats clear!

But we have now:








Can someone explain me, how this black box works?

I take the tank_highRes.j3m is loaded, because inside we have all information for glow, diffuse, normal and specular, but why is tank_highRes.j3m loaded??? I can understand if tank2_highRes.j3m is loaded! When is tank_lowRes.j3m loaded?

Is there a way to control it? Guess if you set it with “mesh.setMaterial(tank_highRes.j3m);”!

In the TestHoverTank.class is no such command! Still it knows what to load!

Hope someone can bring a bit light in this new system! The system is ok, yes, but it became a black box

Thanks to anyone, who can solve this riddle!

The j3m only contains the info about the material, its used to instantiate a Material object that has all the info, that Material object is part of the scenegraph and can be saved with it. So if you load an OgreXML model you can use a j3m file to apply a new material to it that also has normal maps etc. The j3m its not loaded afterwards although we want to put that in (a j3m gets re-loaded when a model is loaded and the material gets applied, this way you can only change the j3m file and the model will load with the new material).

As for this special model, Momoko_Fan put a hack into the OgreXML loader so it can load j3m files for OgreXML files when their name is used as the “material” link in the OgreXML file.

If you look at the TestHoverTank code, it loads the J3M file manually by using assetManager.loadMaterial() … So there’s no relationship between the name of the model and the name of the material

Ok, thx that helped me a lot!

When do you plan to include “j3m afterwards loading”?