Sign in to follow this  
88er

how to optimze my 3d scene??

Recommended Posts

My computer: p4 2.6 1G DDR FX5600 128M 80g HD I run my d3dapplication with a huge model,it has 370000 vertices and 37M textures.As you suppose,it's only 0fps.but I remove the all texture it gets 100fps. In my opinion,my vertex format is struct D3DSHADOWVERTEX { D3DVALUE x, y, z; D3DVALUE nx,ny,nz; D3DVALUE tu0, tv0; D3DVALUE tu1, tv1; }; it take 40byte, 40 X 370000 = 1480M >> 128M, why it runs so quickly.and how to judge the maximal of vertices and textures for my computer.

Share this post


Link to post
Share on other sites

1) Check your maths!
a) 40 * 370000 = 14800000 bytes
b) 14800000 / 1024 = 14453.125 Kilobytes
c) 14453.125 / 1024 = 14.114 Megabytes
d) 14.114 Mb < 128 Mb




2) If your resources (vertices, textures, frame buffer, etc) DO use more than the available video memory of the hardware, then the driver will start to use AGP memory (aka Non-Local Video Memory).

The amount of AGP memory available is determined by the AGP aperture size set in the BIOS. So you may have 128Mb AGP + 128Mb VRAM to play with!!

Of course you shouldn't rely on having that much available if at all possible.




3) You haven't told us enough about your application to be able to diagnose why you see such a large difference in performance between the textured and untextured model. For example:

a) is the number of Draw*Primitive() (or D3DX mesh draw) calls the *same* in both tests ??

- having that much texture could indicate that your mesh uses multiple texture maps - if there are lots of them, then that implies lots of Draw*Primitive() calls. Having too many draw calls compared to the amount being rendered is very bad for performance.

- if you do have more draw calls in the textured version, try packing multiple textures into a single texture map to improve your batching.


b) are your texture maps MIPMAPPED ??

- if not, then you will be losing a lot of performance due to texel cache misses.

- unless you can guarantee a 1:1 mapping/texel density between texels and pixels on screen, use MIPMAPPING!


c) are you using a PURE device ??

- a PURE device is slightly faster than a non-PURE one when your application is not doing "bad" things.

- however, if you do "bad things" with a PURE device, the result will often be terrible performance (e.g. 0fps with texturing enabled). This is because a PURE device bypasses all of the "sanity checking", validation and "fixing" work that the Direct3D runtime performs.

- for development, I'd suggest not using a PURE device until you are satisfied with your application's performance, AND you've ensured any warnings and errors from the debug Direct3D runtime are accounted for.


d) are you using the DEBUG DirectX runtimes ??

- if you're unsure, check the FAQ for this forum.

- try running with the DEBUG DirectX runtime and with the Debug Output level slider on a high setting. Then run with texturing enabled - do you get any errors or warnings? If so, fix those first!!

- when you're doing performance comparisons, always use the RETAIL DirectX runtime - some of the checking/validation which the debug runtime performs can give you false profiles




4) I'd suggest you get the Summer 2004 update for the DirectX SDK and:

a) read the following in the SDK documentation:
DirectX Graphics ->
Programming Guide ->
Advanced Topics ->
Accurately Profiling Direct3D API Calls

b) start using PIX to diagnose where the performance bottlenecks are for your application. PIX is documented in the SDK docs at:
DirectX Graphics ->
Tools ->
PIX for Windows

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this