Export 2 objects with 2 textures ?

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
AndersNyman
Gnoblar
Posts: 5
Joined: Thu Sep 15, 2005 12:59 pm
Location: Sweden (Karlsborg & Borlänge)
Contact:

Export 2 objects with 2 textures ?

Post by AndersNyman »

Hi
I have just started to experiment with the Ogre engine. Now I have faced a big problem. I hope someone can help me!

Ok.
I have built a character in Maya. The character has two parts, Head and Body. They use two different bitmap textures. When I select both parts and export them, it looks like this in my application:
Image

It looks like the vertexes that belong to the head have been placed all over the body.
/ Anders Nyman
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

It more look like the head texture is used on the body mesh.
Anyway, export Body and Head as one Mesh (I don't know Maya, but I guess it has some function to join two object to one or such). The exporter should take care of correct submesh creation. For each material you use in an object in maya, one submesh with the correct material/texture is created.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
AndersNyman
Gnoblar
Posts: 5
Joined: Thu Sep 15, 2005 12:59 pm
Location: Sweden (Karlsborg & Borlänge)
Contact:

Post by AndersNyman »

hmm, but i can´t use 2 shaders on one mesh. right?

anyway... do i have to use any flags in the code to use sub entities?
/ Anders Nyman
P
OGRE Expert User
OGRE Expert User
Posts: 421
Joined: Fri Jan 07, 2005 9:49 pm
Location: UK
x 2
Contact:

Post by P »

a look to http://www.ogre3d.org/docs/manual/manual_16.html#SEC25 will help you to understand how are working .material scripts.

You can access submeshes from mesh using Ogre::Mesh::getSubMesh or using the iterator given by Ogre::Mesh::getSubMeshIterator and then set the material name of each submesh with Submesh:setMaterialName

Ogre::Mesh : http://www.ogre3d.org/docs/api/html/cla ... 1Mesh.html
Ogre::Submesh : http://www.ogre3d.org/docs/api/html/cla ... bMesh.html

But it's not necessary to do that with code, you can have the same result with exporting the single mesh with its 2 submeshes like Haffax said.

And, if your mesh is exported as 2 submeshes with the Maya exporter, you have to do nothing more than loading it.
Post Reply