DirectX and that horrible math thing...

Started by
4 comments, last by TomKQT 13 years ago
Hi there,

I'm new to coding, currently studying game coding (C++) full time and we're currently doing the math section. This is where I'm struggling, trig, geo, hell, even algebra are messing with my head.

Right, my question is, although I'm doing my best to learn all this stuff, at the end of the day, will DirectX/Open GL etc handle stuff like rotation for me, rather than having to do everything manually myself? As in, is there a "rotate", or "scale" function? Doing the math just to find the distance from point a to b is mind boggling and time-consuming and I have used tools such as Unity and Gamesalad (don't get me started on that one) that do these things extremely quickly.

Sorry for the noob question, just wondering if stuff is gonna get easier. LOL.

Cheers!
Advertisement
DirectX doesn't have a concept of scale/rotation/translation, or anything like that. The old fixed-function stuff (no shaders) in D3D9 and prior would use a single transformation matrix for those purposes, but all it did was take the matrix. It was up to the calling code to calculate the required matrix. When you're using shaders everything is handled in your shader code, and D3D doesn't know or care how you handle transformations.

The D3D SDK does come with math libraries that have helper functions and classes for doing this stuff. So there's a function for generation a rotation matrix, or multiplying matrices, or calculating the length of a vector, etc. In fact there's actually two such libraries: D3DX, which is older, and XNAMath, which is newer. XNAMath is probably a bit more awkward to use, because it's designed to take better advantage of SIMD operations (SSE/SSE2 stuff).
Check out the free Khan Academy videos to help catch up on your math. They are very good, and not too dry to follow.
You can probably get by without knowing the linear algebra for a little while, maybe you can get some small game prototypes going. But unfortunately if you don't understand it, you're going to find yourself hitting the same wall over and over again, it will be very frustrating. Pretty much any advanced graphics techniques will require you to be familiar with the concepts of the different transforms, and if you don't have some understanding how it works you won't be able to debug your own code, and it will drive you nuts.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
Thanks for the speedy replies :) I'm struggling as I haven't done maths since school... 1991 - lol. But I'll get there. I'm amazed how far I've come in a few weeks, from knowing 0 about code to being able to write simple games etc. Pretty powerful. Guess I just keep my nose in the books!

Oh, and yeah, Kahn Academy is great... I have already started there... I just seem to have a brain that acts like a sieve when it comes to anything mathematical!

I'm struggling as I haven't done maths since school... 1991 - lol. But I'll get there. I'm amazed how far I've come in a few weeks, from knowing 0 about code to being able to write simple games etc. Pretty powerful. Guess I just keep my nose in the books!


Books about DirectX, about 3D graphics or even about game programming in general usually start with some chapters about basic vector and matrix / transformation math. At least all the books I have contain this (and it's starting to be boring for me :rolleyes:).

This topic is closed to new replies.

Advertisement