orthographic/isometric camera matrix

This topic is 4290 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

How do I set up an orthographic view frustum, that makes things look isometric-ish? A vertical cross section of the frustum would be shaped like a parallelogram. In other words, the nearplane (and/or farplane) is shifted in two directions, in this case X,Z (topdown view). The important part is that the near plane and far plane must remain axis aligned (on X,Z plane), I need the rasterized depth buffer information, so regular orthographic views are not what I want. [Edited by - remdul on October 19, 2006 7:56:08 AM]

Share on other sites
I think you're mixing two concepts here: Orthographic projection and viewing matricies.

The easiest way to accomplish what you want is to simply set up an orthographic projection matrix with glOrtho. Define it as big of a "block" as you need it to be, without worrying about it being shaped like a parallelogram.

Then, to begin each rendering, glTranslate into the scene, and glRotate(45,1.0,1.0,0.0) or however you need to rotate to get your isometric views to look correctly. That should be sufficient.

Share on other sites
I don't think that's what I'm looking for. That would not give me correct depth data, unless I rotate the view on the Y axis, which I can't (has to remain axis aligned).

I want the geometry to be physically skewed, not just apear that way. Guess I might just as well do that in the modelview matrix (transform the scene rather than the frustum).

How do I compute a skewed matrix, given a vector?

Share on other sites
I think:

glTranslatef(0,0,-100.0);
glRotatef(30,1.0,0.0,0.0);
glRotatef(45,1.0,0.0,1.0);

with ortho projection should give you an isometric 2:1 diamond shaped tile if you were to draw a quad on the xz plane, you can use glGet to retrieve the resulting modelview matrix and then just use glMultMatrixf after glLoadIdentity each frame.

Edit: if you just want the near and far plane to be paralel to the xz plane, you just have to use glRotate to rotate 90 degrees about the x axis since the default is for them to be paralel to the xy plane.

Share on other sites
It didn't have anything to do with rendering isometric stuff really, the result would look the same but not be the same.

I figured it out. I just tried lots and lots of combinations, I get the right results if I alter m[4] to vec.x and m[2] to vec.z (std OpenGL matrix layout).

Still have to figure out how to apply it to the projection matrix to make sure objects are frustum culled correctly. Any hints are welcome.

* Ok, seems the same applies for a projection matrix with m[8] == x and m[9] == z, or at least in theory.

Thanks anyway for the help. :)

[Edited by - remdul on October 19, 2006 6:43:31 PM]

Share on other sites
@OP

I beleive what you want is a a 3d-skew matrix (akin to 2d skew tools in photoshop)

You would start by using a standard 2d orthographic projection, with a standard 3d-camera view matrix, but then apply on top of that a non-orthonormalized matrix, where the 3x3 rotation component describes movement in the x and z axis based on the y value.

Share on other sites
Yep, exactly. I have it working properly now.

For the record:

[0][0][x][0]
[0][0][y][0]
[0][0][0][0]
[0][0][0][0]

...multiplied with the projection matrix will shift the far plane (or near plane depending on setup) on the X,Y axis (screenspace).

1. 1
Rutin
24
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 9
• 46
• 41
• 23
• 13
• Forum Statistics

• Total Topics
631749
• Total Posts
3002031
×