Orthogonal Tutorial
-
Guest
Orthogonal Tutorial
I can't find where exactly the tut is. The link is here: http://www.saigumi.net/archives/000067.html
but I can't seem to find it on the page.
Can you please point out where it is?
-Thank you-
but I can't seem to find it on the page.
Can you please point out where it is?
-Thank you-
-
Conquistador
- Posts: 340
- Joined: Wed Sep 28, 2005 4:38 pm
- Location: Canada, Eh!
It's also in the Wiki.
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
Orthogonal Tutorial
[edit]
Download
The package for this tutorial can be downloaded at http://irrforge.org/images/c/c5/Orthogonal.zip
[edit]
What does Orthogonal mean?
From the Computing Dictionary: "N mutually orthogonal vectors span an N-dimensional vector space, meaning that, any vector in the space can be expressed as a linear combination of the vectors. This is true of any set of N linearly independent vectors."
Now that your brain is fried, let me give you my own definition.
Orthogonal(sometimes referred to as Orthogonical): rendering without perspective
Quick Note: This does not mean "a way to reduce 'fish-eye'". To reduce 'fish-eye', you should really work with your Field-of-View (FOV), Aspect Ratio, and Near/Far planes.
In Orthogonal, you do not have perspective. NONE AT ALL. If you took a 1x1x1 block and put it at 0x0x0 and took another 1x1x1 block and put it at 2x0x100 they would look identical. There would be no change in size.
[edit]
How do you create an orthogonal view?
To create an orthogonal view, you define a projection matrix for your viewing area. In a perspective world, the projection matrix starts as a pinhole and expands out as a cone. You can simulate this by taking a piece of paper, poking a hole in it, and looking through. In an orthogonal world, you have a box. You can simulate this by getting a cardboard box and looking into it.
Think about the dimensions of a box, you have a height, a width, a back side, and a front side. Building the matrix requires these exact parameters.
buildProjectionMatrixOrthoLH(width,height,near plane,far plane)
So, say in your world, you want a carboard box that is 16 units wide, 12 units tall, and 7 units deep. You might think:
buildProjectionMatrixOrthoLH(16.0f,12.0f,0.0f,7.0f)
While this would work, there is a slight problem with it. Say you have a 1x1x1 cube and you put it in the center of the world at 0x0x0. It wouldn't be rendered. It would in a normal perspective world, you would see the back half of it, but not the front half. In an orthogonal world, the cube wouldn't be drawn at all as the front of it would be behind the camera. So, what I have done is moved the near and far plan into a middle ground.
buildProjectionMatrixOrthoLH(16.0f,12.0f,-3.5f,3.5f)
Now, if you look at the code attached in the zip, you may notice that something is different. The near and far planes are reversed. Why the heck is the far plane behind the camera?
buildProjectionMatrixOrthoLH(16.0f,12.0f,3.5f,-3.5f)
For some reason, Irrlicht's rendering order is backwards of what intuition tells you. Reversing the near and far plane will reverse the rendering order. Try reversing the values to see what happens.
[edit]
Tips
With an orthogonal projection matrix, their is no half-on/half-off the viewable area. It's either on or off
[edit]
Download
The package for this tutorial can be downloaded at http://irrforge.org/images/c/c5/Orthogonal.zip
[edit]
What does Orthogonal mean?
From the Computing Dictionary: "N mutually orthogonal vectors span an N-dimensional vector space, meaning that, any vector in the space can be expressed as a linear combination of the vectors. This is true of any set of N linearly independent vectors."
Now that your brain is fried, let me give you my own definition.
Orthogonal(sometimes referred to as Orthogonical): rendering without perspective
Quick Note: This does not mean "a way to reduce 'fish-eye'". To reduce 'fish-eye', you should really work with your Field-of-View (FOV), Aspect Ratio, and Near/Far planes.
In Orthogonal, you do not have perspective. NONE AT ALL. If you took a 1x1x1 block and put it at 0x0x0 and took another 1x1x1 block and put it at 2x0x100 they would look identical. There would be no change in size.
[edit]
How do you create an orthogonal view?
To create an orthogonal view, you define a projection matrix for your viewing area. In a perspective world, the projection matrix starts as a pinhole and expands out as a cone. You can simulate this by taking a piece of paper, poking a hole in it, and looking through. In an orthogonal world, you have a box. You can simulate this by getting a cardboard box and looking into it.
Think about the dimensions of a box, you have a height, a width, a back side, and a front side. Building the matrix requires these exact parameters.
buildProjectionMatrixOrthoLH(width,height,near plane,far plane)
So, say in your world, you want a carboard box that is 16 units wide, 12 units tall, and 7 units deep. You might think:
buildProjectionMatrixOrthoLH(16.0f,12.0f,0.0f,7.0f)
While this would work, there is a slight problem with it. Say you have a 1x1x1 cube and you put it in the center of the world at 0x0x0. It wouldn't be rendered. It would in a normal perspective world, you would see the back half of it, but not the front half. In an orthogonal world, the cube wouldn't be drawn at all as the front of it would be behind the camera. So, what I have done is moved the near and far plan into a middle ground.
buildProjectionMatrixOrthoLH(16.0f,12.0f,-3.5f,3.5f)
Now, if you look at the code attached in the zip, you may notice that something is different. The near and far planes are reversed. Why the heck is the far plane behind the camera?
buildProjectionMatrixOrthoLH(16.0f,12.0f,3.5f,-3.5f)
For some reason, Irrlicht's rendering order is backwards of what intuition tells you. Reversing the near and far plane will reverse the rendering order. Try reversing the values to see what happens.
[edit]
Tips
With an orthogonal projection matrix, their is no half-on/half-off the viewable area. It's either on or off