3DS file problem

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.
miket75
Posts: 1
Joined: Tue Jan 17, 2006 3:16 am

3DS file problem

Post by miket75 »

Hey guys,

I'm having a wierd problem. When i export 3ds models, and load them with the engine, not all of the polygons are rendered. This is a bit frustrating, as you might imagine, and i'd like some help :?

Thanks :D


Mike
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Try setting back face culling to false.

mesh->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
none

Post by none »

96 C:\Downloads\irrlicht-0.14.0\irrlicht-0.14.0\examples\Mike's Try\main.cpp 'class irr::scene::IAnimatedMesh' has no member named 'setMaterialFlag'


heres the code

scene::IAnimatedMesh* mesh = smgr->getMesh("terrain.3ds");
scene::ISceneNode* node = 0;
node = smgr->addAnimatedMeshSceneNode(mesh);
node->setPosition(core::vector3df(0,0,0));
node->setMaterialTexture(0, driver->getTexture("log1.tga"));
node->getMaterial(0).EmissiveColor.set(0,0,0,0);
mesh->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
xtheagonyscenex
Posts: 131
Joined: Fri Jun 03, 2005 7:26 pm

Post by xtheagonyscenex »

also use yourmeshnamehere->setMaterialFlag(EMT_NORMALIZE NORMALS,true);
and smgr->getMeshManipulator->flipsurfaces i think look in the irrlicht folder and look under doc open the irrlicht help and search mesh manipulaor in the index and it will explain. thats good help too!
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
xtheagonyscenex
Posts: 131
Joined: Fri Jun 03, 2005 7:26 pm

Post by xtheagonyscenex »

and what exporter/program are you using?
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
none

Post by none »

3ds max 5.1, sorry, i cant seem to log in, so i keep having to put my name as none
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I have been working on a 3ds file conversion tool at work. I did some testing with the Irrlicht mesh viewer sample, and had some problems.

I hade downloaded sample cone, box and sphere 3ds files for testing. All opened fine in gmax/max and eventually my conversion tool. Only the box opened correctly when using the mesh viewer. For some reason the cone and the sphere were missing lots of vertex data. Turning on the debug boxes showed that the engine didn't believe the vertex data to be there.

I haven't had a chance to look at it, but I'm hoping to sometime this week.

Travis
nomad
Posts: 53
Joined: Thu Jan 05, 2006 12:35 pm
Location: Wales

Post by nomad »

Hi,

I am getting the same problem with polygons missing from 3ds models. Looking at the engine source, I think the 3ds mesh file loader may not be calculating the correct number of faces, and changing the following line of code seems to have fixed the problem (for me, at least :) )

In C3DSMeshFileLoader.cpp, line 391:

change

Code: Select all

group.faceCount = CountIndices / 3;
to

Code: Select all

group.faceCount = CountIndices;
CountIndices looks like the actual number of faces in the mesh, so surely it should not be divided by 3?

Anyway, I'm no expert with Irrlicht (yet) and I haven't tested this extensively but I hope this helps, providing you can rebuild the engine.
boboS_guest

Post by boboS_guest »

I'm having the same problem with .x files :(
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Yup. That is very likely the problem causing the missing faces/polys. The other issue that I ran into was that child meshes were being placed incorrectly relative to the parent/pivot.
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

The # of indices shouldn't necessarily be equal to the number of faces. If it uses triangle lists, then CountIndices / 3 should be correct. Also, you want to call setMaterialFlag on the mesh's node, not the mesh class.
nomad
Posts: 53
Joined: Thu Jan 05, 2006 12:35 pm
Location: Wales

Post by nomad »

I agree, but when the loader encounters a C3DS_TRIFACE chunk it reads the next 2 bytes, which I understand is the count of how many triangles there are in the mesh, into CountIndices. This is also how I got the face count in the 3DS loader that I wrote a while ago.
Guest

Post by Guest »

nomad wrote:Hi,

I am getting the same problem with polygons missing from 3ds models. Looking at the engine source, I think the 3ds mesh file loader may not be calculating the correct number of faces, and changing the following line of code seems to have fixed the problem (for me, at least :) )

In C3DSMeshFileLoader.cpp, line 391:

change

Code: Select all

group.faceCount = CountIndices / 3;
to

Code: Select all

group.faceCount = CountIndices;
CountIndices looks like the actual number of faces in the mesh, so surely it should not be divided by 3?

Anyway, I'm no expert with Irrlicht (yet) and I haven't tested this extensively but I hope this helps, providing you can rebuild the engine.

Where can i find "C3DSMeshFileLoader.cpp" ?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

It is part of the Irrlicht source code. It would be in the source zip if you haven't extracted it.

If you make the change, you will need to recompile the Irrlicht library and put the .lib and .dll files in the correct places so that when you rebuild your application you'll get the changes and be able to debug them.
nomad
Posts: 53
Joined: Thu Jan 05, 2006 12:35 pm
Location: Wales

Post by nomad »

It's in the file source/source.zip, so if you haven't already done so unzip this and C3DSMeshFileLoader.cpp will be in the root folder of all the source files.

And I must remember to check for other replies before posting :)
Post Reply