FPS Drops to 3 when I load a detail map terrain mesh

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
bsdlite
Posts: 3
Joined: Thu Dec 09, 2004 7:12 pm

FPS Drops to 3 when I load a detail map terrain mesh

Post by bsdlite »

Does anyone have any experience with the speed of your Irrlicht program dropping catastrophically when you load (any) detail map?

Is there something I need to do to cache it or something? I think that the scene manager may be loading and drawing the entire landscape every single frame (the detail map is the terrain, world).

Here is the entire code of the program:

Code: Select all

#include <irrlicht.h>

using namespace irr;

int main()
{
	IrrlichtDevice *device = createDevice( video::EDT_OPENGL, core::dimension2d<s32>(800, 600), 32, false, true, false );

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();
	
	scene::IAnimatedMesh * worldMesh = smgr->addTerrainMesh( "theWorld", driver->createImageFromFile("../../media/himap.jpg"), driver->createImageFromFile("../../media/himap.bmp"), core::dimension2d< f32 >(2.0f, 2.0f), 200.0f, core::dimension2d< s32 >(100, 100) );
	scene::ISceneNode* node = smgr->addMeshSceneNode( worldMesh->getMesh(0) );
	node->setMaterialFlag(video::EMF_LIGHTING, false);
	
	scene::ICameraSceneNode *camera = smgr->addCameraSceneNodeFPS( 0, 100.0f, 500.0f, -1 );
	
	int lastFPS = -1;
	while(device->run())
	{
		driver->beginScene( true, true, 0 );

		smgr->drawAll();

		driver->endScene();

		int fps = driver->getFPS();
		if ( lastFPS != fps )
		{
		  core::stringw str = L"Arcanus - Height Mapping Test [";
		  str += driver->getName();
                  str += "] FPS:";
		  str += fps;

		  device->setWindowCaption( str.c_str() );
		  lastFPS = fps;
		}
	}

	device->drop();
	return 0;
}
Thanks for all of your help.
bsdlite
Posts: 3
Joined: Thu Dec 09, 2004 7:12 pm

Post by bsdlite »

Here is a screenshot from the Irrlicht screenshots page -- this is what I'm trying to do! They are getting 72 fps, and I'm getting 3.

Image

Maybe I'm just going about it the wrong way, but that certainly looks like a heightmap to me. Is there a certain way I should be coding this that I'm just completely missing?
kaeles-notlogged

Post by kaeles-notlogged »

you might try adding it as an octreescenenode
thats how i do it.
:)
Guest

Post by Guest »

Jesus, I just looked in that screnshoots, they are great!

Why we can't load demos, games, or whatever is used to produce such nice screenshots and test by ourselfs? Of course, source code would be even better.
condrula
Posts: 44
Joined: Wed Mar 10, 2004 11:51 pm
Location: italy

Post by condrula »

bsdlite
Posts: 3
Joined: Thu Dec 09, 2004 7:12 pm

Post by bsdlite »

Thanks to the infinity for your help -- I also implemented the 'getPrimitivesDrawnCount' into my titlebar, and I guess 8.3 million probably isn't a good number for any engine, or any computer, for that matter.

I'll check out this other library, and also try adding it as an octreescenenode, as well.
kaeles-notlogged

Post by kaeles-notlogged »

oh, and try making your hieghtmap smaller, irrlichts terrain gen is really not too good with stuff over 256x256, i mean i use 64x64 most of the time, and i get around 15 to 20 fps, and thats with my 400mhz, 32 meg tnt 2, lmao
try chopping it up and aligning them, i havent got it working like that yet, but if i make 10 64x64 flat ones compared to 1 256 flat one it takes maybe 2 seconds longer to start... and the fps is better
so
its good
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

If you need a program to split up your .BMP heightmaps, I've written myself a nice little command line utility that will split .BMP images and do a couple other things. If anyones interested in it, let me know.

The biggest thing with tiling a heightmap for terrain, to get it to line up is, that you have to kinda overlap the tiles. For example, let's say you split a 256x256 into 4 128x128 tiles. The first tile would go from 0-127, but then the next tile would have to be 127 - 254, so you'd lose 1 pixel at the end of it.
Post Reply