Jump to content
  • Advertisement

Archived

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

Pure Krome

[Newbie] Some help to explain some 3D World Theory

This topic is 6545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

G''Day all. I''m reading my way through a number of tutorials, examples, etc for OpenGL. I''m trying to understand in THEORY how a simple 3D world *works*. I''ll explain. From my understanding, when an application (lets say a simple game level) is initilised successfully, a playing field and some boxes are randomly placed ontop of the ground / arena. How does the program understand the center of each box / model? Does it need to do this? How does it understand that you can say -> Ok. FOR EACH PLAYER MODEL (eg. soldier that runs around shooting), go into it''s CENTER, then ? I just don''t understand how a simple 3D World knows how to place and handle objects in it''s world, and how it can access them when i needs to? What are the technical explanations here please? So then i can research further what these mean, so I can attempt it. -PK-

Share this post


Link to post
Share on other sites
Advertisement
What i ment was, how do u know how to control various models to move around a (dynamic) world? I had a quick look over witchlord's semi-tutorial, and he/she mentioned matrix's etc.

Is this the key?

what are they used for?

It's pretty basic loading in a few models from an external file. Then placing these models at hardcoded points. That's pretty basic.

But what are the topics i need to research about to learn how to control these models in a 3D environment? How to *jump into* model-1 and move it one unit *forward*, etc....

things like that...



-PK-

Edited by - Pure Krome on June 21, 2000 12:08:00 AM

Share this post


Link to post
Share on other sites
I''m a male

I suggest you read my tutorial a little more thorough this time. It describes exactly what you need. After that and you still have questions I''ll be glad to answer them for you

- WitchLord

Share this post


Link to post
Share on other sites
Thank WitchLord. I will. I too am short on time so i just checked to see if the link worked =)

First thing i noticed was the word matrix.
second thing i noticed was the DIRECTX stuff ... i''m doing this in OpenGL -> but the theory is the same, which is what i''m after =)

thank you again for starting me off in the right direction.

male dude =)



-PK-

Share this post


Link to post
Share on other sites
I don''t think OpenGL uses matrices, but I wouldn''t know, I haven''t tried it. A matrix is a tool for manipulating series of linear equations. What it is typically used for in 3d graphics however is transformations. A point or vector is represented by a 1x4 matrix. like this:

[ x y z 1 ]

which are the x, y, and z coordinates and 1, which is a normalizing factor or something similar, which you need to perform translations. To perform transformations, you need to multiply the matrices. To translate a point, you use a translation matrix, which is:


[ 1 0 0 0 ]
[ 0 1 0 0 ]
[ 0 0 1 0 ]
[ tx ty tz 1 ]

where tx, ty, and tz are the amounts to translate by.

to multiply them you do:

[ x y z 1 ] * [ 1 0 0 0 ]
[ 0 1 0 0 ]
[ 0 0 1 0 ]
[ tx ty tz 1 ]

= [ (x*1+y*0+z*0+1*tx) (x*0+y*1+z*0+1*ty) (x*0+y*0+z*1+1*tz) (x*0+y*0+z*0+1*1)]

which evaluates to:

[ (x+tx) (y+ty) (z+tz) 1 ]

which does the translation. You can also combine the operations of matrices by multiplying them together and all sorts of useful things like that.


------------------------------
#pragma twice

Share this post


Link to post
Share on other sites
The way an object is stored it has its world coordinates (one point which is the centre of the object) and its local coodinates which are the coordinates of each point in the object relative the to the world coordinate. To find the position of any point in the object you just add the world coordinates of the object to the local coordinates of the point. (A point also has camera coordinates, which the world coordinates are transformed into by the world to camera coordinate transform). By keeping those separate, the program is able to animate the object in local coordinates and move it about in world coordinates. See?

------------------------------
#pragma twice

Share this post


Link to post
Share on other sites
OpenGL Does use Matrixies, and the High Level Function in GL edit the Matrixies for you(right?).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!