how import model correctly for scene management in irredit?

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.
Post Reply
superpop
Posts: 21
Joined: Mon May 14, 2007 1:17 pm

how import model correctly for scene management in irredit?

Post by superpop »

I use irredit as my scene editor,i import many 3ds model file,but when loading the scene file,FPS is only 8,how import model correctly for scene management?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You'd just do it like that. Maybe you should tell us your system specs and the scene parameters (such as face count) in order to assess the frame rate. BTW: Did you check this in release mode, or debug mode?
superpop
Posts: 21
Joined: Mon May 14, 2007 1:17 pm

Post by superpop »

hybrid wrote:You'd just do it like that. Maybe you should tell us your system specs and the scene parameters (such as face count) in order to assess the frame rate. BTW: Did you check this in release mode, or debug mode?
my system
celeron (M) 1.5G,512M memory,
Irrlicht Engine version 1.5
Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Using renderer: Direct3D 9.0,ATI MOBILITY RADEON 9600/9700 Series,
i use the code

Code: Select all

driver->getPrimitiveCountDrawn()
the triangles is about 50000 to 80000,
visual studio 2005, win32 console application.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, so I assume it's a debug version, because that's the default setting in the project files. frame rate can vary by a factor of 10 when changing to release mode. For your scene please also specify the number of scene nodes (you load) and the number of materials each node has.
However, as long as you don't use VBOs, a polycount of 100k is maximum you can have with usual systems. Everything above will require far too much bandwidth and overhead.
Try this: For each node you create call node->setHardwareMappingHint(scene::EHM_STATIC)
superpop
Posts: 21
Joined: Mon May 14, 2007 1:17 pm

Post by superpop »

hybrid wrote:Ok, so I assume it's a debug version, because that's the default setting in the project files. frame rate can vary by a factor of 10 when changing to release mode. For your scene please also specify the number of scene nodes (you load) and the number of materials each node has.
However, as long as you don't use VBOs, a polycount of 100k is maximum you can have with usual systems. Everything above will require far too much bandwidth and overhead.
Try this: For each node you create call node->setHardwareMappingHint(scene::EHM_STATIC)

Code: Select all

for (u32 i=0; i < nodes.size(); ++i)
	{
		scene::ISceneNode * node = nodes[i];

		switch(node->getType())
		{
		case scene::ESNT_SKY_BOX:
			break;
		case scene::ESNT_EMPTY:
			m_fInitialPositon = node->getAbsolutePosition();
			break;
		case scene::ESNT_ANIMATED_MESH:			
			Selector = pManager->getSceneManager()->createTriangleSelectorFromBoundingBox(node);
			break;
		case scene::ESNT_MESH:
			Selector = pManager->getSceneManager()->createTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
			node->setHardwareMappingHint(scene::EHM_STATIC);
			break;
		case scene::ESNT_TERRAIN:
			Selector = pManager->getSceneManager()->createTerrainTriangleSelector((scene::ITerrainSceneNode*)node);
			node->setHardwareMappingHint(scene::EHM_STATIC);
			break;
		default:
			break;
		}
		if (Selector)
		{
			pManager->getMetaSelector()->addTriangleSelector(Selector);
			Selector->drop();
		}
	}
Error 12 error C2039: 'setHardwareMappingHint' : is not a member of 'irr::scene::ISceneNode'
For your scene please also specify the number of scene nodes (you load) and the number of materials each node has
sorry,Can you say more detail?
i change the camera farvalue from 20000 to 2000,and use release mode,but There is no change in performance.
i counted about 170 node in irredit i load .512*512 heightmap
Last edited by superpop on Thu Apr 23, 2009 2:34 pm, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Sorry, should be mesh, not scene node to call this method for. You should also call it for animated meshes, at least if it's a 3ds mesh (since that's non-animated even though it's using the animated mesh structure).
Changing the far value won't help if the app is fill-rate limited or CPU-limited (I suspect the latter). 170 scene nodes should be manageable, though you could start thinking about a zone concept.
superpop
Posts: 21
Joined: Mon May 14, 2007 1:17 pm

Post by superpop »

I use the following method for load scene,i do it in accordance with the example of irrlicht,In addition, for the loading of the scene node, I did not do anything.i search the ISceneNode.h,if know the node,there is no method for get mesh.

Code: Select all

loadIrrScene(CGameManager* pManager,const c8* irrFileName)
{
	pManager->getSceneManager()->loadScene(irrFileName);

	pManager->setMetaSelector();
	core::array<scene::ISceneNode *> nodes;
	pManager->getSceneManager()->getSceneNodesFromType(scene::ESNT_ANY, nodes); // Find all nodes

	for (u32 i=0; i < nodes.size(); ++i)
	{
		scene::ISceneNode * node = nodes[i];

		switch(node->getType())
		{
		case scene::ESNT_SKY_BOX:
			break;
		case scene::ESNT_EMPTY:
			m_fInitialPositon = node->getAbsolutePosition();
			break;
		case scene::ESNT_ANIMATED_MESH:			
			Selector = pManager->getSceneManager()->createTriangleSelectorFromBoundingBox(node);
			break;
		case scene::ESNT_MESH:
			Selector = pManager->getSceneManager()->createTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
			break;
		case scene::ESNT_TERRAIN:
			Selector = pManager->getSceneManager()->createTerrainTriangleSelector((scene::ITerrainSceneNode*)node);
			break;
		default:
			break;
		}
		if (Selector)
		{
			pManager->getMetaSelector()->addTriangleSelector(Selector);
			Selector->drop();
		}
	}
}
170 scene nodes should be manageable, though you could start thinking about a zone concept.
how can i do this?

about why my game fps is only 5,i asked in irredit forum,the reply is :
merge my files together into one large single one
I do not think this is a good solution.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to cast to either mesh scene node or animated mesh scene node, just as you already do here:
((scene::IMeshSceneNode*)node)->getMesh()
superpop
Posts: 21
Joined: Mon May 14, 2007 1:17 pm

Post by superpop »

hybrid wrote:You have to cast to either mesh scene node or animated mesh scene node, just as you already do here:
((scene::IMeshSceneNode*)node)->getMesh()
i had done,but performance no change

Thank you for your help these days.if you have any advise,please continue.
Post Reply