Truth Seeking through Game Making
Tuesday, May 10, 2005
  3D: Essential mathematics

I spent five hours of yesterday morning continuing my 3D graphics programming journey. After experimenting with DirectX a little, I knew I needed to refresh my Math a bit. So I fired up the DirectGraphics SDK help files to look for the list of D3DX library’s mathematic functions. This is what I found:


Data Types
D3DXMATRIX – 4x4 (16 floats) MATRIX

D3DVECTOR3 – 3D VECTOR (3 floats)

D3DXPLANE – plane normal (x,y,z) and distance from origin (4 floats)

Matrix and Transformation Functions
D3DXMatrixMultiply – Multiply two 4x4 matrices

D3DXMatrixRotation{X/Y/Z} – build rotation matrices for a particular axis

D3DXMatrixTranslation – create a translation matrix

D3DXMatrixRotationYawPitchRoll – rotate about all axes in one call

D3DXVec3TransformCoord – Multiply 3D vector with a 4x4 Matrix

D3DXVec3TransformNormal – result vector is normalized

D3DXVec3Transform – (x, y, z, 1) -> resulting vector is (x, y, z, w) where w != 1

Vector Functions
D3DXVec3Cross – cross product – returns a vector perpendicular to A and B

D3DXVec3Dot – dot product – return as cosine of the angle between two vectors (float)

D3DXVec3Length – determine the magnitude (float) of a vector

D3DXVec3Normalize – Makes vector unit length


So from this list of functions, I knew which part of mathematics I needed to review or re-learn in my case. I searched Google for:

Linear Algebra (Matrices and Vectors are part of linear algebra)

3D Math

Matrix Multiplication

3D vectors tutorial

3D Rotation Matrix

GameDev.NET 3D Graphics article/tutorial list


After solidifying my mathematics, I went back to the DirectGraphics SDK help files to examine individual D3DX math functions. With my new found knowledge, I recoded the 3D wire-frame rendering pipeline using matrices and vectors. Later today, I am going to continue this journey with DirectX (my API of choice for now).

 
Comments:
All the best in your self learning. If you are using .net, I would recommend you stick to c++ as we (your senior) experience alot of bugs and performance issue in .net directX with c#.
 
thanks. care to explain some bugs and performance issues you have?
 
Hi miica, nice to know you visit my blog.

I am just learning the workings of a 3D rendering engine. I would love to exchange code and am delighted at the opportunity to analyze codes together. We can discuss it in the MGDC forums as there are some local 3D graphics programmers there.

Math? The link I posted? Oh the one on discrete math?

Honestly, I am not good at algorithms and discrete math. That is why I am trying to brush up my logic skills. To me it seems like programming more is not helping me enough. Formal theory and analysis does help here. That is just for me.

We sometimes need to fail to know how to succeed. So don't give up and don't see failure as a failure okay?
 
I would look at your code. I am only a beginner in 3D graphics programming. So I probably can't give much comments.

However I will post up codes for my project when I setup a webspace or something. I am planning to do so anyway.

Nice webpage you have there.

You mentioned going to college/uni next year, have any idea where yet?
 
There is a software and animation course in MMU. Check it out
 
Post a Comment



<< Home
John Tan is an entrepreneur, programmer, games developer, game designer. He lives in Cyberjaya, Malaysia and operates a startup game company, Hatchlings Games. His current interest is on Web 2.0 Gaming.

ARCHIVES
January 2005 / February 2005 / April 2005 / May 2005 / June 2005 / October 2005 / November 2005 / December 2005 / January 2006 / February 2006 / May 2006 / June 2006 / September 2006 / November 2006 /


Powered by Blogger