RSS Feed
Language :
Email Address : Password :
Action :       Index       Register       Help       Forget Password?
View Entries
    Recent Entries
    Most Popular Entries
    Return to Orinetz
Sub-Categories
Anime and Manga
Business
Programming
Science and Mathematic
Fiction
Culture
Related Entries
Orinetz Main Panel
( writer : Fendy )
The Mathematics behind a simple 3D Engine
Sunday, May 31st 2009

Rendering 3 dimensional data to fit 2 dimensional computer screen is not really a difficult task. The mathematics behind a 3D engine is actually simple. As long as you already understand about vector and matrix arithmetic, making a three dimension engine is actually a really easy task.


First, we need to define a 3-dimensional Cartesian space where the position of any object can be described by the set of values (x,y,z). Let's assume that in this particular Cartesian space we have two points A and B, along with point E representing where the viewer's eyes are positioned. These are shown in the figure above. [Grammatic Suggestion by Geezah from Yahoo!Answer]


The object E is symbolize our eyes (or camera), the point where we decide to observe other objects from. However, knowing only the position of our eyes is not enough. We have to define three vectors (Vx,Vy,Vz) which represent the orientation of our observer. Vx is a vector that point to our subjective right direction, Vy is a vector that point to our subjective up direction and Vz is a vector that point to our subjective front direction.


Since our objective is to draw the line AB in a 2 Dimension screen like shown above, we are going to need a way to deduce the Screen Coordinate of point A and B from its position in 3D Cartesian Space. This is where we need the information about the position and orientation of our eyes.


The number from its original objective coordinate (xyz-system) have to be transformed into subjective coordinate (uvr-system). Based on the orientation of our eyes, u represent how far an object is to our subjective right direction, v represent how far an object is to our subjective up direction and r represent how far an object is to our subjective front direction.

Then we scale the result to fit our 2D screen. The position of A and B in our 2D screen will be represented by A(sxA,sxA) and B(sxB,sxB). Remember that most screen-like objects in programming such as image canvas or computer screen represent the location of each pixels using positive integer. You may have to do some translational operation for A(sxA,sxA) and B(sxB,sxB) to center your screen.

Share   :
Keywords   :   3d, three dimension, subjective, vectors
Entry Available in   :   Indonesian ( Orinetz Main Panel )
Action   :   Grammatic Suggestion

Views : 5,789       Views per day : 12.56       Comments : 1

Comments

Daniel

Well, as someone who learn mathematic as a major, I know a bit about the horrors of math behind 3D rendering. And it's not preety.