Jump to content
  • Advertisement
Sign in to follow this  
Promit

Seperating vertex positions from other info (for efficiency)

This topic is 5401 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

DISCLAIMER: I am well aware that the godly TnL units on most video cards make this unneeded. But it's an interesting thing to consider. Also, this isn't a question, it's a discussion. Frequently, some sort of mesh will have many vertices with exactly the same position, but different material/tex coord information. Currently, the only way to use these vertices is to create multiple duplicate vertices, all with the same position but having different tex coords. This results in vertices with the exact same position information being transformed multiple times, when really they don't need to be. So, my question is, how can one avoid multiple transformations of what is essentially the same vertex? Let's take an exaggerated example. Suppose we have some arbitrary vertex pool, in an indexed tri list, that averages 9 duplicates per vertex position (that is, 10 identical verts total), all with different texture coordinates. Let's suppose that most of these vertices are, on average, fairly close to each other in order of use (so they are all close together in the index buffer). Is it possible to somehow redesign this thing to effectively and efficiently recycle transformation information? (You can consider this either from an application or driver perspective.)

Share this post


Link to post
Share on other sites
Advertisement
Direct3D attempts something like this with multiple vertex streams, but unfortunately there is only one index buffer allowed per batch. So each stream (geo, tex, bump, etc) must have the same number of elements (and be referenced by this single index buffer). Also, since most drivers are overly sensitive to stream switching, multiple vertex streams coupled with mutiple index streams would probably present a serious performance problem.

joe
image space

Share this post


Link to post
Share on other sites
Are you talking aboput hardware? In that case, I 'd say it isn't worth it if you consider vertex shaders. There's no way for the driver to know what part of the sahder that depends on what attributes without extensive analysis of the shader. What if the position vector is four components and the w part is some kind of lerping factor that affects colour? Then a position change means updated lighting calcs. It could theoretically work for fixed function, but it would make the vertex cache MUCH more complex so I doubt it would be worth it on the typical models people use (most vertices share everything, a couple needs splitting).

There is hardware that can handle separate index streams for different attributes (the Flipper chip in the Game Cube IIRC), but this is actually not that big of a win, since if you do the math you'll realise that the extra index bandwidth will eat up any gain you get from not having to split vertices on most data sets.

Share this post


Link to post
Share on other sites
Let's stick to fixed function pipeline, for this discussion. Again, I'm aware that this is really not relevant to reality.

[Edited by - Promit on October 6, 2004 12:58:40 PM]

Share this post


Link to post
Share on other sites
I don't think this is that big a deal in reality. The main situations where you get these kind of duplicated vertices are where there are texture seams and where you have a hard edge requiring two different normals. As a proportion of the total vertices in the mesh such vertices are not all that common in most real models. Your exaggerated example is hugely exagerrated I think - it's rare for a single vertex to be at the junction of more than two boundaries so it's rare for there to be more than 2 duplicates of a vertex. Vertices that need duplicates are a small proportion of the total so the average number of duplicates for the entire mesh is much lower than 2. I would expect there to be fewer duplicates in a typical mesh than there are degenerate verts in a typical stripped mesh.

Whilst there is hardware that can maintain separate index lists for separate streams I don't think the minor benefits are worth the additional complexity. The cost of all those extra index buffers is also not insignificant. It's one of those cases where the 'solution' is worse than the problem.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!