Optimizing a Mesh

Started by
13 comments, last by nick316 22 years, 2 months ago
If I am rendering a mesh with draw subset will draw subset work any faster if i clone the mesh to be write only and call mesh->optimize() before rendering? Or will i only see a speed increase if i am rendering using draw primitive? Any comments welcome. Thanks, Nick
Advertisement
Quote from Microsoft:

DrawSubset() draws all triangles of a given attribute
Needs Attribute Table
Else it does linear search per face
Efficient if attributes are sequential, starting from 0
Else it does search of attribute table
Uses Fixed Function FVF shader
Avoid unless all above conditions met.

As you can see if you optimize you can meet the aboveand get decent performace.

I think.....

Neil


WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
I think that is a yes to mesh->optimize().

The WRITE ONLY option would not allow access to the mesh
for other operations so that would be the downside.


---------------------------------------------
"Do unto others, whatever you think is funny"
---------------------------------------------
Nice work thedo, Big improvement.
Thanks alot.
Optimize will do all optimizations, including attribute sorting. However, the big (up to 200%) perf win is in the vertex cache optimization reordering.

OptimizeInPlace will reorder the index buffer, but not change the vertex buffer. If you create the mesh D3DXMESH_VB_WRITONLY flag, then you can still reorder the index buffer and keep your vertex buffer unchanged. There is little perf gain on current hardware for a writeonly index buffer, but if you create a mesh with one, you won''t be able to optimize after that.



EvilDecl81
Hello EvilDecl81,

You bring up some good points. But in my case I had
to experiment a little bit with this stuff. Here is what i found.
The D3DXMESHOPT_VERTEXCACHE flag did not help me at all. Only
when I used the D3DXMESHOPT_ATTRSORT did i see a huge perf
increase. The solution to the write only mesh is to create it,
call optimize and then clone the mesh with the writeonly flag
specified.

hr = g_pMesh->CloneMeshFVF(
g_pMesh->GetOptions() | D3DXMESH_WRITEONLY,
g_pMesh->GetFVF(),g_pd3dDevice, &outMesh);

In my experience Atrribute sorting produces the faster results as state changing is SLOW. Vertex cache optimisation should help too though....

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
Does this sound like a reasonable frame rate.
The card is a 32mb nvidia gforce 2 gts.
I am getting about 60fps for 30,000+ faces.
Not counting collision detection.
Any comments welcome.

Thanks,
Nick
Not exactly great.

I have Duron 1Ghz, 32Mb Geforce2 MX, 512 MB RAM and win XP and consistantly get 3-4 million polys per sec in my prog.

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
I should have explained that more.

The 30,000+ faces is a golf hole. This golf hole demo has
full collisions on everything and multiple animated
meshes.

This topic is closed to new replies.

Advertisement