Page 1 of 1

[Solved] Shadows problem : vertex count > 16-bit limit

Posted: Fri Apr 20, 2007 2:07 pm
by Reverse
Hi there,

I'm having troubles with one particular map in my project when I'm enabling shadows.

Here is the error :

Code: Select all

Assertion failed: v1 < 65536 && v0 < 65536 && (v0 + originalVertexCount) < 65536 && "Vertex count exceeds 16-bit index limit!", file e:\projects\ogrecvs\branches\eihort_vc8_clean\ogrenew\ogremain\src\ogreshadowcaster.cpp, line 116
I don't have this problem with other maps, but what to think ? Is there a vertex count limit for the maps concerning the shadows ??

For information: the map was running well without the shadows, the GENERIC scene manager is used, and the number of polygons that 3dsmax's polygon counter display is 82450 triangles or 39839 polygons.

Thank you for any help !

Posted: Sat Apr 21, 2007 7:03 pm
by lodi
Well, 2^16 = 65536. 82450 triangles means you have at least 82450 vertices, which is greater than 2^16. Therefore you're exceeding the 16-bit vertex count limit, as the assertion is telling you. Are you trying to load the whole map as a single mesh?

Posted: Sun Apr 22, 2007 4:12 am
by Reverse

So why is the OgreShadowCaster using a 2 bytes variable to store that information ? I could make several mesh from the original one but what's the point ? And how to handle high resolution meshes ?

Posted: Sun Apr 22, 2007 6:57 am
by xavier
Where did the mesh come from? The exporter should have set the mesh to use 16 or 32-bit indices when the data was exported. If you exported to a .mesh.xml file, go into the file and change the index size(s) (it will be highly obvious which attribute to change).

Posted: Sun Apr 22, 2007 10:50 am
Your mesh is over the limit for shadow volumes. You could probably change Ogre to support 32 bit vertex counts for shadow volumes, but it's not a good idea, because you'll get really bad performance using stencil shadows with such big meshes anyway. I'd suggest switching to texture shadows or reducing the number of vertices significantly.

Posted: Sun Apr 22, 2007 2:47 pm
by Reverse
The the mesh is an old map from another project with everything collapsed into one edit poly. I did export it with the oFusion exporter.

But what if my mesh was splitted up in several meshes ? Will I obtain bad performance with stencil shadows too ?

I'm not sure yet what kind of shadows I'll use, because my scenes' lighting will probably be precomputed (lightmap) but I'll need shadows casted by the car and it would be great the car receives shadows too.

Thank you !

Posted: Sun Apr 22, 2007 5:06 pm
by xavier
Having level geometry in a single mesh is generally a bad idea -- the whole level will render always even if only a tiny portion is visible. Break it up.

I've heard many questions having to do with oFusion and index size -- ask or search over in the oFusion forum if you continue with the large mesh.

Posted: Sun Apr 22, 2007 5:13 pm
by Reverse
I'll definitely break up my meshes if it's always rendered when everything is collapsed into 1 mesh, that's a big issue.

Thanks a lot.