Page 1 of 1

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

Posted: Sun Jan 31, 2016 1:23 pm
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?

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

Posted: Sun Jan 31, 2016 1:36 pm
by hendu
Blender's vert count might be before triangulation in case you used quads/n-gons.

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

Posted: Sun Jan 31, 2016 1:46 pm
by amziraro
@Hendu Its a generated mesh - just triangles, no quads. Blender and my mesh generator agree on the Triangle count too.

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

Posted: Sun Jan 31, 2016 7:26 pm
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.

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

Posted: Mon Feb 01, 2016 4:22 am
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.

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

Posted: Mon Feb 01, 2016 7:50 am
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.

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

Posted: Mon Feb 01, 2016 10:04 am
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).

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

Posted: Mon Feb 01, 2016 12:11 pm
by amziraro
I see. Thank you. I will continue to use PLY for now then.

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

Posted: Mon Feb 01, 2016 1:30 pm
by AReichl
32 bit, not 64 - sorry.