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

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Reverse
Kobold
Posts: 28
Joined: Fri Mar 23, 2007 3:08 pm
Location: Paris - France
x 1
Contact:

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

Post 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 !
Last edited by Reverse on Mon Apr 23, 2007 7:50 am, edited 4 times in total.
lodi
Greenskin
Posts: 103
Joined: Sat Jul 24, 2004 7:06 pm

Post 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?
User avatar
Reverse
Kobold
Posts: 28
Joined: Fri Mar 23, 2007 3:08 pm
Location: Paris - France
x 1
Contact:

Post by Reverse »

Yes.

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 ?
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post 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).
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

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.
User avatar
Reverse
Kobold
Posts: 28
Joined: Fri Mar 23, 2007 3:08 pm
Location: Paris - France
x 1
Contact:

Post 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 !
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post 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.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
Reverse
Kobold
Posts: 28
Joined: Fri Mar 23, 2007 3:08 pm
Location: Paris - France
x 1
Contact:

Post 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.
Post Reply