Archived

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

adriano_usp

How to increase the performance?

Recommended Posts

adriano_usp    396
Hi, I built (simulated) a simple scene of a commercial game, and I get: - about 70fps in the commercial game - about 40fps in my scene Please, could you give me some hints about how to optimize the code? What are the most common "mistakes/slips" to provide low performance? I’m using .x files (static meshes), .bmp e .tga (alpha) textures, flat reflections, point light… Thanks.

Share this post


Link to post
Share on other sites
Raloth    379
Watch for redundant SetTexture calls or SetStreamSource calls. Use as view vertex buffers as possible, but don''t make one giant 40 megabyte vertex buffer. Always use indexed buffers. Use as few calls to DrawIndexedPrimitive as possible.

Those are the things you should keep in mind.

Now, about meshes. DrawSubset = inefficient. It calls SetStreamSource and SetIndices every time you call it so it is not the most efficient. If your data is static then you should retrieve the vertex/index buffers from the mesh interface and manage it yourself.

Share this post


Link to post
Share on other sites
adriano_usp    396
Thank you for your answer.

I''m using 3d studio max to create the .x files. Is it a good idea to generate a .x file composed by a lot of meshes or this decrease the performance? Could a complex texture mapping affect the performance? Are there rules to model a mesh to generate a optimized .x file?

Sorry by my English, OK?!

Share this post


Link to post
Share on other sites
Raloth    379
The less subsets you have in your mesh, the better. Unfortunately that''s all I can tell you . The mesh interface has an Optimize function which will reorder vertices into the most optimal position and connect vertices are the same but I doubt it will help much.

Share this post


Link to post
Share on other sites
adriano_usp    396
Raloth, thanks again.

Please, is there a simple procedure to retrieve the vertex/index buffers from my xfiles meshes (to apply DrawIndexedPrimitive method)? I never used this.

Share this post


Link to post
Share on other sites
billybob    134
use your own mesh class? its not that hard, and you can optimize the crap out of it compared to ID3DXMesh (that is what you are using right?)

you can allocate vertices from a big (static?) vertex buffer, you can batch renders easily, you can do loads of stuff that will speed it up.

Share this post


Link to post
Share on other sites