Hi! I am new in irrlicht, I made a terrain with multiple textures using 3d wold studio and exported it to b3d format. Well, I could load the terrain but only I see one texture. What I missing?
This is my code:
// loadB3D.cpp: define el punto de entrada de la aplicación de consola.
//
#include "stdafx.h"
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(640, 480), 32, false, false, false, 0);
video::IVideoDriver *driver = device->getVideoDriver();
scene::ISceneManager *smgr = device->getSceneManager();
gui::IGUIEnvironment *guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Hello World! You are now running Irrlicht Engine!", core::rect<int>(10,10,200,22), true);
scene::IAnimatedMesh *mesh = smgr->getMesh("media/terrain.b3d");
scene::IAnimatedMeshSceneNode *node = smgr->addAnimatedMeshSceneNode(mesh);
if (node)
{
node->setMaterialFlag(video::EMF_LIGHTING, false);
video::ITexture *texture1 = driver->getTexture("media/isampler24.jpg");
node->setMaterialTexture(0, texture1);
video::ITexture *texture2 = driver->getTexture("media/rock1.jpg");
node->setMaterialTexture(2, texture2);
//node->setFrameLoop(1, 25);
//node->setRotation(core::vector3df(0, 180, 0));
}
//scene::ICameraSceneNode *camera = smgr->addCameraSceneNode(0, core::vector3df(-100, 100, 150), core::vector3df(0, 5, 20));
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
while(device->run())
{
driver->beginScene(true, true, video::SColor(255, 100, 101, 140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Thanks in advance!
multiple textures terrain in b3d format
hmm, the textures should load automatic (or does b3d not?)... 
at least this is wrong in your code:this doesn't mean setting the 2nd texture, but it's texture layer 2 (in fact the 3rd, bc it starts at 0) and this is not what you want !!! 
try it without loading the textures manually (remove the 2 setMaterialTexture lines)...
oh, and please use code tags for your code...
at least this is wrong in your code:
Code: Select all
node->setMaterialTexture(2, texture2);try it without loading the textures manually (remove the 2 setMaterialTexture lines)...
oh, and please use code tags for your code...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:

http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Ok, but another problem with textures
Yes you are right, was just a scene ligth problem I went to 3WDS and set a sun ligth and later could see multiple textures, and commented this lines of code:
But now I facing other problem. I have a terrain made in 3d world studio with 2 textures and the textures do not become soft where one finishes and the other one begins, alone a division in straight line between one and another one looks. Please how can I resolve this?
Code: Select all
video::ITexture *texture1 = driver->getTexture("media/isampler24.jpg");
node->setMaterialTexture(0, texture1);
video::ITexture *texture2 = driver->getTexture("media/rock1.jpg");
node->setMaterialTexture(2, texture2);
what do you mean by "not become soft" ???
I guess you want the textures fade into each other ???
well, this can't be done the way you try it now...
the technique you want to use is called texture blending or splatting...
unfortunately I'm not familar with this, sorry...
I think there where some threads about this and a terrain editor using Irrlicht in the project announcement forum, but I don't know how much they could help...
I guess you want the textures fade into each other ???
well, this can't be done the way you try it now...
the technique you want to use is called texture blending or splatting...
unfortunately I'm not familar with this, sorry...
I think there where some threads about this and a terrain editor using Irrlicht in the project announcement forum, but I don't know how much they could help...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:

http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Better yet, use a 3d world studio loader.
http://irrlicht.sourceforge.net/phpBB2/ ... 35&start=0
With this you can open the 3dw files directly (with terrain splating)
http://irrlicht.sourceforge.net/phpBB2/ ... 35&start=0
With this you can open the 3dw files directly (with terrain splating)
Yes, is great but...
The thing is I can't make collisions, I know that I must use OctTreeTriangleSelector but I can't get the mesh. After load the model with:
How I can get the mesh, like MyMesh->getMesh(0)?
That's all I need now...Thanks everybody!
Code: Select all
C3DWScene c3dw;
c3dw.load(device, "track.3dw", true, true);
That's all I need now...Thanks everybody!