Page 1 of 1

Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 4:28 pm
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 :(

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 4:31 pm
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.

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 4:46 pm
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.

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 5:25 pm
by itsagam
In-game:
Image

Just the mesh:
Image

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 6:29 pm
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.

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 7:24 pm
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)

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 7:34 pm
by Granyte
or split it in many smaller mesh that can be chosen to be rendered or not depending on where the user is

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 7:58 pm
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.)

Re: Fast loading and rendering of large meshes

Posted: Tue Jan 17, 2012 8:14 pm
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.

Re: Fast loading and rendering of large meshes

Posted: Wed Jan 18, 2012 12:54 pm
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.

Re: Fast loading and rendering of large meshes

Posted: Wed Jan 18, 2012 1:12 pm
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?

Re: Fast loading and rendering of large meshes

Posted: Wed Jan 18, 2012 1:54 pm
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)

Re: Fast loading and rendering of large meshes

Posted: Wed Jan 18, 2012 2:53 pm
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)