Mesh (.ms3d or .obj) loaded without textures
Mesh (.ms3d or .obj) loaded without textures
I create my first project based on Quake3Map tutorial but with Milkshape3D model (I also tried .obj mesh).
All I can see is black scene. Mesh is loaded, I saw it, but there is no textures...
Any help will be appreciate.
All I can see is black scene. Mesh is loaded, I saw it, but there is no textures...
Any help will be appreciate.
Are you textures stored as pngs?
From experience, Milkshape loves using png's in it's texture positioning and crashes if you use BMP's. We use pngs to set th texture and then convert it to a bmp for using in Irrlicht
From experience, Milkshape loves using png's in it's texture positioning and crashes if you use BMP's. We use pngs to set th texture and then convert it to a bmp for using in Irrlicht
Code: Select all
irr::scene::ISceneNode* tempNode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("mymesh.ms3d"),0,-1,irr::core::vector3df(0.0f,0.0f,0.0f),irr::core::vector3df(0.0f,0.0f,0.0f),irr::core::vector3df(1.0f,1.0f,1.0f));
tempNode->setMaterialFlag(irr::video::EMF_LIGHTING, false);
tempNode->setMaterialTexture(0, driver->getTexture("mytexture.bmp));
Crud, how do I do this again?
I use .bmp.
My code:
What's wrong with it?
My code:
Code: Select all
using namespace irr;
scene::ICameraSceneNode* camera = 0;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (camera)
return camera->OnEvent(event);
return false;
}
};
int main()
{
MyEventReceiver receiver;
IrrlichtDevice *device =
createDevice(video::DT_OPENGL, core::dimension2d<s32>(640, 480), 16, false, false, &receiver);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
scene::IAnimatedMesh* mesh = smgr->getMesh("a.ms3d");
scene::ISceneNode* node = 0;
if (mesh)
node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
camera = smgr->addCameraSceneNodeFPS();
while(device->run())
{
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
You aren't setting a texture or illuminating your mesh.
Which would cause a black meshed shape nothing to appear.
Which would cause a black meshed shape nothing to appear.
Code: Select all
//set the model
irr::scene::ISceneNode* tempNode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("mymesh.ms3d"),0,-1,irr::core::vector3df(0.0f,0.0f,0.0f),irr::core::vector3df(0.0f,0.0f,0.0f),irr::core::vector3df(1.0f,1.0f,1.0f));
//set lighting to alway lit (EMF lighting = false)
tempNode->setMaterialFlag(irr::video::EMF_LIGHTING, false);
//set the texture to the one that should be applied
tempNode->setMaterialTexture(0, driver->getTexture("mytexture.bmp));
Crud, how do I do this again?
I was wondering something about a mesh autoloading it's textures myself. Don't .X's include such information? Haven't really thought long and hard about .ms3d's though.
Nicolas, Is this a possible added feature?
The solution I went with for ms3d's is to is to combine all the textures into one file and then apply that one texture to the mesh. Since milkshape allows texture positioning for each face, it puts each texture bit into the correct location.
Nicolas, Is this a possible added feature?
The solution I went with for ms3d's is to is to combine all the textures into one file and then apply that one texture to the mesh. Since milkshape allows texture positioning for each face, it puts each texture bit into the correct location.
Crud, how do I do this again?