how to load texture(s) for a MD2 file?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
drarem
Posts: 81
Joined: Mon Mar 06, 2006 4:40 am
Contact:

how to load texture(s) for a MD2 file?

Post by drarem »

I made an animated MD2 file using MM3d, made up of 3 groups of meshes. Each group i assigned a texture to. The MD2 loads in as white if I don't do anything.

If I do this: one color gets applied over the whole object - how do I apply the color to each part of the MD2 object - or am I going about this the wrong way?

Please help before I stray down a bad path..

Thanks.

Here is my code:

Code: Select all

         actor[n].node->setMaterialFlag(video::EMF_LIGHTING, false);
//         	actor[n].node->setMaterialTexture( 0, driver->getTexture("data/blue.bmp") );
 //           actor[n].node->setMaterialTexture( 1, driver->getTexture("data/green.bmp") );
 //           actor[n].node->setMaterialTexture( 2, driver->getTexture("data/dkgreen.bmp") );
hardgeus
Posts: 28
Joined: Tue May 23, 2006 12:55 am
Contact:

Re: how to load texture(s) for a MD2 file?

Post by hardgeus »

I don't think you can use more than one material on an .md2 mesh. Even if in your original modeling tool you assigned different materials to different parts of the mesh, the md2 file format does not support multiple materials, so that information is lost by the time your model gets into Irrlicht.
drarem
Posts: 81
Joined: Mon Mar 06, 2006 4:40 am
Contact:

Post by drarem »

thanks for your quick reply, how should I go about texturing the md2 file in that case? Lithunwrap?

My workflow is like this:

> create mesh in MM3d
> assign materials
> create bones/assign vertices
> create animations
> convert to frame for MD2 format

I guess I have to start with a .OBJ file, texture it along with .tex coordinates, and then bring into it?
hardgeus
Posts: 28
Joined: Tue May 23, 2006 12:55 am
Contact:

Post by hardgeus »

drarem wrote:
My workflow is like this:

> create mesh in MM3d
> assign materials
> create bones/assign vertices
> create animations
> convert to frame for MD2 format

I guess I have to start with a .OBJ file, texture it along with .tex coordinates, and then bring into it?
Well, that last step is what's killing you. The MD2 file format does not support multiple materials, so you're out of luck. The MD3 format might, but I have never worked with it. No matter what you start with (.obj or whatever), once you go to .MD2 you lose any multiple material information you may have.

I just looked up MM3D, I assume you mean Misfit Model 3D? A glance at its features page says that it can export Milkshape models...The Irrlicht feature list says it also supports milkshape models, I haven't used the milkshape format in Irrlicht, but it might support multiple materials per object. I'm pretty sure that you're at a dead end with .MD2 if you're looking for multiple materials per mesh.
drarem
Posts: 81
Joined: Mon Mar 06, 2006 4:40 am
Contact:

Post by drarem »

Thanks again for the help, here is my updated procedure which seems to work so far :

Code: Select all

Step 1:  Create the model using anim8or, in .OBJ format.
- double click each group and name them, for easier texturing. If you have more than one side which could get confusing, separate the face and name that too.

Step 2:  Open the model in Lithunwrap. Lay out the pieces for easy coloring. Don't even fool with trying to assign
textures to the model.

Step 3:  Save model and the colored material (.bmp), after painting over the .bmp,  reload into anim8or to see how it looks.

Step 4:  Open the model in MM3D, create MD2 (merge into frame animations) and save.

Step 5:  Open the model in Irrlicht and load the bitmap from Step 3 manually.
Post Reply