[SOLVED]Loading a dmf 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.
B!

[SOLVED]Loading a dmf model

Post by B! »

Sir
i have saved a model in dmf format from DeleD and i applied this

Code: Select all

scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(
		smgr->getMesh("map\room.dmf"));
in console window it is showing could not load mesh becouse the file could not be opened.

i have checked the directory , everything is correct , Plz help
Guest

Post by Guest »

plz can anybody help me
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Code: Select all

//set textures path
		smgr->getParameters()->setParameter(DMF_TEXTURE_PATH,"./data");
		//choose if you want to use DeleD textures dirs (in this case no)
		smgr->getParameters()->setParameter(DMF_USE_MATERIALS_DIRS,false);
		//set alpha reference to your desidered value 0.01 works good.
		smgr->getParameters()->setParameter(DMF_ALPHA_CHANNEL_REF,0.01f);
		//flip alpha textures because of an Irrlicht trouble with tga files.
		smgr->getParameters()->setParameter(DMF_FLIP_ALPHA_TEXTURES,true);
		//load the map	
		IAnimatedMesh* mesh = 0;
		mesh = smgr->getMesh("./data/mymap.dmf");		
		//add map to the scene
		ISceneNode* node = smgr->addOctTreeSceneNode(mesh->getMesh(0));	
Guest

Post by Guest »

Thank u sir.
One more ques plz
I created a .x file and the problem wz same as with dmf file . So should i have to set directory for its textures also.
and if so , how can i set it
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

With .X files you don't need to set a path to its texture files as long as they're placed in the same folder as your X model, the model is properly textured and UV mapped and you have re-saved it in DX's Mview to make it Irrlicht comaptible:

Code: Select all

scene::IAnimatedMesh* alienmesh = 0;
	alienmesh = smgr->getMesh("./data/alien.x");
	smgr->getMeshManipulator()->makePlanarTextureMapping(alienmesh->getMesh(0), 0.008f);	
	scene::IAnimatedMeshSceneNode* aliennode = 0;
	aliennode = smgr->addAnimatedMeshSceneNode(alienmesh);
	aliennode->setScale(vector3df(2, 2, 2));
	aliennode->setPosition(core::vector3df(2000,220,-60));
	aliennode->setRotation(core::vector3df(0,270,0));	
	//aliennode->setMaterialTexture(0, driver->getTexture("./data/alien.jpg"));
	aliennode->setMaterialFlag(video::EMF_LIGHTING, true);
	aliennode->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); //makes it transparent
	aliennode->getMaterial(0).EmissiveColor.set(0,255,0,0); //makes it emissive
as you see, I commented out the get texture line and the model still loaded its texture properly.
hope it helps :wink:
B!

Post by B! »

i created a model in 3dsmx and exported it with panda . I textured model by assigning different id's to polygons and then applying the material.
Is that the correct way to do or do i have to change the way of texturing, the model wz not loaded.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

best way would be to unwrap your model and create a single texture map for it instead of using 3dsmax's multi-layered materials since Irrlicht can't read them.

is it a static or animated model you're trying to export?

if it's a static one you could also try other 3d formats like 3ds or obj but the material part would still remain. Check 3dsmax's unwrapping tutorials. :wink:
B!

Post by B! »

thanx

if i texture my model in giles and export in .x format ,will it show up in irrlicht.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

yup it will, and you could also use Giles' My3d exporter (included in Irrlicht's "exporters" folder) to add lightmpas to it. This would be for static models of course (like levels).
hybrid

Post by hybrid »

afecelis wrote:best way would be to unwrap your model and create a single texture map for it instead of using 3dsmax's multi-layered materials since Irrlicht can't read them.
What do you mean with multi-layered materials? It's perfectly possible to use several textures for one mesh in 3ds and correctly display it with Irrlicht. What part is not working there? I know that advanced texture techniques like bump mapping are currently not supported, also texture tiling. But multiple textures are.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

sorry, I meant a multi/sub-object material in 3dsmax. Irrlicht goes nuts with those!
hybrid

Post by hybrid »

Do you have an example file at hand? Maybe I can also fix these problems.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

no but I can make one for you. Just give me 5 :wink:
For instance; a cube with a different texture on each of its faces, like numers. That ok?
I'd export to .3ds and try it out myself first. :wink:
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

heheh, took me more than 5, sorry. I was grabbing something to eat :wink:

Ok, I'll report the My3d error. No multi-subobject materials are supported. Same process as before so you can check the Max5 file (ant the material created) and the 3ds. Then in Giles, it still loads the material ok but when exporting to My3d and running the app, the cube shows up totally black.

hope this one helps too:
http://afecelis.gdlib.net/Irrlicht/faces.zip
ilbuzzo
Posts: 71
Joined: Sat Mar 05, 2005 4:00 pm
Location: Italy

Post by ilbuzzo »

Code: Select all

 scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(
      smgr->getMesh("map\room.dmf"));
Hi ,
Your sintax is not correct, in fact your string has just one \, so the compiler will consider \r just like a command and will try to load a file called :"mapoom.dmf", that obviously doesn't exist. You should use:
"map\\room.dmf", if you want to use dos style path or better:
"map/room.dmf" to use unix like path.
This is the reason you get a file doesn't exist exception.
Anyway bye. ;)
Post Reply