views:

717

answers:

6

An old Direct3D book says

"...you can achieve an acceptable frame rate with hardware acceleration while displaying between 2000 and 4000 polygons per frame..."

What is one polygon in Direct3D? Do they mean one primitive (indexed or otherwise) or one triangle?

+2  A: 

According to this page, a polygon is n-sided in Direct3d.

In C#:

public static Mesh Polygon(
    Device device,
    float length,
    int sides
)
David Segonds
+5  A: 

That book means triangles. Otherwise, what if I wanted 1000-sided polygons? Could I still achieve 2000-4000 such shapes per frame?

Jim Buck
+4  A: 

In practice, the only thing you'll want it to be is a triangle because if a polygon is not a triangle it's generally tessellated to be one anyway. (Eg, a quad consists of two triangles, et cetera). A basic triangulation (tessellation) algorithm for that is really simple; you just loop though the vertices and turn every three vertices into a triangle.

Jasper Bekkers
+3  A: 

Here, a "polygon" refers to a triangle. All . However, as you point out, there are many more variables than just the number of triangles which determine performance.

Key issues that matter are:

  • The format of storage (indexed or not; list, fan, or strip)
  • The location of storage (host-memory vertex arrays, host-memory vertex buffers, or GPU-memory vertex buffers)
  • The mode of rendering (is the draw primitive command issued fully from the host, or via instancing)
  • Triangle size

Together, those variables can create much greater than a 2x variation in performance.

Similarly, the hardware on which the application is running may vary 10x or more in performance in the real world: a GPU (or integrated graphics processor) that was low-end in 2005 will perform 10-100x slower in any meaningful metric than a current top-of-the-line GPU.

All told, any recommendation that you use 2-4000 triangles is so ridiculously outdated that it should be entirely ignored today. Even low-end hardware today can easily push 100,000 triangles in a frame under reasonable conditions. Further, most visually interesting applications today are dominated by pixel shading performance, not triangle count.

General rules of thumb for achieving good triangle throughput today:

  • Use [indexed] triangle (or quad) lists
  • Store data in GPU-memory vertex buffers
  • Draw large batches with each draw primitives call (thousands of primitives)
  • Use triangles mostly >= 16 pixels on screen
  • Don't use the Geometry Shader (especially for geometry amplification)

Do all of those things, and any machine today should be able to render tens or hundreds of thousands of triangles with ease.

jrk
A: 

Your book seems to be clearly talking about triangles, and it seems very old indeed, triangles are a very, very small part of the picture nowadays, with sub 100$ video hardware dealing with hundreds of millions of triangles per second with no problems.

No, really, don't think of polygon counts as a limitation unless you are working on super old hardware or hand held devices (or have some weird fetish for boxes ;)

The real problem is to feed the video card the right way, issues like render state changes, cache coherency, non-optimal data formats, stalling shader instructions and slow data access (to name a few) are the issues that really kill performance, the number of polygons is hardly in the picture at all.

To give you a feel for how things work, you should take a look at Tom Forsyth's little DirectX FAQ, he's really good and has put time and work to find out and write these things down for the rest of us :)

3D hardware is complex, but also insanely powerful and fun and a very healthy alternative to the traditional x86 way of thinking.

Rodrigo Lopez
A: 

As others already said, polygons here means triangles. Main advantage of triangles is that, since 3 points define a plane, triangles are coplanar by definition. This means that every point within the triangle is exactly defined as a linear combination of polygon points. More vertices aren't necessarily coplanar, and they don't define a unique curved plane.

An advantage more in mechanical modeling than in graphics is that triangles are also undeformable.

stevenvh