Jump to content

  • Log In with Google      Sign In   
  • Create Account


Indices VS Vertices


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 gnomgrol   Members   -  Reputation: 549

Like
0Likes
Like

Posted 13 August 2012 - 06:24 AM

Hello fellows,
I came up with some questions other beginners in 3D stuff are may interested in also.
What are the pros/cons of using pure vertices for a mesh (Trianglestrip), or using indexed vertices (Trianglelist)?
I run a few tests with DrawInstanced and DrawIndexedInstanced. It appeared to be much more performant when I was using only vertices.
Are there some tips what to use when? What provides which advantages?
When I load models/animations what should I use?
You may know a good article on this?

EDIT: What is a maximum number of vertices send to GPU per frame to remain fine performace on a medium pc?

Thank you

Edited by gnomgrol, 13 August 2012 - 09:30 AM.


Sponsor:

#2 Ripiz   Members   -  Reputation: 529

Like
0Likes
Like

Posted 13 August 2012 - 06:36 AM

Indexed meshes don't have duplicate vertices. With proper management it'll make your models smaller in size and faster to render due to vertex cache.

#3 eppo   Crossbones+   -  Reputation: 2298

Like
0Likes
Like

Posted 13 August 2012 - 09:04 AM

Always use triangle-order optimized indexbuffers. (e.g. D3DXOptimizeFaces()).

Strips vs. Lists: from my experience both perform equally well on modern hardware, but strips are smaller (lists 3 indices per triangle, strips +/- 2 indices per triangle).

#4 kauna   Crossbones+   -  Reputation: 2140

Like
2Likes
Like

Posted 13 August 2012 - 12:31 PM

EDIT: What is a maximum number of vertices send to GPU per frame to remain fine performace on a medium pc?


Depends greatly how you implement it. You can send several megabytes of data through dynamic vertex buffers, textures, buffer objects (etc) to the GPU per frame and maintain good fps. Of course the most efficient way to draw is not to send data to GPU and use static buffers which already reside in the GPU memory. Since that isn't realistic case, you'll need to take care about the amount data that travels through the bus to the GPU.

Top GPU's can handle some hundred of millions of polygon's per second in test scenarios. The question of maximum vertices per frame is highly relativistic depending on the overall complexity of the used vertex/pixel/geometry/domain shaders + size of polygons + amount of used shader resources + number of used render targets and surface formats + blending operations + etc ... you get the point.

Cheers!

#5 gnomgrol   Members   -  Reputation: 549

Like
0Likes
Like

Posted 13 August 2012 - 01:03 PM

Thanks for your concern.
Currently I am sending 256*256*6 indices for 256*256 vertices (with pos and texcoord). Drawing 50 of those with DrawIndexedInstanced. Instancedata is just setting X and Z offset , and the vertex and pixelshader are pretty basic. Just one rendertarget, everthing else basic also. It's the only thing I'm doing per frame. The FPS fall down to 10. I dont really get why this is happening. Is this really already to much data to send?
When I throw the DrawIndexedInstanced line out, FPS go up to 350.


How can people do something like that maintain a decent performance???

Edited by gnomgrol, 13 August 2012 - 01:05 PM.


#6 mhagain   Crossbones+   -  Reputation: 7328

Like
1Likes
Like

Posted 13 August 2012 - 01:07 PM

Strips vs. Lists: from my experience both perform equally well on modern hardware, but strips are smaller (lists 3 indices per triangle, strips +/- 2 indices per triangle).

There's a tradeoff in this. Strips have a lower index count for sure, but lists can have a lower vertex count. With strips you're never going to get better than 1 vertex per triangle, whereas with a list the theoretical best case is 0.5 vertexes per triangle. As vertexes tend to be larger than indexes (is there ever any case in which they're smaller?) this can amount to a huge saving in vertexes as the cost of a smaller overhead in indexes.

That's not the full story though. The precise saving you'll get will be heavily dependent on the model you're rendering; if you have a lot of duplicated data then obviously there is more saving to be made with lists. You can also consider strips with primitive restart if you can target more modern hardware (which I assume is the case since you mentioned D3D10/11 draw calls), although my own experience is that it tends to be something of a wash between that and lists.

It's rarely mentioned but lists are also good for concatenating multiple strips (which you can also do with primitive restart) and for concatenating strips with fans and/or quads (which you can't do with primitive restart). Given the huge bandwidth of modern hardware that one point, IMO, tends to lead to me generally favouring lists, as it can result in less (and faster) preprocessing of model data in order to get it into a format where it can be used for drawing with, even in cases where a single large strip may benchmark as more performant. It also can lead to cleaner simpler code if everything can go through a common draw point.

One final point worth noting is that lists were used for everything in Quake 3 Arena; see: http://www.gamers.org/dEngine/quake3/johnc_glopt.html. Yes, it's an old old old game, and yes, it's OpenGL, not D3D, but it was used as a common graphics benchmark for such a long time that it should be considered as a reasonable indicator of the direction much graphics hardware and drivers have been optimized in.

Always use triangle-order optimized indexbuffers. (e.g. D3DXOptimizeFaces()).

It's worth noting that these calls, despite being D3D9 and not present in 10 or 11, can be used in D3D10 or 11 by just including the relevant headers and libs.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#7 kauna   Crossbones+   -  Reputation: 2140

Like
0Likes
Like

Posted 13 August 2012 - 01:31 PM

When I throw the DrawIndexedInstanced line out, FPS go up to 350.


Using debug or retail build? using debug or retail d3d libraries? Your hardware? Any errors in debug windows?

How can people do something like that maintain a decent performance???


The video shows and explains it pretty well ... instead of drawing lots of trees, they use clever impostor tricks.

Cheers!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS