Advertisement

I used to think I knew something about math

Started by June 18, 2003 08:44 PM
24 comments, last by haro 21 years, 7 months ago
Three semesters of calculus and I really knew nothing about math. Just picked up "Tricks of the 3D Game Programming Gurus" a few days ago, and have been going through the math section (multiple times). Up until now I never realized how trivial it was to calculate an intersection with orthogonol plane in 3d, modelling a character''s position added with (vector movement * time) as a 3d parametric equation. Now you determine if the parametric line intersects the plane based on the desired t. If it does then you refuse the movement, otherwise let it happen. Quick and rediculously simple collision detection. I would be embaressed to describe how I was determining planar collision detection before reading this book. MODEL ALL OBJECT MOVEMENT DIRECTION AS A VECTOR AND EACH "UPDATE" OF THE MOVEMENT AS A PARAMETRIC LINE FROM p(initialPoint) to p(initialPoint)*vector(movementDirection)*time AND EVERYTHING IS SOOOOOOO EASY. Ok, its been my epiphany, so I will end my rant. =)
Heh.

I''m actually hearing good things about this book. And while I already do some 3D stuff with OpenGL, I might check it out since it supposedly covers building 3D engines without the use of an API like OpenGL or Direct3D.

I may instead just pick up a textbook on computer graphics algorithms. Either way, it should be a good read
Advertisement
I can''t recommend that book highly enough. Its without doubt the most comprehensive and useful book I have ever read. As far as algorithms and theories, you''d be set. The first relevant demo you create is on page 700 (a spinning triangle). Those other 700 pages are just packed with material. There are 2 chapters covering more than 200 pages that cover math, and the implementation of math structures in the engine. You actually write an entire math engine.

I ordered from Barnes and Noble and the book was at the store in 3 days. I''ve never gone out of my way to recommend a book before. This one is just most definitely a gem.
I never knew of a different way to do planar collision checking (not meant to be sarcastic or anything). I''m just wondering how you could have done it differently. If you tell me, I promise not to laugh.
You know what I never noticed before?
I would have a level. For the sake of simplicity we'll assume y is constant. So there is movement in the x and z directions. Every object has coordinate space begin and coordinate space end: Walls, the player, etc, etc, etc..

Now, each time the player moves he may move from say 25, 5 to 25, 10. There might be a wall at 20 10 to 30 10 at depth to 10 2 so it expand to 20 20 to 30 20. I would manually check each point. To make sure that the player could not "hop" through walls if the system lagged and he 'jumped' ahead (ie- taking a 15 point update past a 10 point wall would let the player jump through). So I would check 25, 6.. OK. 25, 7.. OK. 25, 8.. OK. 25, 9.. OK, 25, 10. In bounds of wall so revoke to last valid point in opposite of current vector direction since current vector is obvious purely x with no other coordinates the opposite vector was -x, so I try -1 which brings the player to 25, 9 which is a valid square.

Basically I was doing 2d per pixel collision detection in 3d. Needless to say I haven't read or studied or even really thought about 3d a significant amount. I never felt I was experienced enough to, so I have always just used my engines as a sort of playdo, to have fun with and nothing else. No thought involved.



[edited by - haro on June 19, 2003 2:12:41 PM]
quote:
Original post by haro
I can''t recommend that book highly enough. Its without doubt the most comprehensive and useful book I have ever read. As far as algorithms and theories, you''d be set. The first relevant demo you create is on page 700 (a spinning triangle). Those other 700 pages are just packed with material. There are 2 chapters covering more than 200 pages that cover math, and the implementation of math structures in the engine. You actually write an entire math engine.

I ordered from Barnes and Noble and the book was at the store in 3 days. I''ve never gone out of my way to recommend a book before. This one is just most definitely a gem.



Well I might just get it then. I actually really liked the first book (despite countless Gamedev know-it-alls proclaiming it was crap), and initially wanted to get this one when it came out. But then it got delayed and delayed and delayed some more. But from the sounds of it, it looks to be quite good. If nothing else, it''ll make a great reference (as does the original Tricks, which is about all I really use it for anyway).

Advertisement
I second that recommendation. It's really a great book.
Andre says in the beginning that after reading this book
learning anything in OpenGL or DirectX is trivial. He's
got my attention now. =) And this is better than a graphics
textbook in my opinion -- it's a lot more enjoyable to read
because it's written in a very informal style.

I've only had it a few days and I have the most robust math
engine I've ever written. I'm now working on my pipeline!

T

Edit - I fixed my hideous grammar.

[edited by - TThirion on June 19, 2003 6:33:49 PM]
It was nice to see things actually get implemented in the book. Tricks of the Game Programming Gurus was a bit annoying in it''s "Adding sprites to this renderer is an exercise for the reader" approach.

The biggest thing I disliked about Tricks of the Windows GPGs was his habit of blowing off certain topics because "as game programmers, we don''t need to know that stuff". I''m of the opinion that whatever you don''t know may not hurt you, but it will hurt anyone who has to work with your code in the future under different conditions. Encouraging the sort of brain-deadedness that results in things like code that won''t compile without VC++''s liberal interpretation of the standards, or makes assumptions about the repeatability of floating point operations is a bad thing.

The new one is quite thorough though. It''s like a Zed3D with programming examples, and without the typos in the perspective texture mapping derivation.
What does the math engine do? I probably won''t get to a book store until the summer is over (I''m on break now, so leave me alone!) so this is the only way I will find out.

20: ...Qg2 ++
quote:
Original post by CmndrM
I''m actually hearing good things about this book. And while I already do some 3D stuff with OpenGL, I might check it out since it supposedly covers building 3D engines without the use of an API like OpenGL or Direct3D.



I''d love to get this book too for the mathematics and theory stuff, but I''ve also read that it''s about creating a software renderer. Wouldn''t you want to be making use of hardware acceleration in this day and age? Is any of it relevant to using OpenGL or DirectX, or is it all just about plotting pixels one at a time like the old DOS games? Seems like a big step backward, if that''s the case.

zephyr

zephyr

This topic is closed to new replies.

Advertisement