HELP: "Cannot draw triangles, too many primitives"
-
- Posts: 14
- Joined: Wed Mar 15, 2006 9:52 am
HELP: "Cannot draw triangles, too many primitives"
Hi, sorry if there is a similar post to this, cos I really need help A.S.A.P!
I've been doing some modelling in 3DSMax for a FPS project. I modeled a room's interior and with one room, everything was fine. However, my whole project involves multiple rooms and when I tried duplicating it to 3 whole rooms, I got the aforementioned message when running it:
"Cannot draw triangles, too many primitives (maximum is 655...)"
I'm not really sure about the exact problem but my guesses are:
1) the renderscene optimization? (currently using OctTreeSceneNode following tutorial)
2) the collision triangle selector? (using OctTree too)
3) or do I have to really cut down on the modelling stage i.e. swapping with low polys etc. (I kinda modelled the room at 80-90% accuracy but no meshsmoothing and tried to lower poly count as much as possible).
With this message, the resulting environment was rendered minus one object (in my case, the mattresses on the beds) for each room.
Please help me! Is there a way that doesn't involve me changing the modelling stage?
need help A.S.A.P!
thanks!
I've been doing some modelling in 3DSMax for a FPS project. I modeled a room's interior and with one room, everything was fine. However, my whole project involves multiple rooms and when I tried duplicating it to 3 whole rooms, I got the aforementioned message when running it:
"Cannot draw triangles, too many primitives (maximum is 655...)"
I'm not really sure about the exact problem but my guesses are:
1) the renderscene optimization? (currently using OctTreeSceneNode following tutorial)
2) the collision triangle selector? (using OctTree too)
3) or do I have to really cut down on the modelling stage i.e. swapping with low polys etc. (I kinda modelled the room at 80-90% accuracy but no meshsmoothing and tried to lower poly count as much as possible).
With this message, the resulting environment was rendered minus one object (in my case, the mattresses on the beds) for each room.
Please help me! Is there a way that doesn't involve me changing the modelling stage?
need help A.S.A.P!
thanks!
-
- Posts: 14
- Joined: Wed Mar 15, 2006 9:52 am
Hmm..so for example if I have 6 rooms in a level. I should have 6 room#.3ds and load them seperately? Which means all the positioning would be done in coding?
for instance:
So i should be doing this for every part of level i would want to load, only with different variables?
I'm a noob with Irrlicht here, so bear with me. :oops:
Is there any other way to just load a whole level, but being able to draw a lot of triangles at once?
thanks!
for instance:
Code: Select all
scene::IAnimatedMesh* v5mesh = smgr->getMesh("actual.3ds");
scene::ISceneNode* v5node = 0;
if (v5mesh)
v5node = smgr->addOctTreeSceneNode(v5mesh->getMesh(0));
scene::ITriangleSelector* selector = 0;
if (v5node)
{
v5node->setPosition(core::vector3df(0,-100,0));
v5node->setRotation(core::vector3df(0,180,0));
selector = smgr->createOctTreeTriangleSelector(v5mesh->getMesh(0),v5node,128);
v5node->setTriangleSelector(selector);
selector->drop();
}
I'm a noob with Irrlicht here, so bear with me. :oops:
Is there any other way to just load a whole level, but being able to draw a lot of triangles at once?
thanks!
-
- Posts: 14
- Joined: Wed Mar 15, 2006 9:52 am
well, okay so i guess there's no such alternative way other than splitting levels up and loading them seperately. Now the question is:
1) How do I go about doing that? Anyone kind enough to give an example on how to load multiple parts of a level?
2) How will the collision detection be affected? Admittedly I did try to do this:
and somehow there was no coldet for the second part. I tried adding to the:
and this is where everything got messed up.
Basically, I think I know the basic thing to do is to load the multiple parts into different mesh buffers, and somehow 'join' them together then (got this from one of bitplane's replies on another thread). The thing is I do not know how to actually implement it in Irrlicht.
Please help, I'm so so lost. Thanks. :(
1) How do I go about doing that? Anyone kind enough to give an example on how to load multiple parts of a level?
2) How will the collision detection be affected? Admittedly I did try to do this:
Code: Select all
scene::IAnimatedMesh* v5mesh = smgr->getMesh("part1.3ds");
scene::IAnimatedMesh* v5mesh2 = smgr->getMesh("part2.3ds");
scene::ISceneNode* v5node = 0;
if (v5mesh)
v5node = smgr->addOctTreeSceneNode(v5mesh->getMesh(0));
v5node = smgr->addOctTreeSceneNode(v5mesh2->getMesh(0));
Code: Select all
selector = smgr->createOctTreeTriangleSelector(v5mesh->getMesh(0),v5node,128);
selector = smgr->createOctTreeTriangleSelector(v5mesh2->getMesh(0),v5node,128);
Basically, I think I know the basic thing to do is to load the multiple parts into different mesh buffers, and somehow 'join' them together then (got this from one of bitplane's replies on another thread). The thing is I do not know how to actually implement it in Irrlicht.
Please help, I'm so so lost. Thanks. :(
-
- Posts: 14
- Joined: Wed Mar 15, 2006 9:52 am
Okay, so that basically means for each part, create indv scene nodes and their meshes.
Now how do I do that multiSelector thing? How do I assign these multiple selectors to the camera?
If possible please do give samples in coding. I have no intention to rip off codes as this project is for non-beneficial purposes.
I need to be doing this as soon as possible, and I don't have a clear grip on Irrlicht's engine structure.
Please help, and thanks! (thanks to you hybrid too for giving me the general ideas)
Now how do I do that multiSelector thing? How do I assign these multiple selectors to the camera?
If possible please do give samples in coding. I have no intention to rip off codes as this project is for non-beneficial purposes.
I need to be doing this as soon as possible, and I don't have a clear grip on Irrlicht's engine structure.
Please help, and thanks! (thanks to you hybrid too for giving me the general ideas)
-
- Posts: 14
- Joined: Wed Mar 15, 2006 9:52 am
As far as the 65536 limit, you only need 32 bit indices, if you have more than 65,536 indices in a single model. I assume you're using OpenGL? You need to override the getMaximalPrimitiveCount function from CNullDriver to use a value like 1048576; That value is used to render the maximum number of primitives in a scene and should be much higher than 65536, Niko keeps forgetting to fix it.
-
- Posts: 14
- Joined: Wed Mar 15, 2006 9:52 am
Yes, I'm using OpenGL. So is this method necessary or it's just an alternative way besides using the multinodes/selectors? Which way is the best? (for example: if I alter getMaxPrimCount, I can just load the whole level as one, not worrying about splitting levels into parts?)Spintz wrote:As far as the 65536 limit, you only need 32 bit indices, if you have more than 65,536 indices in a single model. I assume you're using OpenGL? You need to override the getMaximalPrimitiveCount function from CNullDriver to use a value like 1048576; That value is used to render the maximum number of primitives in a scene and should be much higher than 65536, Niko keeps forgetting to fix it.
Does it help by using other render modes besides OpenGL?
Thanks Spintz!
The index count is not the face (or poly or triangle) count, but usually #indices=#faces*3 because we have triangles. So each triangle references 3 vertices such that this many indices are needed. If all of your faces belong to one Meshbuffer then 33000 faces means 100000 indices - if you have quad faces in there even more indices are used. Right now none of the mesh loaders uses triangle fans such that a high index count is always guaranteed.