OBJ, STL not loading more than 65536 faces

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.
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

OBJ, STL not loading more than 65536 faces

Post by D. Novak »

I'm trying to see how many polygons the engine can handle on one of our machines. For this I have a reconstructed sand-stone head consisting of 3.8 million triangles.

I've converted the file in Deep Exploration into a 3DS file (because Geomagic somehow only allows 65536 vertices for 3DS files). I can load a 250'000 as well as a 500'000 polygon model with Irrlicht while displaying 42 / 23 FPS (the machine is a Core 2 Duo Q6600 2.4 GHz with 4 GiB of Ram and a nVidia Quadro FX3500).

This is fine - the problem is that the conversion in Deep Exploration takes rather long - so I tried to save the model as OBJ and as STL files in Geomagic to see if it works like this.

But if I do this IRRLicht tells me that there are too many primitives and does not display the model at all.
This confuses me a bit because with the 3DS files I can load the files with 250k and 500k poly counts without much trouble.

Can anyone explain me why this is happening with the OBJ & STL files but not with the 3DS file?
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Maybe (just guessing) the 3DS file is using 32Bit as indices whereas the others just use 16Bit ... just a guess.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, the 3ds file does split the mesh into several meshbuffers, because we don't support (smoothing) groups in 3ds so far. Hence, there's no way to separate into several buffers.
For .obj, you can simply put mesh parts into different groups. Irrlicht 1.5 will load them into separate buffers (which are each bound to 65535 vertices). The 32bit support needs some more polishing before we'll use them for huge meshes as well.
Since STL does not support groups either I might try to find a way to split them up into several buffers. However, finding minimal buffer sets is a complex task best to be done in an external tool...
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

Post by D. Novak »

Thank you very much for the detailed explanation. So I guess I either have to wait for 1.5 or to make groups to export them into OBJ-Files (or just wait for Deep Exploration to convert the files into 3DS-Files :) ).
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

D. Novak wrote:I either have to wait for 1.5
Go get yourself a beer, then check back. It should be Real Soon Now. ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

Post by D. Novak »

This is great news :) I am able to load the OBJ models without problem now. But it seems like the OBJ export of Geomagic & Deep Exploration has a bug or the Irrlicht Import imports it differently. (Maybe triangle-sorting?)

That's how the 3DS file looks like in Irrlicht:

http://n.ethz.ch/~dnovak/download/3ds.jpg

And here how the OBJ file is represented:

http://n.ethz.ch/~dnovak/download/obj.jpg

The OBJ itself can be loaded into Geomagic / Deep Exploration without this problem.
Do you have any ideas what the problem might be? (This is 500'000 triangles without texture).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Could be a problem with too large meshbuffers, where the indices are getting huge and wrap over at the 16bit boundary. Can you upload the obj file somewhere?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, fixed in revision 1968 in trunk. You should be able to copy the file over to older versions, but I won't introduce it into 1.5 due to the different material handling.
However, you also need to insert groups into your file (not just one at the beginning). I've tested your file with approx 15k lines per group, i.e. in worst case 45k vertices. You just need to make sure you stay under the 65k limit in each group. Also note that vertex duplication will happen at group boundaries, i.e. an intelligent group insertion might reduce some vertices.
Mirror
Posts: 218
Joined: Sat Dec 01, 2007 4:09 pm

Post by Mirror »

kinda offtopic, but if you use VBOs your 23 FPS for a 500.000 polys mesh will become much higher.
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

Post by D. Novak »

Thank you very much - I will try that out :)
kinda offtopic, but if you use VBOs your 23 FPS for a 500.000 polys mesh will become much higher.
Do you mean Vertex Buffer Objects? I have no idea how to do them but I'm searching around a bit. Would be awesome to have even higher Frames per Second :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Once you've loaded the mesh call mesh->setHardwareMappingHint(video::EHM_STATIC);
and you get VBO support for static meshes (fastest). Since the new meshviewer also supports octree loading I tested your mesh with that option and it was quite useful for examining smaller parts of the mesh while hovering near the surface of the mesh. BEcause most parts are then frstum culled. Didn't test VBOs so far.
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

Post by D. Novak »

I did test VBO's just now. Well - what can I say? That was one hell of a hint :)

FPS went from 21 to 102 on the 500k mesh (that was on my laptop using a Core2 Duo and a Quadro FX 570M). Incredible! Thanks a lot!
Mirror
Posts: 218
Joined: Sat Dec 01, 2007 4:09 pm

Post by Mirror »

glad it helped you. could you possibly give a link to the 500.000 polys mesh ? i'd like to try it with VBOs in with my card too
D. Novak
Posts: 14
Joined: Fri Dec 12, 2008 2:26 pm

Post by D. Novak »

Mirror wrote:glad it helped you. could you possibly give a link to the 500.000 polys mesh ? i'd like to try it with VBOs in with my card too
I'd really like to help you out but the thing is that this head was scanned by us with a structured-light system in a museum. Thus I can't distribute it freely as I want (sadly it's not up to me to make these decisions).
But I'll see around if I can find a model with a similar triangle-density that is less critical :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You mihgt want to check the typical 3d scanner models, such as the stanford bunny. Should be available in obj or stl, you can convert the latter into .obj with the Irrlicht Mesh writer interface :)
Post Reply