Fast loading and rendering of large meshes

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
itsagam
Posts: 10
Joined: Wed Dec 28, 2011 3:39 am

Fast loading and rendering of large meshes

Post by itsagam »

Hi,
I am loading a level mesh with half a million vertices and faces. The mesh itself does not cover a really large area, it just has a good amount of vertices. Here's how I do it:

Code: Select all

createOctTreeSceneNode(smgr->getMesh("level.obj"));
The problem is that both the loading and rendering are really slow. It takes about 20s to load and the rendering is 12-18 fps (no extra work, just loading meshes without textures). What would be the ideal mesh format for large meshes? I tried exporting to obj, 3ds, stl, irrmesh, dae, dmf. All formats except 3ds resulted in 32-200mb large meshes. 3ds mesh was 8mb and loaded within a second but frame rates were still low (I guess the size difference is because of Binary/ASCII formats).

How do I get through this problem? Does the problem indeed lie in the mesh format or am I missing something? If format is the problem, what would be the more appropriate format, and how would I convert my meshes into it?

I chose Irrlicht because of its light weight and fast nature, but it's a pity I'm having horrible perfomance with level meshes :(
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Fast loading and rendering of large meshes

Post by hybrid »

You could also try to load without the octree and using setHardwareMappingHint to enable hw buffers for rendering. Also seeing that you use OctTree signals that you might use an old version of Irrlicht. Can you give some figures about the level, i.e. how many triangles are you rendering and how does the scene look like? Binary formats are also available in the animated section: b3d, .x, and others. There should be no overhead even though your scene is unanimated.
itsagam
Posts: 10
Joined: Wed Dec 28, 2011 3:39 am

Re: Fast loading and rendering of large meshes

Post by itsagam »

Thanks for the breezy reply! Using 1.7.2 (OctTree was a mistake, I typed it). Polycount is 250000+ and the scene isn't that complex, 4 buildings connected by outdoor corridoors, mid-level detail. I'll post an screenshot in a minute.
itsagam
Posts: 10
Joined: Wed Dec 28, 2011 3:39 am

Re: Fast loading and rendering of large meshes

Post by itsagam »

In-game:
Image

Just the mesh:
Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Fast loading and rendering of large meshes

Post by hybrid »

250k polys is far too much for the level. With hw buffers you might get to a decent frame rate, but there's not much left for doing other things then. After all this means around 8mio triangles per second just for the base level. Not to talk about all the mesh groups that you need to do certain materials etc. If you scale the mesh up by, let's say 20x, octree might also help, as only a fraction of the mesh would be visible. But expect a rework of the level if you want better frame rate.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Fast loading and rendering of large meshes

Post by Cube_ »

why so many polys? If you have a lot of detail, make a normal map.
then decimate it down to the bare bones (aka as far as it goes without loosing it's shape)
"this is not the bottleneck you are looking for"
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Fast loading and rendering of large meshes

Post by Granyte »

or split it in many smaller mesh that can be chosen to be rendered or not depending on where the user is
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Fast loading and rendering of large meshes

Post by serengeor »

Hm, are indoors detailed or what? Cause from the outside it doesn't seem like there would be a need for such high poly count. I've created maps for counter strike 1.6 and they had ~ 4000-5000 triangles at most, adding some smaller details would probably increased the size to ~10k.
You should probably try optimizing it(checking for duplicate/unnecessary polys etc.)
Working on game: Marrbles (Currently stopped).
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Fast loading and rendering of large meshes

Post by ACE247 »

Way too many Triangles... Why would you even commit such a horrible crime of putting 8MILLION Triangles in a mesh that works with a LOT less!
Mesh rework time and completely! At the vertex level if you can. And learn to hate Subdividing while modelling. :D
I hope this wasn't made with Google Sketchup. It has a reputation for incredibly unoptimized/unoptimizable meshes.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Fast loading and rendering of large meshes

Post by hendu »

If your artist pipeline prevents cutting it up, perhaps you could make use of per-meshbuffer culling? Would need a custom scene node.

You might also be interested in:
http://irrlicht.sourceforge.net/forum/v ... =2&t=45617

Though I doubt vertex cache opt can bring more than 20% boost.
itsagam
Posts: 10
Joined: Wed Dec 28, 2011 3:39 am

Re: Fast loading and rendering of large meshes

Post by itsagam »

The model is indeed made with Sketchup :oops: Using setHardwareMappingHint didn't help much. Would try the other methods and report back, meanwhile, trying my best to get the polycount as low as possible.

What would be the maximum polycount I can render without slowing things up?
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Re: Fast loading and rendering of large meshes

Post by 804 »

Every vertex slows up your programm, because every vertex has to Be rendert. You can just optimize how Irrlicht does the rendering. So there isn't any hard limit.
(and what do you mean with Slow ? 60, 20, 10 or 5 fps)
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Fast loading and rendering of large meshes

Post by ACE247 »

He means 18FPS. But I see his card is OpenGL 2.1.2.
@itsagam, what GPU do you use?

Also you can try loading your mesh into Blender as a Collada .dae and do optimizations there. ie make flat surfaces use few as possible verts, trim curves down to far less poly's using soft shading even quite edgy objects look smooth. Keep meshbuffers(groups) reasonably sized but not too large and dont make them too numerous. (Allthough i haven't had many probs with too many groups)
Avoid Google Sketchup for making game meshes, its cool for concepts and architectural designs only. Try baking all your textures and mesh data into a single solid object in Blender.
Do the funny archway pattern as a texture, the window frame bars too :) (If there's any)
Post Reply