Orthographic projection
Orthographic projection
I finally figured out the term I was looking for.
I would love to be able to create an Orthographic view. Unfortunately, every 3d tutorial out there says "use D3D_OrthoLH()" or "use glOrtho()"
Anyone know offhand how to generate an orthographic matrix without making a direct call to the D3D or gl API?
I would love to be able to create an Orthographic view. Unfortunately, every 3d tutorial out there says "use D3D_OrthoLH()" or "use glOrtho()"
Anyone know offhand how to generate an orthographic matrix without making a direct call to the D3D or gl API?
Crud, how do I do this again?
Ok, I've pretty much worked through everything, got a basic understanding of ortho rendering but I'm stumbling on something that I can't figure out.
I'm not exactly sure why it's not working but let me give you an example. (I'll try to rip out the source and post an example if I can't get it figured out tonight. Heck, I'll probably just pull the source anyhow and post it as another Howto)
Say I have a map of 9 blocks with 5 being the center at 0,0,0 (x,y,z)
123
456
789
I move the camera to -1,1,-1. This should mean that I now see.
__3__
_2_6_
1_5_9
_4_8_
__7__
Which I do... but the blocks on the lower Z are rendered behind those with a higher Z... which is backwards because the lower Z is supposed to be closer. (Distance is a relative term in ortho since it's all flat.)
In the end, I see this:
(Beware, character drawing ahead worse than Niko's from the source on TestSceneNode)
..__
./_/| 3 (Z = 1)
|_|/| 5 (Z = 0)
|_|/| 7 (Z = -1)
|_|/
When I expected to see this
..__
./_/| 3 (Z = 1)
./_/| 5 (Z = 0)
./_/| 7 (Z = -1)
|_|/
Is then something I need to do to change the sort order?
I'm not exactly sure why it's not working but let me give you an example. (I'll try to rip out the source and post an example if I can't get it figured out tonight. Heck, I'll probably just pull the source anyhow and post it as another Howto)
Say I have a map of 9 blocks with 5 being the center at 0,0,0 (x,y,z)
123
456
789
I move the camera to -1,1,-1. This should mean that I now see.
__3__
_2_6_
1_5_9
_4_8_
__7__
Which I do... but the blocks on the lower Z are rendered behind those with a higher Z... which is backwards because the lower Z is supposed to be closer. (Distance is a relative term in ortho since it's all flat.)
In the end, I see this:
(Beware, character drawing ahead worse than Niko's from the source on TestSceneNode)
..__
./_/| 3 (Z = 1)
|_|/| 5 (Z = 0)
|_|/| 7 (Z = -1)
|_|/
When I expected to see this
..__
./_/| 3 (Z = 1)
./_/| 5 (Z = 0)
./_/| 7 (Z = -1)
|_|/
Is then something I need to do to change the sort order?
Crud, how do I do this again?
--- moved this message to where it is supposed to be so that it will make senese ---
Fixed my problem... just by trying out a stupid idea, and I'm not wholey sure it's good.
It seems that this line was wrong.
Looks right to you? Me too. It seems that I had the near and far backwards.
And now that I got that figured out, I've started heavilly on the tutorial.
The code and one of Pharoseer's lovely creations (a cube with a dummy texture) is here.
http://www.saigumi.net/orthogonal.zip
Fixed my problem... just by trying out a stupid idea, and I'm not wholey sure it's good.
It seems that this line was wrong.
Code: Select all
// buildProjectionMatrixOrthoLH(width, height, near, far)
MyMatrix.buildProjectionMatrixOrthoLH(16.0f,12.0f,-3.5f,3.5f);
Code: Select all
// buildProjectionMatrixOrthoLH(width, height, near, far)
MyMatrix.buildProjectionMatrixOrthoLH(16.0f,12.0f,3.5f,-3.5f);
The code and one of Pharoseer's lovely creations (a cube with a dummy texture) is here.
http://www.saigumi.net/orthogonal.zip
Crud, how do I do this again?
also i need !!
Hey
Your link of tutorial code is broken !!!!
http://www.saigumi.net/orthogonal.zip
can u check it ? i ready to download ... Or please can u send me to alexdowson@hotmail.com ???
devil20
Your link of tutorial code is broken !!!!
http://www.saigumi.net/orthogonal.zip
can u check it ? i ready to download ... Or please can u send me to alexdowson@hotmail.com ???
devil20
Well, the tutorial is completely gone due to some bad luck.
I put the file back though, in the downloads directory.
http://www.saigumi.net/downloads/orthogonal.zip
I put the file back though, in the downloads directory.
http://www.saigumi.net/downloads/orthogonal.zip
Crud, how do I do this again?
Now working
Now working ...
Thanx for upload.
devil20
Thanx for upload.
devil20
Code: Select all
// buildProjectionMatrixOrthoLH(width, height, near, far)
MyMatrix.buildProjectionMatrixOrthoLH(16.0f,12.0f,3.5f,-3.5f);
Re: Now working
How that? Should be EDT_DIRECTX8 not DT_DIRECTX8 ???devil20 wrote:Now working ...
But then you're right
-
- Posts: 91
- Joined: Fri Oct 31, 2003 5:03 am
Here is some code I wrote a while back that some people may find useful. This is code modified from the second tutorial of dusty engine, available at http://daveandrews.org/dustyengine/tuto ... orial2.php.
Of course, I couldn't write that code until reading saigumi's orthagonal tutorial at http://www.saigumi.net/archives/000067.html Kudos!
Code: Select all
ICameraSceneNode * SetupCamera(IrrlichtDevice * irrDevice)
{
ICameraSceneNode * camera = irrDevice->getSceneManager()->addCameraSceneNode();
matrix4 orthoMatrix;
orthoMatrix.buildProjectionMatrixOrthoLH(16.0f, 16.0f, 2.0f, -2.0f);
camera->setProjectionMatrix(orthoMatrix);
return camera;
}
daveandrews.org - A Christian Programmer's Weblog | Dusty Engine - A Task Engine for Irrlicht
someone can send me this tutorial ?saigumi wrote:Well, the tutorial is completely gone due to some bad luck.
I put the file back though, in the downloads directory.
http://www.saigumi.net/downloads/orthogonal.zip
thank you.