next up previous
Next: Design Philosophy Up: Fundamental of Computer Graphics Previous: World Transform

Camera Transform

How the 3D object looks like in 2D surface is determined by where we stand and from which angle we take the view2.

Isometric projection is used in dojox.gfx3d to project the transformed 3D objects to 2D shapes, which is much simpler than persepctive projection and still widely used in the pseudo 3D games. The identity camera transform casts $({x}, {y}, {z})$ to $({x}, {y})$, you may imagine parallel lights from the Z-axis casting the shadow to $X-Y$ plate. If we transform, rotate the plate, the casted coordinations may change, i.e the idea of camera transform.

\begin{displaymath}
\mathbf{CT} =
\left[ \begin{array}{llll}
1 & 0 & 0 & -x \\ ...
...& 1
\end{array} \right ] \textrm{- inverse object translation}
\end{displaymath}


\begin{displaymath}
\mathbf{CR_{x}} =
\left [ \begin{array}{llll}
1 & 0 & 0 & 0...
...} \right ] \textrm{- inverse rotation about the \emph{x}-axis}
\end{displaymath}


\begin{displaymath}
\mathbf{CR_{y}} =
\left [ \begin{array}{llll}
cos\beta & 0 ...
...} \right ] \textrm{- inverse rotation about the \emph{y}-axis}
\end{displaymath}


\begin{displaymath}
\mathbf{CR_{z}} =
\left [ \begin{array}{llll}
cos\gamma & s...
...} \right ] \textrm{- inverse rotation about the \emph{z}-axis}
\end{displaymath}

The camera transform matrix is defined as3:

\begin{displaymath}
\mathbf{C} = \mathbf{CR_{x}} \times \mathbf{CR_{y}} \times \mathbf{CR_{z}} \times \mathbf{CT}
\end{displaymath} (3)

The overall transfrom matrix is:

\begin{displaymath}
\mathbf{M} = \mathbf{C} \times \mathbf{T}
\end{displaymath} (4)



2007-06-20