• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

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

sc0rpy

lookat() my sad math skills

10 posts in this topic

Ok, some of you math psychos, incase you wanna show off your mad skills why not make a post describing why gluLookAt() (and mesa''s implementation of it) makes things "disappear" when the eye-position and the center point (reference point) and the world vector are all coincident. eg: your ''up'' vector is 0,1,0 your eye position is 0,10,0 your center (reference) is 0,0,0 you draw a cube at 0,0,0 the cube is invisible. if you change the x or z component of either the cube or the eye position, you can see the cube.. I''m not sure why it disappears tho. Mesa''s imp of lookat() has a comment : /* cross product gives area of parallelogram, which is < 1.0 for * non-perpendicular unit-length vectors; so normalize x, y here */ Is this the answer?
0

Share this post


Link to post
Share on other sites
Here's how the view matrix is computed (pseudo code):


gluLookAt(Eye, Center, CameraUp);
{
VECTOR Front = Normalize(Center - Eye);


// Compute an up vector that is perpendicular to Front
VECTOR Up = CameraUp - DotProduct(CameraUp, Front)*Front;


float Length = Magnitude(Up);
if( Length > 0 )
Up /= Length;
else
{
// The Camera up and front are parallel and we cannot compute its orientation
}


// If Up is zero length, then Right will also be zero length
VECTOR Right = CrossProduct(Up, Front);


MATRIX View;
View._11 = Right.x; View._12 = Right.y; View._13 = Right.z; View._14 = -DotProduct(Eye, Right);
View._21 = Up.x; View._22 = Up.y; View._23 = Up.z; View._24 = -DotProduct(Eye, Up);
View._31 = Front.x; View._32 = Front.y; View._33 = Front.z; View._34 = -DotProduct(Eye, Front);
View._41 = 0; View._42 = 0; View._43 = 0; View._44 = 1;
}


If the CameraUp vector is parallel to (Center-Eye) the algorithm above cannot compute any vector perpendicular to the Front vector of the camera, hence you will not see anything. It can be solved by guessing at the up vector but that way the programmer has no control over the orientation of the camera, so OpenGL don't do that and instead presumes that the programmer use proper arguments for the function call.

/
 AJ






Edited by - WitchLord on 4/14/00 10:15:09 AM
0

Share this post


Link to post
Share on other sites
Thanks WitchLord. It semi-clarifies my question. Apparently the other 2 people had problems decyphering my question, hopefully your comments will enlighten them to my query.

The other question I have is.. If the magnitude of the UP vector is determined to be 0 (or as your comment states: // The Camera up and front are parallel)
how would a person compensate for that, or correct the problem.

IMHO it''s logical to assume that the camera could fly above an object and look directly down upon the object forcing that up vector to make the object disappear. Would you in that case ''tweak'' the up vector so the object wouldn''t disappear or would you simply not allow the camera to fly to that sort of coordinate system?

Oddly enough I don''t remember having this problem in D3D, I wonder if it does something internally to compensate for this problem...

0

Share this post


Link to post
Share on other sites
D3D does indeed do something internally to compensate for the parallelity: If the length of the internal up vector is determined to be zero, it uses (0,1,0) instead and retests for parallelity. If that doesn''t work either it uses (1,0,0). This time it will work since both cannot be parallel to the front vector.

So in your case you always use (0,1,0) for camera up vector but when that camera is looking directly up or down you''ll have to use another up vector for example (1,0,0).

You can see the implementation that Direct3D uses in d3dutil.cpp which comes with the SDK. The function you should look at is D3DUtil_SetViewMatrix().



/
 AJ
0

Share this post


Link to post
Share on other sites
Thanks again WitchLord.

Once again I am your servant.

Goes to show ya how much more advanced you Europeans are in mathematics against us NorthAmericans.

There are exceptions tho, but I know I am NOT one of them .



0

Share this post


Link to post
Share on other sites
quote:
Original post by sc0rpy

Thanks again WitchLord.

Once again I am your servant.

Goes to show ya how much more advanced you Europeans are in mathematics against us NorthAmericans.

There are exceptions tho, but I know I am NOT one of them .







First off, those people where confused since you obviously don''t know english either.

Secondly, no thanks, I don''t need you speaking for my North American math skills.

Thirdly, why not spend some time reading about vectors and matricies before asking a convoluted question.


int main() {
if(reply.IsSpam()) {
while(true) {
int*ptr=new int[1000000];
reply.RandomInsult();
}
}
else std::cout<< "amorano"
}
0

Share this post


Link to post
Share on other sites
joviex:
>> First off, those people ''where'' confused ...
before criticizing other people in the art of english,
check your spelling...

/sixb0nes
0

Share this post


Link to post
Share on other sites
oh, please, stop it everyone. the only syntax that matters here is opengl and c++. leave yer arrogance at home, no matter how subtle. i don''t care if you don''t know what i''m talking about, because apparently, those who don''t know of their own arrogance, are way too arrogant to realize it themselves. stop bickering, and program those kickass games.

nuff said.

a2k
0

Share this post


Link to post
Share on other sites