Archived

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

Hardware (T&L) acceleration in DirectX

This topic is 5501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been studying the DirectX extension for a while, and pondering how to code most effectively. Obviously, a custom-made matrix multiplication (that takes into account for the zeros in the simple matrices, like translation and rotation) may be a lot faster than one in the libraries, for example provided by DirectX. However, if this work is off-loaded into the GPU, it might be more effective than my own routine in the CPU. As far as I understand T&L (DirectX 8 hardware), I have to provide the GPU with a complete world-view matrix and a projection matrix. So far so good, but can I just give it a world and a view matrix and it does it as well? Basically my question is, in DirectX, what transformations are handled by the CPU, and what by the GPU?

Share this post


Link to post
Share on other sites
Combined matrices reduce the number of Multiplies and/or additions that need to be performed. This increases performance and is the very reason matrices are used for graphics.

To get a true understanding of the math optimizations behind matrices, do a little experiment on paper:

Create a set of coordinates that comprise a cube (call it C6
because there are six vertices to transform!)
Now come up with a view (V) and world (W) transform matrix.
Now do the calculations by hand...
C6*V=C6V produces 6 matrices, one for each vertex
C6V*W=C6VW produces 6 matrices, one for each vertex
Write down all the multiplies and additions.

Now calculate:
V*W=WV produces 1 matrix
C6*WV=C6VW produces 6 matrices, one for each vertex.

Just doing this mental exercise should let you see the savings... as the number of vertices increase, this technique because absolutely necessary.

For even further optimizations, check out quaternions.

-JR

Share this post


Link to post
Share on other sites