3D meshes with multiple texture files

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
SOOteam
Posts: 3
Joined: Thu Feb 10, 2005 5:01 am
Location: San Francisco

3D meshes with multiple texture files

Post by SOOteam »

We have been unsuccessfully trying to load some 3D meshes with textures spread over multiple image files. Can anyone tell us how to do this? We have the following:

Code: Select all

   meshes[2] = smgr->addAnimatedMeshSceneNode( starbase);

   if(meshes[2])
   {
      meshes[2]->setMaterialFlag(EMF_LIGHTING, false);
      meshes[2]->setDebugDataVisible (true);

      meshes[2]->setMaterialTexture( 0, driver->getTexture("images/texture_starbase/Sb_Bot.tga") );
      meshes[2]->setMaterialTexture( 1, driver->getTexture("images/texture_starbase/Sb_Side1.tga") );
      meshes[2]->setMaterialTexture( 2, driver->getTexture("images/texture_starbase/Sb_Side2.tga") );
      meshes[2]->setMaterialTexture( 3, driver->getTexture("images/texture_starbase/Sb_Side3.tga") );
      meshes[2]->setMaterialTexture( 4, driver->getTexture("images/texture_starbase/Sb_Top.tga") );

      vector3df scale;
      double scaleValue = 10;
		scale.X=scaleValue;
		scale.Y=scaleValue;
		scale.Z=scaleValue;
		meshes[2]->setScale(scale);

      vector3df position;
		position.X=50;
		position.Y=0;
		position.Z=100;
		meshes[2]->setPosition(position);


   }
What ends up happening is that the whole model is covered with the texture of a single file. What are we are doing wrong? Thanks in advanced.
-----------------------------
SOO Team
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Now each layer just overlaps the other one without any blending or something. So you'll see only one (the one on top). I know you can blend 2 layers with eachother but I didn't know you could have up to 5 texturelayers in Irrlicht?
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

I thought Irrlicht only supported two texture layers??
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

cartoonit wrote:I thought Irrlicht only supported two texture layers??
Right, stock Irrlicht only has support for two texture layers.

SOOteam, what effect are you looking for, exactly? Blending all the textures together? Or do you just have a mesh where different parts needs different texture maps? Or... ?
Guest

Post by Guest »

Thanks for the info. We are not really trying for a special effect. We are placing interim art in the game until our real art is finished. The real art can be any format we ask the artists to make, but right now, we are trying to use free models we find on the internet. Some of these models have their textures spread over several different image files. We don’t really need to have these models look good so we can get by with covering the whole thing with a single texture. It’s good to know that we need our real models to use one file for textures - Thanks.
SOOteam
Posts: 3
Joined: Thu Feb 10, 2005 5:01 am
Location: San Francisco

Post by SOOteam »

Sorry - that last guest reply was SOOTeam - I did not realize I was logged out,
-----------------------------
SOO Team
Guest

Post by Guest »

Try with something like this:

Code: Select all

meshes[2]->getMaterial(0).Texture1 = driver->getTexture("images/texture_starbase/Sb_Bot.tga";
meshes[2]->getMaterial(1).Texture1 = driver->getTexture("images/texture_starbase/Sb_Side1.tga";
...
Post Reply