Multiple Materials

Layre

17-06-2006 03:04:24

Hi

Hopefully someone can point me in the right direction - I'm using Max 8 and I've got a mesh with 3 different materials mapped to 3 different parts (elements). Each material has their own mapping channel and it all looks correct inside the preview window of max. However, when previewing it using the Ogre window, the mapping for each material is not even there.

However, if I only use mapping channel 1, then everything works alright but anything other than that, I get into trouble.

The materials I'm using are regular max materials, not the Ogre material. Would that make the difference?

Lioric

17-06-2006 03:37:27

No difference, if you see it in the preview that is the result you should get in your application

Have you tested your models in the OSM viewer?

Are the materials loade in your application? what are the contents of the ogre.log file?

Layre

17-06-2006 04:07:49

sorry - nevermind. solution found

mnm23

24-06-2006 19:33:02

Hi what was your solution.

I am having a problem with my scene. I have one large scene with many materials; 1 for a bridge, couple of different ones for houses, trees, etc. I have one one .mesh file and one .material file, but several materials. Before exported in 3DS max it looked perfect in the ogre viewport. When i try to add everything into my scene it loads the last material i called for everything. Im probably calling on it wrong but cant seem to get my head around how.


ground = new GameInit(mSceneMgr,0,"ground","Terrain.mesh");
ground->initBody(mWorld,Vector3(10,10,10),0,TREE);
ground->getEntity()->setMaterialName("Material_#251/Terrain_Texture");
ground->getEntity()->setMaterialName("Material_#251/Fence_and_bridge");
ground->getEntity()->setMaterialName("Material_#251/Fountian_texture");
ground->getEntity()->setMaterialName("Material_#251/house_1");
ground->getEntity()->setMaterialName("Material_#251/house2");
ground->getEntity()->setMaterialName("Material_#251/house3");
ground->getEntity()->setMaterialName("Material_#251/Other_Texture1");
ground->getEntity()->setMaterialName("Material_#251/Other_Texture2");
ground->getEntity()->setMaterialName("Material_#251/Shop+textures");
ground->getEntity()->setMaterialName("Material_#251/tomb_and_cross");
ground->getEntity()->setMaterialName("Material_#251/stone");
ground->getEntity()->setMaterialName("Material_#251/Tree_texture");
ground->getSceneNode()->setPosition(0, 0, 0);



I have even tried calling one material at a time but changing the callback name but includeing the same .mesh. This didnt work either. Any help is much appreciated.

mnm23

24-06-2006 20:58:16

Ive been looking through the ogre.log file that was exported as well. There seems to be sub meshes. Can i tie these materails to those sub meshes. If so how can i access the sub meshes. I have tried but nothing comes up with the exception of sub entities but that didnt work.

Lioric

25-06-2006 00:15:09

The exported meshes have the material information within them, you dont need to apply materials manually

When you create an entity that uses the exported mesh, it loads and setup the mesh exactly as in max

You need to put the ".material" file(s) inside your resource folders so the materials can be loaded when needed

In your code seems you are applying all those materials to the same entity, so the result will be that each "setMaterial" call will override its previous

mnm23

25-06-2006 01:17:13

Yeah thats exactly what that line of code did. It was more desperation code than logic. LOL. Thanks for your suggestion it worked perfectly. I didnt know that you didnt have to set the material. I thought it had to be set for each entity. Good to know for the future. Thanks a lot.