2 textures on the same ms3d model

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
Guest

2 textures on the same ms3d model

Post by Guest »

I've got a ms3d model, I display it without problem in my bsp world. there are 2 textures :
one for the head and an other one for the body.
I can not apply these textures on my model in the same time.

This is my code :


scene::IAnimatedMesh* mesh = 0;
mesh = smgr->getMesh("../../media/perso2.ms3d");
if (mesh)
{
perso2 = smgr->addAnimatedMeshSceneNode(mesh);
scene::ISceneNodeAnimator* perso2_col = smgr->createCollisionResponseAnimator(
selector, perso2, core::vector3df(10,10,10),
core::vector3df(0,-100,0), 100.0f,
core::vector3df(0,0,0));
perso2->addAnimator(perso2_col);
perso2_col->drop();


if (perso2)
{
perso2->setPosition(core::vector3df(-70,-30,-60));
perso2->setAnimationSpeed(20);
perso2->setMaterialTexture(0, device->getVideoDriver()->getTexture("../../media/perso2_corps.bmp"));
perso2->setMaterialTexture(1, device->getVideoDriver()->getTexture("../../media/perso2_tete.bmp"));
perso2->setMaterialFlag(video::EMF_LIGHTING, true);
perso2->addShadowVolumeSceneNode();
}
}

Sam.

Ps : I converted a half-life model to a milkshape model
wornaki
Posts: 54
Joined: Sat Aug 23, 2003 1:18 am
Location: Argentina, South America

Post by wornaki »

Try not assigning a texture to the model as it may load all necessary textures if they are in the same directory of the model. Multitexturing may have some problems but I'm sure that you can load a model with two textures. Anyway it would be nice to know what is being said by the console output, see if there's any errors.

David
Guest

Post by Guest »

There is no error message during the loading of the model.
My ms3d model use 2 groups : the head and the body.
I think the problem is assign the texture on each group.
How can i do that ?

Sam.

ps : I work under Linux,.
Guest

Post by Guest »

Now I see which is the problem. :( In Irrlicht there is no support yet for materials and groups if I remember correctly. Ask Niko for this feature, I can say that you will not be the first. :)
Luck :!:
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Yes, that feature is missing, and it would be good if it would work. Maybe I`ll add this in 0.4.1, but I cannot promise it.
Last edited by niko on Mon Sep 15, 2003 10:45 am, edited 1 time in total.
Guest

Post by Guest »

I 've got a solution :
I create 2 meshs (body.sm3d, head.sm3d ), i apply a texture for each mesh.
and i attach them with this tips :

http://irrlicht.sourceforge.net/docu/cl ... de.html#a6

Sam.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Very good idea, in this way you are also able to animate them separately. Would be cool if your character can run and grin or run and cry :)
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Post by WhytWulf »

I've just stumbled across this issue myself.. though I am using 2 meshes. on fot he head and the other for the body, the problem happens when I want to put on red gloves (Example) and take off the blue ones, or I don't want to wear gloves at all.
The head mesh will just replaced with either a helmet or will the the user chosen one, so the material(s) won't change much, but on the body boots, armour, gloves, leg wear.. etc..(think Anarchy Online'ish) Heck I'd even like the option to blend in another texture, to show battle damage (but that might be asking too much from my skills )

Is multitexturing planned, if so what mesh formats are going to support that, 3ds, Ms3d, obj...if it isn't planned for awhile does any one have a workaround or full solution...

If the above example is confusing that is because I ran out of coffee, and even drank the last months flat Coke :)
Project Admin -
http://shadowrunonline.sourceforge.net

------------------------------------
There are 10 kinds of people, those that understand binary and those that don't.
powerpop

Post by powerpop »

does this mean that i cannot make a single cube mesh and assign different textures to different parts of it - for example, set up north, south, east, west, top, bottom parts, each with a different texture? or does this only apply to animation meshes?
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

LOOK IT"S EASY... You need to merge your 2 texture files into 1 file.

I use Paint Shop Pro 7, just create a new image that is big enough to put both of your textures in. Then open both of your texture files also, cut them out and paste them onto the new image so that you have one image that has both textures on it. Save it.

Now, open up Milkshape (BTW... this is in the Milkshape help file, check the index under textures). You will need to select a group, assign it a material (texture from file), select the area of the image to use as the texture for the currently selected group, and then fit the wireframe of the group to that area of the texture. Do the same for your other group(s) and save the model.

Then in your code just call a

Code: Select all

perso2->setMaterialTexture(0, device->getVideoDriver()->getTexture("../../media/ONE_TEXTURE_FILE.bmp"));
and BAM. If I was not clear enough, check out that help file... it's in there.
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

If applying one texture is confusing, look at the cube ms3d in the orthogoanl tutorial. Pharoseer set it up to load all the sides from 1 texture.
Crud, how do I do this again?
powerpop

Post by powerpop »

ummm, i dont want to do one texture wrapped that way because my 3DML format allow people to change the texture on parts - so they can say:

<PART name="leaves" texture="green.png"/>
<PART name="trunk" texture="maplebark.png"/>

and then they can also change textures on the fly in the markup scripting

so i guess that was a yes, that IRRLICHT only allows one texture per model and does not have a notion of parts/materials? is that planned - it feels like a show stopper for me - i was all excited too to port over to this engine and use the collision and other nice features ...
Mercior
Posts: 100
Joined: Tue Feb 24, 2004 1:53 am
Location: UK
Contact:

Post by Mercior »

edit: lol wrong thread, ignore this :o
Post Reply