开发者

What does Up Vector exactly do in DirectX?

As you know when we want to draw a three demensional object in DirectX we should define a camera. Now we have a Device object that it's name is 'device1'.it is my question : device1.View = Matrix.Look...(New Vector3(),New Vector3(),New Vector3()); Argument #3 is Up 开发者_C百科Vector. What does it exactly do?


As the name says, it defines in which direction “up” is. That’s quite an important thing. You need to know the position of the camera, you need to know which direction it’s facing, but you also need to know how it’s turned – i.e. what will be perceived as up and down, left and right.

In our real world, the “up” vector of our field of vision is (usually) implied by the field of gravity, i.e. it’s the reverse (up, not down!) of the vector of gravity exerted by Earth.


In a camera matrix you need to form an "orthonormal" basis matrix to describe the coordinate frame.

If you think of any 3D coordinate frame you have 3 axes. The X-axis (or Side/lateral vector), the Y-Axis (The up vector) and the Z-Axis (The direction vector).

The up vector is, simply, important for defining that coordinate frame.

A row-major basis matrix is defined as follows:

xx, xy, xz, 0
yx, yy, yz, 0
zx, zy, zz, 0
px, py, pz, 1

xx, xy, xz is a 3-vector defining the x-axis, yx, yy, yz the y-axis, zx, zy, zz the z-axis and px, py, pz defines the position vector.

Also if you think about it if you pointed the up vector downwards then you'd expect to see everything upside down .. right? Furthermore as you haven't rotated the up vector into the down position you will also notice that the side vector is pointing the wrong way so you will see something that appears mirrored in the X-axis as well as being upside down.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜