Fog Creek Software
Discussion Board




Maths required for 3D

I'm a Database programmer, and would like
to write 3D apps (for fun, during my spare time)

My maths background is pretty nill, basic arthmetics that's all...
(I've dropped out of school a long time ago) :-(

Could please tell me what subjects in maths I should pick up please ... Any book recommendation ...

I learn best if I can apply (in a snippet of code for instance)
the implementation of a maths formulas for example ....

Any book which teach maths for 3D coding that way ?

3D Newbie
Monday, March 08, 2004

If I am not totally misstaken, you can find your answers
in a similar thread called
  Picking up math for 3D graphics for a dev
at   
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=121169&ixReplies=12

René Nyffenegger
Monday, March 08, 2004

Although learning maths for 3D by instantly writing code to implement the ideas will be useful, you'll derive the greatest benefit by also trying to become familiar with maths in general.

For example, one can usually state a solution to a problem in a way that can be computed; however, it is better if you can apply algebraic manipulations to that solution to yield a form that is more efficient to compute. So, although learning 3D maths will let you write 3D software, learning maths in general will make you not only a better programmer of 3D software, but a more sophisticated programmer in general.

My advice would be to get a book that allows you to review the maths you do know, brush up on that, and then work on from there. Once you start to encounter vectors and matrices, get yourself a book on 3D programming. Maths is a skill you need to exercise often to stay strong: do 30 minutes or so a day -- think of it as a workout for your brain.

C Rose
Monday, March 08, 2004


http://chortle.ccsu.edu/vectorLessons/vectorIndex.html

Good tutorial.

Miffo
Monday, March 08, 2004

i bought "Tricks of the 3D Game programming Gurus" by Andre Lamothe, i recommend it.

C++
Monday, March 08, 2004

Beware of LaMothe books. They may help you start out but are hardly indepth and often mis-leading. Terrible, terrible code-style, too.

Any decent book on linear algebra will help you. Get a good and recent book on graphics like "Real Time Graphics 2nd Edition".

The following link is good to get started with 3d graphics (much more so than LaMothe books), but don't understand it as definitive point of reference for anything graphics programming! It's really rather shallow, but gets you started quickly and that's what matters in the beginning.

http://nehe.gamedev.net

_
Monday, March 08, 2004

Ups, I meant "Realtime Rendering", sorry:

http://www.amazon.com/exec/obidos/tg/detail/-/1568811829/ref=pd_sim_books_3/103-8023547-0199844?v=glance&s=books

_
Monday, March 08, 2004

While technically not the best place to learn math, Andre Lamothe's books do get you a good overview of what you need. Also they allow you to completely ignore the math because he provides large amounts of source code to tinker with.

I don't think his coding style is a relevant gripe, he has years of experience writing gaming code, and coding for games is definitely not like coding for business apps. Also everyone's coding style is different, and most people think theirs is the preferred way of doing things.

He explains things in an easy to read and 'geeky' fun way and in his latest book takes you from beginning to end writing a software rendering 3d engine (an advanced Quake 2 like engine). This book does not cover anything about making games just the 3d rendering engine only.

Justin Kolb
Monday, March 08, 2004

> Andre Lamothe's books do get you a good overview of what
> you need

Granted, but they are a bit too expensive for only that purpose, because you can get it at places like NeHe, too. Either one isn't high-quality but easy to learn, but you don't have to hand over 40$ for Nehe's services...

> Also they allow you to completely ignore the math

More a problem than a feature IMHO. What is it with so many people that they regard the dreaded MATH as something that's making things harder to learn? Basic linear algebra is easy! It makes things easier to understand. E.g. you could go through the hassle and try to understand translation, rotation, moving between camera-/world-/object space each on its own and then fiddle it together or once understand the bit of math about changing the basis of your vector space and be pretty much done with it.

> he has years of experience writing gaming code

Like these? http://www.xgames3d.com/

> Also everyone's coding style is different, and most people
> think theirs is the preferred way of doing things.

And then there's code that's just bad. Like LaMothes'...

> an advanced Quake 2 like engine

Hehe. No. Nowhere near as good. More eye-candy maybe.

_
Monday, March 08, 2004

http://www.flipcode.com/cgi-bin/msg.cgi?showThread=00010074&forum=3dtheory&id=-1

_
Monday, March 08, 2004


Take a look at "3D Math Primer for Graphics and Game Development" by Dunn and Parberry. Published by Wordware; ISBN=1-55622-911-9.

The book combines real world experience in 3D with solid discussions of the mathematics. The primary author, Fletcher Dunn, is a game developer working for Terminal Reality and the other author teaches mathematics and computer science at a university.

Mark Hoffman
Monday, March 08, 2004

(Preface: I bought *one* of LaMothe's books, back in '95 or so. Thought it was terrible, and never bought one again. I've glanced through all his newer publications and found my judgment confirmed every single time, but I certainly might be missing something - so take me with a grain of salt)

>Andre Lamothe's books do get you a good overview of what you need.

Uh, no. They give you a set of code to tinker around with. That's it. LaMothe is not exactly high on the "recommended reading list" of any game developer I know.

>Also they allow you to completely ignore the math because he provides large amounts of source code to tinker with.

Didn't the OP ask for exactly that? Math for 3D.

>I don't think his coding style is a relevant gripe, he has years of experience writing gaming code,

Have you ever *looked* at his games? There's not a single impressive title there. Mostly hobbyist stuff, and not that well done.

>and coding for games is definitely not like coding for business apps.

I don't know where you write games, but around here we *do* value clear and concise code. Well-structuredness is not exactly a minus, either. That's not exactly what you get from the LaMothe books I remember.

It's obvious by the titles: "Tricks of the Gurus", "Black Art of", etc. To quote one of my colleagues: "Damn it! Programming is NOT VOODOO!"

>Also everyone's coding style is different, and most people think theirs is the preferred way of doing things.

I don't think the reference was to where he puts his braces... more the general quality

>and in his latest book takes you from beginning to end writing a software rendering 3d engine

Which means he's basically teaching obsolete skills unless you're interested in the handheld market. Software rendering died around 1998.  (In the interest of full disclosure - I happen to think it might come back in a couple of years. But you're better off learning about pixel shaders on hardware)

>(an advanced Quake 2 like engine).

Uh, no. Download the Quake2 source if you want Quake2. He's not even close to that.

Anyway: If you want a compendium on everything 3D, start out with "Computer Graphics: Principles and Practices".

If you just want a math handbook, there's "Mathematics for 3D Game Programming and Computer Graphics".

If you're interested in building an engine, get "3D Game Engine Design : A Practical Approach to Real-Time Computer Graphics" by David H. Eberly.

Go from there -  all three have a good bibliography.

Robert 'Groby' Blum
Monday, March 08, 2004

Since you've flipped through his recent books and purchased one of his older books, we can all now assume you are the expert on them. You also mention the game developers you know, I'm assuming they've worked on major titles, not just the hobbyist crap of which you look down upon.

Furthermore you are recommending to the original poster that he earnestly learn the foundation of math involved and not take any shortcuts, but then on the other hand you say that software rendering is obsolete and should not be bothered with even though it is the basis and theory on which all hardware rendering is built.

It's obvious to me that the original poster is not a math genius but is interested in hobbyist 3d programming:

>My maths background is pretty nill, basic arthmetics that's >all...(I've dropped out of school a long time ago) :-(

Andre Lamothe provides just that, a low math learning curve (even though one of his 3 degrees is Math) and an easy going writing style that details the nitty gritty of the tons of working code provided. The higher brow books you are recommending do not seem appropriate for the original poster's clearly stated goal, a gentle introduction to 3d programming.

Opinions are like assholes
Monday, March 08, 2004

>Have you ever *looked* at his games? There's not a single impressive title there. Mostly hobbyist stuff, and not that well done.

Anyone this arrogant obviously knows what's up.

Justin Kolb
Monday, March 08, 2004


Guys.....There really aren't any "shortcuts" for learning the math required for 3D work. Even a hobbyist has to understand certain basic things. You can't get around this.

Sure, there are plenty of books that will try and hide the messy details, but once you sit down and try to do something you get that deer in the headlights look because you haven't the foggiest notion of what a vector or matrix is and you think a quaternion is some kind of melon.

The OP request information on the math; not books that dumb down 3D programming to the third grade level.

Ya gotta learn the math if you plan on doing anything more than just tweaking someone's else code. I'll get flamed for saying this, but doing hobbyist 3D work is kinda like being a hobbyist 747 pilot. Sure, you can probably learn to fly it but you'll never be able to take off or land without a lot of education and skill. Same thing goes for 3D work. Unless you have a good basis in algebra, trig and geometry then you'll be limited to what you can do.

Sin squared + cos squared
Monday, March 08, 2004

Very bad comparison, this guy is not trying to break into the game programming business he's just trying to tinker a bit. It's not like he could kill all his passengers by making a small mistake.

Tricks of the 3d Game Programming Gurus has a chapter dedicated to math that goes over the following subjects:

Mathematical Notation
2d, 3d, Cylindrical, Spherical Coordinates
Trigonometry
Vectors
Matrices and Linear Algebra
Computing the Inverse and Solving Systems
Basic Geometic Entities
Lines and Planes in 3d
Parametric Equations
Introduction to Quaternions
Basic Calculus

The next chapter then goes into how to implement the math related parts of your 3d engine and gives plenty of code to work with. Obviously if this isn't a good enough grounding in math for 3d graphics then I don't know what is. I know this because the book is right here in front of me and I've actually read it.

Justin Kolb
Monday, March 08, 2004

>Since you've flipped through his recent books and purchased one of his older books, we can all now assume you are the expert on them.

This was kind of the point why I mentioned that I haven't read the newer ones. It was a personal opinion, and I explained that it's only based on a passing acquaintance with his later books. Did I ever claim I was an expert on his books?

>You also mention the game developers you know, I'm assuming they've worked on major titles, not just the hobbyist crap of which you look down upon.

Indeed, they have. And so have (and do) I. But I've got no problem with hobbyist games. I've got a problem with somebody who is at an OK knowledge level pretending he's the king of game development.

>Furthermore you are recommending to the original poster that he earnestly learn the foundation of math involved

So far, yes.

> and not take any shortcuts, but then on the other hand you say that software rendering is obsolete and should not be bothered with

It's fairly pointless nowadays, yes. I don't see everybody interested in computers getting an EE degree either. Or even learning about it. You've got to pick your fights.


> even though it is the basis and theory on which all hardware rendering is built.

See above. Who cares. Unless you plan to build rendering hardware, only marginally interesting. Worth a sidenote, maybe.

>>Have you ever *looked* at his games? There's not a single impressive title there. Mostly hobbyist stuff, and not that well done.

>Anyone this arrogant obviously knows what's up.

Where'd I claim that?  I'm recommending the books I found well done and warn people away from what I perceive as low value.

>Tricks of the 3d Game Programming Gurus has a chapter dedicated to math that goes over the following subjects:
[snipped]

And that is the problem. It's a single chapter - not even close to being enough room to cover all those topics in sufficient detail.

>Obviously if this isn't a good enough grounding in math for 3d graphics then I don't know what is. I know this because the book is right here in front of me and I've actually read it.

Good for you. Let us know how you fare with it in the long run - after all, his writing style might have changed. As I said in my original post. You might also want to try one of the other books recommended in this thread and compare.

Robert 'Groby' Blum
Monday, March 08, 2004

Start writing something and when you get stuck look for an answer. Don't stop yourself by looking for an answer before you started.

http://www.vpython.org/
http://www.opengl.org/
http://public.kitware.com/VTK/

Tom Vu
Monday, March 08, 2004

I'm suprised noone mentioned James D. Foley's "Computer Graphics: Principles and Practice in C". It's the absolute classic in the field. It's not just devoted to 3D Graphics, but will give an indepth introduction to the entire field. It's pretty outdated in streches and you might want to consider using another programming language than C, but the wealth of topics covered is great. There's also a large appendix "Mathematics for Computer Graphics" (http://www.amazon.com/gp/reader/0201848406/ref=sib_rdr_toc/103-6913033-7939863?%5Fencoding=UTF8&p=S005#reader-page)

  -tim

a2800276
Tuesday, March 09, 2004

As for subjects to pick up - introductory linear algebra, a decent understanding of trig, and a basic grasp of numerical analysis should serve you just fine.

As I mentioned in the other 3D thread, Foley and Van Dam's "Principles and Practice" is absolutely a must-have for any sort of graphics work - I can't recommend it highly enough. As the above poster mentioned, some of the more technical stuff is out of date, but the fundamentals are all there, and explained in painstaking detail.

"Principles of Digital Image Synthesis" by Glassner is an amazing book, albeit pricey and dense. I'd highly recommend it if you want to go more in the direction of high-quality rendering and less towards real-time stuff - I wrote a photon mapper for a class project and the first volume helped a lot. Definately not a good "first buy," but might be good to look at once you've written a few apps.

Jimmy Jojo
Tuesday, March 09, 2004

*  Recent Topics

*  Fog Creek Home