Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nick316

Optimizing a Mesh

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

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

Share this post


Link to post
Share on other sites
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?!?!

Share this post


Link to post
Share on other sites
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"
---------------------------------------------

Share this post


Link to post
Share on other sites
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.



Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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?!?!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?!?!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!