Just how many verts can a 16bit index store...

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
amziraro
Posts: 13
Joined: Fri Jan 22, 2016 2:09 pm
Location: Australia

Just how many verts can a 16bit index store...

Post by amziraro »

I would like to load my Level Geometry into a straight unmodified version of Irrlicht 1.8.* SVN.
I know that (by default) Irrlicht is limited to 16bit Index Buffers, but luckily my Level Geometry usually has less the 65536 Verts, so I thought that I would be OK...

I was wrong:
Image

According to Blender, this mesh has 16,222 Verts and 32,448 Tris, both well under MAX_VAL for `u16` or even `s16`.

If it helps, the Mesh is loaded into a IMeshSceneNode from a .STL file.

What gives?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Just how many verts can a 16bit index store...

Post by hendu »

Blender's vert count might be before triangulation in case you used quads/n-gons.
amziraro
Posts: 13
Joined: Fri Jan 22, 2016 2:09 pm
Location: Australia

Re: Just how many verts can a 16bit index store...

Post by amziraro »

@Hendu Its a generated mesh - just triangles, no quads. Blender and my mesh generator agree on the Triangle count too.
CuteAlien
Admin
Posts: 9687
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Just how many verts can a 16bit index store...

Post by CuteAlien »

16,222 sounds fine, so probably another problem. I've never worked with .STL but that loader looks simple. So if you can post a test-model to reproduce the problem I can give it a shot.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
amziraro
Posts: 13
Joined: Fri Jan 22, 2016 2:09 pm
Location: Australia

Re: Just how many verts can a 16bit index store...

Post by amziraro »

I did something I should have tried before: I tried a different model format (.PLY) which worked!

Here are two models in a zip: meshes.zip. Both are the same model, one in .STL and another in .PLY.
If it matters, the .STL is in Binary Format. PLY seems to work fine.
AReichl
Posts: 269
Joined: Wed Jul 13, 2011 2:34 pm

Re: Just how many verts can a 16bit index store...

Post by AReichl »

I had the same problem with loading big .stl files. I switched to shader-pipeline branch and it worked out of the box (internally the meshbuffer is switched to 64 bit when reaching a certain limit). An alternative would be to "reprogram" the trunk branch to 64 bit, but that is a lot of work, because you have to make changes all over the engine (still it's straight forward - you begin in the loader, wait for the next compile error, correct that and so on until everything is 64 bit.
CuteAlien
Admin
Posts: 9687
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Just how many verts can a 16bit index store...

Post by CuteAlien »

Thanks for the test model. It seems the stl format does not share vertices. So for 32,448 triangles you get 97344 vertices.

The loaders should switch to 32-bit vertexbuffers in that situation, but that's not coded so far (and won't be in Irrlicht 1.9).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
amziraro
Posts: 13
Joined: Fri Jan 22, 2016 2:09 pm
Location: Australia

Re: Just how many verts can a 16bit index store...

Post by amziraro »

I see. Thank you. I will continue to use PLY for now then.
AReichl
Posts: 269
Joined: Wed Jul 13, 2011 2:34 pm

Re: Just how many verts can a 16bit index store...

Post by AReichl »

32 bit, not 64 - sorry.
Post Reply