What is ID3DXMesh::Optimize Method?

Yes, I know this is opengl forum.
But I’m curious about this type of function that doesn’t exist in opengl.
And I know many guys in this forum can do directx as well as opengl.
So, please let me ask.
What does this funtion do?

from sdk help -------------------------------------------------

ID3DXMesh::Optimize Method

Controls the reordering of mesh faces and vertices to optimize performance, generating an output mesh


Does this mean “just converts triangles to triangle strip”?
ID3DXMesh::Optimize() == generate strip? That’s all?

>>>Controls the reordering of mesh faces and vertices to optimize performance, generating an output mesh<<<

Have you seen the demo using that function?
It makes a large difference and I doubt that reordering will acheive that.

I don’t know what it does but I’m guessing it’s stripification that mainly improves performance.

Stripification would only improve performance if the strip generated contained very few degenerates, and a high vertex cache hit rate.

With hardware transform and a vertex cache, the major difference against triangle lists (for for strips) is the bandwidth of your index list, which isn’t all that much. Meanwhile, a triangle list will have no degenerates, and if it gets good cache utilization, may result in less cache misses than a triangle strip.

That being said, you’re likely to be fill rate bound much more than transform bound, so neither of them will play much of a difference. For software transform cards, it often still doesn’t make much of a difference, as long as you use LockArrays() or DrawRangeElements().

Try re-ordering a well-ordered triangle list to draw triangles in random order some time; you’ll easily get a 2x slowdown, though. So that Optimize() function may very well be about ordering.

The DirectX 9 SDK documentation says the same thing as the original post, so I really think it’s about triangle ordering (and possibly sorting material attributes, if necessary).

Thanks guys!
And I saw the “Optimized Mesh” dxsdk demo source and there is seperated stripification functions called D3DXConvertMeshSubsetToStrips() and D3DXConvertMeshSubsetToSingleStrip().
It seems Optimize() is for just reordering indices and vertices and demo combine it with D3DXConvertMeshSubsetToStrips() or D3DXConvertMeshSubsetToSingleStrip() to boost mesh performance.

>>>Try re-ordering a well-ordered triangle list to draw triangles in random order some time; you’ll easily get a 2x slowdown, though. So that Optimize() function may very well be about ordering. <<<

So you think the .x files I opened were purposefully written to be inefficient when loaded as is.
I have seen one obj files that was like that, but .x files are harder to look at.

The more important question is, how do you write such an algorithm. If it’s about consecutive triangles with at least 2 indices in common, then this is likely to happen with tri_strips.
What else is there? KNowledge of the cache size, cahing algorithm, …