• Advertisement
Sign in to follow this  

max Vertices for a Mesh with Directx9?

This topic is 4966 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi @all actually i decided to write a little 3d-game... all that database stuff i had to do in last time was so boring... now i discovered a strange thing... i created some funny 3d-models and imported it as an x-file. that works fine.. with all shading, texture, transparency .... so i decided to make a bigger 3d-modell... something like a landscape. i tryed to load this as an x-file again... but my prog crashed. this bigger mesh containes 60.000+ vertexes code line (i'm using managed VB + Directx9): localMemoryMesh = systemMemoryMesh.Clone(0, systemMemoryMesh.VertexFormat,device) is there a maximum for vertexes? why this one crshed and other simpler meshes pass this code? thx for every hint freakdesign

Share this post


Link to post
Share on other sites
Advertisement
For meshes using 16-bit indices, the maximum is 65535. In contrast, 32-bit indices make possible 2^32-1 (approx. 4.3 billion) vertices per draw call.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nik02
For meshes using 16-bit indices, the maximum is 65535. In contrast, 32-bit indices make possible 2^32-1 (approx. 4.3 billion) vertices per draw call.



Yep. Though you should bear in mind that many devices which support 32-bit indices DO NOT actually support 2^32-1 vertices per call.

The actual number supported by your hardware can be determined by looking at the DeviceCaps property of your D3D device. In particular the Caps.MaxVertexIndex property of the caps structure.

Caps.MaxPrimitiveCount also tells you the maximum number of polygons which can be rendered in a single draw call.


[from the code posted, I'm assuming managed DirectX here. For unmanaged stuff there are similar caps]

Share this post


Link to post
Share on other sites
much thanks to S1CA and Nik02..... with your help i figured out that there are 16 and 32 bit indices... now i will try to get 32 bit indices, my project actually uses 16 bit

thx for help


freakDesign

Share this post


Link to post
Share on other sites
It is worth noting that many cards ordinary people use do not even support 32-bit indices - for example, Geforce MX series. You should design a fallback of some kind; a simple geometry reduction may be enough, or maybe splitting geometry to many smaller buffers.

S1CA: I was going to mention your first point [smile]
It is not even practical for a consumer card to actually support drawing 232 vertices per call, since allocating that amount of vertices would require a cool 128GB of memory (assuming 32 bytes per vertex).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
This one will be pretty easy to solve. The line where you say:


localMemoryMesh = systemMemoryMesh.Clone(0, systemMemoryMesh.VertexFormat,device)

Check help for Clone , it will tell you what kind of FVFs you can use. There is a FLAG mentioned like "imaginary": FVF_USE32BIT.

Then just say:

localMemoryMesh = systemMemoryMesh.Clone(0, systemMemoryMesh.VertexFormat | FVF_USE32BIT,device)

--
Another thing. You could split your mesh in several small meshes. It would work too. And on any graphic card.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement