Maximum number of triangles

Started by
4 comments, last by Julian90 17 years, 1 month ago
Hi everyone, I am trying to write a Direct3D 9 program that renders a surface composed of approximately 40000 triangles. A new frame should be rendered every 25 ms. It is safe to say that almost every vertex will change in value each frame. I am trying to make the program simple enough to run on a computer without a fancy graphics card (i.e. a decent laptop). Anyways, I am seeing that the program is not able to render the frames fast enough. I am confused as to why the computer is having such a problem keeping up. I would guess that most games are rendering many more triangles in a similar amount of time. I am just computing the vertices and then using DrawPrimitive( ) to render my surface. Is there a more advanced way of creating a surface that has better performance? My fundamental question is this: Ballpark, how many triangles should I be able to render in 25 ms given that I am using a generic graphics card? Assume that minimal computation is occurring besides the graphics rendering. Thanks, Zach
Advertisement
OK, where to start.

Well first since your talking about a laptop, unless it is a very decent spec, I doubt you really have more than a 32Mb graphics card, correct me if I'm wrong [wink]

And a wild guess, that your rendering ~40,000 polys, is that this is a terrain, right ?

Well, where to start hey ?

You could you LOD/CLOD (Level Of Detail) ... Search for that, and ROAM.

You could use back face culling, and frustrum culling.

How about Vertex Arrays, VBO, and I'm sure a dozen other suggestions I'm sure you'll get from others.

As for a 'Ball-Park' figure, I'd say that was very much down to your hardware spec.

And if you have the 'Red Book' (openGL Guide), take a peek at page 760.
----------------------------------------Now just hit that link that says 'Rate This User' [wink]
There's a lot of things that may be going on, such as locking your vertex buffers leading to pipeline starvation/stalls, and so on. However, we'll need to know a few things to really have a good idea of what's going on:

  • What actual hardware are you running on? "Decent laptop" is open to interpretation. A lot of interpretation. "Generic graphics card" is even less meaningful. Hardware varies immensely, and knowing the specifics is important.

  • What's the actual performance of the render, in milliseconds per frame?

  • Can you post the exact code you're using for filling the vertex data and drawing it? Specifically, are you using index buffers? What's the actual primitive type you're drawing? How many draw calls are issued per frame? (You shouldn't need more than 1.)

  • Are you running a debug or release build? Debug or release DirectX runtime?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Hi again,

Thanks for the replies. Here is my laptop spec: 2.1GHz Centrino, 1GB RAM, 64MB ATI graphics card.

By saying generic graphics card I am trying to say that I don't want to depend on having a powerful, expensive graphics card.

What I am rendering is very similar to a terrain. It is basically a 3d plotting surface. I'll have to look into LOD/culling (as I really don't know anything about them yet). But they do sound promising.

However, I do think that my major problem is in my code efficiency. ApochPiQ pointed at a few things that I think I am probably doing wrong. I can't post my code right now (as I don't currently have access) but here is what I found interesting:

- I am not calling DrawPrimitive only once. I am calling it 20000 times for 40000 triangles. I just keep making a trapezoid out of 2 triangles and calling DrawPrimitive( ) to draw that trapezoid. Do you think that the excessive calls are killing me?
- Also, I'm running in debug mode. Does release mode run significantly faster?

Thanks again for your help,
Zach
Quote:
- I am not calling DrawPrimitive only once. I am calling it 20000 times for 40000 triangles. I just keep making a trapezoid out of 2 triangles and calling DrawPrimitive( ) to draw that trapezoid. Do you think that the excessive calls are killing me?


Well there's your problem :-)
Try sending batches of about 1000 vertices using vertex and index buffers.
Making all those draw primitive calls eats up the CPU.
Quote:- Also, I'm running in debug mode. Does release mode run significantly faster?


Yes, the compiler doesnt do any optimization in debug mode and it emits special instructions to help you debug the code so realease mode can be 2-3 times faster.

You'll probally see the biggest difference from decreasing the number of draw calls though, modern (i.e. last 5-10 years) graphics cards tend to be optimized for 1000+ triangles per draw call, anything less and the time it spends setting up to draw is far larger then the time it takes to draw and then it does that again for the next lot and so on.

This topic is closed to new replies.

Advertisement