Sign in to follow this  

Very Confuse about View Transformation

This topic is 4692 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

Dear All, I am really sorry, I have re-posted my question about View Transformation. Let's me to conclude my idea first. In the View Transformation, We need to set the 3 Vectors value, vEye, vLookAt, vUp vEye and vLookAt is position vector and vUp is a direction vector. When we want to know the direction vector from vEye to vLookAt, we will use D3DXVec3Subtract between vLookAt and vEye. After that we will normalize the value of the output. To perform subtract action between vLookAt and vEye is because vEye is not (0,0,0) position and we need to transfer the vEye coordinate to be (0, 0, 0) and them calculate the direction to vLookAt. On the above idea, should anybody tell me am I right first? Now, I want to tell you my question, when a camera perform walking action, such as forwarad, we need to multiply the unit to the result or output from Subtract between vLookAt and vEye. After that, we will add the new output to the two position vector, vLookAt and vEye. Actually, I don't really konw, why could I just add a unit to the z-coordinate to vEye and vLookAt? I know my question may be very stupid, but I am really don't fully understand, please anybody can tell me the result in depth detail(with graphic is perferred). Thank You Very Much for your help Michael

Share this post


Link to post
Share on other sites
You don't necessarily need to use that format. LookAt works well when you want to pan around objects and whatever, but not too well a camera that you want to just point wherever you point it. Keep in mind however that you can use any maxtrix transform you like on your view matrix. In my current game I'm just using the Matrix Translation() and RotationYawPitchRoll() ones. LookAt is merely a handy way to achieve a particular setup, but don't use it if it's not right for what you want to accomplish.

Since the view transform changes the origin however, movements will be negative and transformations need to be performed before rotation (ie. view = transform * rotation; for other objects this would be the other way around). Similarly, transforms need to be negative. The way I explained that is a bit confusing, but if you want take a shot at it)

Share this post


Link to post
Share on other sites
The reason why you cannot just add a certain value to the z coordinate of the eye and lookat vector, is because that will only move the camera and the target down.
Of course if this is all you want it is perfect, however, it's not the same as moving forward/backward (as you seem to be trying to accomplish, looking at your code).

So depending on what you are trying to achieve, both procedures could lead to what you want.

EDIT:
rjackets and I cross-posted

Share this post


Link to post
Share on other sites
"OK, a lot of people don't understand very well how a view matrix works. I will post a new thread with a tutorial about that."

Really? When, I am really want to read it in the shortly...

Share this post


Link to post
Share on other sites
Just yesterday I went thru setting up a view matrix for looking down the barrel of a tank's gun. It's basically the same for a walking person.. since you will have a matrix which positionss (& rotates) your model which you can use to create a view matrix.

Since the transform matrix is:
RightX RightY RightZ 0
UpX UpY UpZ 0
LookX LookY LookZ 0
PosX PosY PosZ 1

You can construct your Eye and At vectors:
Eye = Pos;
Look = Pos + Look; // note that sometimes Right is a better choice

Then use them to make your view as you've already described.

Hope that helps!
Greg

Share this post


Link to post
Share on other sites

This topic is 4692 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this