Tutorial :3D Coordinates to 2D Screen Coordinates with an Orthographic Matrix



Question:

I have a scene that stores vertices in 3D space. What i would like to do is render those vertices Orthographically from an isometric perspective.

In all of my searching the obvious answer is to use an Orthographic camera like the ones in OpenGL etc.

The problem is that i'd like to write this from scratch to help with my understanding so really I'm looking for the theory inside the camera.

How can i take an arbitrary point in 3D space and get the screen coordinates out of it using an orthographic matrix?

Currently I have my orthographic matrix:

[2/r-l, 0, 0, r+l/r-l]    [0, 2/t-b, 0, 0, t+b/t-b]    [0, 0, 2/f-n, 0, f+n/f-n]    [0, 0, 0, 1]  

Where r is Right, l is Left, t is Top, b is Bottom, f is Far, and n is Near.

I append my rotation around the y axis to this and then multiply the vertex coordinates against this matrix which I believe converts my World Space vertex into my view space coordinates...

But it's still a 3D vector so I'm curious as to how i extrapolate the 2D Screen coordinates.

Any help would be great.

Thanks, Jon


Solution:1

Here's a great article explaining how OpenGL does it.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »