Game Development Community

Hard coded vertex limit

by Fenrir Wolf · in Torque Game Engine Advanced · 06/04/2004 (9:28 am) · 4 replies

First of all, I went and dumped my 4600-odd polygon huge robot model into TSE and it immediately crashed. I went back to the debug EXE and found that it's giving an assert about MAX_DYNAMIC_VERTs. I checked the code and sure enough, this is a hard coded limit of 4096 vertices. (And 4096 indices.)

I haven't dug into the DTS renderer yet to see why, but I am guessing it allocates a dynamic vertex buffer. Any reason why it's a fixed number? Like some funky performance issue?

Unfortunately, my computer gave an NMI memory error and crashed after I dropped the model into a stripped-down mission so I didn't get a chance to test it beyond that last night.

#1
06/04/2004 (10:03 am)
It's a fixed number because we allocate a single pool for use by all dynamix vertex buffer users. We had to pick a number, and 4k seemed like a reasonable one. There are some defines you can use to change it. Brian might have some insight into this issue. Our orc is about 4500 polies, so it should be working.
#2
06/04/2004 (10:38 am)
Hmm well the Orc is around 4500 polys, but it's broken up into different materials, so it doesn't it all at once. We should probably kick up that number, I'll do that today.
#3
06/04/2004 (10:39 am)
I see. So your batching dynamic vertex buffers into one. That's what you want to do, actually. I should have thought of that sooner.

Maybe the system should determine this at runtime using some kind of allocate_dynamic_vertex_buffer() call? In other words, a virtual allocator that grabs a chunk from a single, pre-allocated pool?

I hate the idea of 4000-or-so verts sitting unused if I were to make a simple DTS box. Maybe it already does this?

Sorry, I don't have the code at hand and I haven't messed with TSE too much so I am very unfamiliar with how it outputs triangles to the card.
#4
06/04/2004 (11:32 am)
The verts are allocated for the scene actually, so they won't go unused if you just have a simple .dts in there. Static .dts meshes have their own allocation actually, it's just the skinned ones that need to use the dynamic verts. 4096 verts don't take up that much video RAM - it's about the same as a 256x256 RGBA texture (uncompressed).