Friday, January 09, 2009

Which is Faster: Panel Texture or 3-d Instruments

There are two ways to make 3-d instruments in your 3-d cockpit:
  • Create 2-d instruments on a panel and use the "panel texture" (ATTR_cockpit or ATTR_cockpit_region in your OBJ) to show those 2-d instruments in the 3-d cockpit.
  • Model the instruments in 3-d using animation.
So...which gives better framerate?  Well, it turns out that they are actually almost the same...a few details:
  • If your card can't directly render-to-texture, there is an extra step for the panel texture. But that would be a weird case - all modern cards can render directly to textures unless you have hosed drivers.
  • For very small amounts of geometry, there's pretty much no difference between rotating a needle using the CPU and telling the GPU to do it by changing the coordinate system.
  • The panel texture does put pressure on VRAM - if you've had to go to a 2048x2048 panel texture to have enough space, it's going to hurt you.
Both approaches are actually quite inefficient - you get best vertex throughput on the card when you have at least 100 vertices per batch.  But if a panel has 800 batches, you don't necessarily want to do this - you'd pick up 80,000 vertices just trying to "utilize" the graphics card.  That's not a huge number, but it's big enough to consider.  Panels have enough moving parts that they're going to push the CPU more than the GPU.

A number of authors like the 3-d approach because they are more comfortable with 3-d tools, and because it can look sharper (since there is no intermediate limiting texture resolution). 

There is only one case where I would advise against the 3-d approach: if it takes a huge number of animation commands to accomplish what can be done in one generic, use the panel texture; the generic instruments are all coded cleanly and none of them take that much CPU power.  But some of them produce effects that would be relatively difficult to reproduce with animation.

No comments: