# Isometric projection : Whats wrong with my math?

## Recommended Posts

Tunied    122
I have an math problem in Isometric projection. I have reading an article: Axonometric projections - a technical overview. http://www.compuphase.com/axometr.htm For the Isometric projection part, it give an mathematical formula for conversion 3D point into 2D point for the x part the formula is: x' = ( x − z ) cos(30); But i also check for wiki for Isometric Projection http://en.wikipedia.org/wiki/Isometric_projection so i use the rotation matrices which the wiki giving, calculate myself x' = x*cos(beta) - z*sin(beta) The beta is define by the wiki(Y axis rotation angle, and it should be 45). So what's wrong with my math? Or is there something that i don't know about the Isometric projection? please help me. thanks a lot !!!! [Edited by - Tunied on January 25, 2010 9:33:09 AM]

##### Share on other sites
Zahlman    1682
First, you have to be clear about your coordinate system. I will say that Z is "up" (off the ground), and X and Y are two directions along the ground (for example, "north" and "east"). The other articles you read might assign them differently, so you have to adjust accordingly when you read them.

There are two angles of projection that you have to select: the overhead angle, ranging from 0 to 90 degrees, and the ground rotation angle, ranging from 0 to 45 degrees. (Well, technically it could range through a full circle, but we just get rotations and reflections of the results from the first 45 degrees.)

The overhead angle controls how much of the ground you see. At 0 degrees you are looking straight forward, so you don't see the ground at all. This is pretty much unusable because you can't tell how far "forward" anything is; it's like ordinary 3D rendering but without any perspective (things getting smaller in the distance). At 90 degrees you are looking straight down from overhead. This is certainly usable for a lot of games (older RPGs almost always do this), but it isn't really "isometric" at all. In between, you get some kind of compromise. Moving up on the screen corresponds to both moving "forward" in the game world

The ground rotation angle sets the "forward" direction. It could be anything, but in practice the only values you usually see are 0 degrees and 45 degrees. At in-between values, the world looks asymmetrical, and as we go beyond 45 degrees we again just get rotations and reflections.

The projection with a 0 degree ground rotation angle is sometimes called "forced perspective". It's the look used in the original Legend of Zelda games, and it's sometimes used in other RPGs that are basically top-down so that you can see, for example, the front doors of buildings (if it were really top-down, you would only see the roof). With square tiles, it can make things look stretched out, because the brain is trying to interpret the world as 3D. So you have to account for that in the art. For example, a building that is supposed to be a cube might have a 3x2 tile "top" and a 3x2 tile "front" below it. Of course, if you are actually using 3D rendering, you don't have to worry so much about tiles :)

The projection with a 45 degree ground rotation angle is what we usually think of as isometric. If tiles are used, the tiles have different diamond shapes depending on the overhead angle: overhead they're just rotated squares, and at lower angles they become squashed vertically. Keep in mind that because of this squashing, "north" and "east" will not be at 45 degree angles on screen; they'll be somewhere between 45 and 0.

In a technical sense, "true" isometric projection is the case where the diamonds are constructed out of pairs of equilateral triangles. That way, it's the same distance in the 2D projection to represent one unit "north", "east" or "up" - the "iso" in "isometric".

Older games using tiles made a compromise, to make it easier to lay out tiles (and work better with the hardware): each tile is twice as wide as it is high. This is slightly more squished than the "true isometric" projection, and corresponds to a 30 degree overhead angle. (The true isometric projection is not at a 45 degree overhead angle; it's actually at about 35.3 degrees: the inverse sin of (sqrt(3)/3).)

You can get a sense for all of this by holding a square piece of paper at arm's length and rotating it (for ground rotation angle) and tilting it away (for overhead angle). If you want to learn more, we have a whole subforum for isometric games.

##### Share on other sites
Tunied    122
Hi
sorry i didn't put it in the right place ,can the admin move the post to the subforum ?

thanks for explain what's it Isometric projection to me. for that part i don't think i'm not understand wrong.

1the true Isometric projection is rotate y-axis 45 degrees , and then rotate x-axis 35.264 degrees.

2the Isometric projection use in game is rotate y-axis 45 degrees , and then rotate x-axis 30 degrees.

the same as Axonometric projections - a technical overview was written.

the pic is showing the rotate angle. (top view is 45 degrees , side view is 30 degrees).

as the Wiki side, we can use two rotation matrix to do the math.

so , i did the math.

the formula shou be

but i calculate form the rotation matrix is :

if we divide then we will got the formula :

as you can see the x part is right , but the y part is not the same as the formula:

is my math wrong ? or just beacuse the game Isometric projection formula is useing an approximation?

##### Share on other sites
Zahlman    1682
Quote:
 Original post by Tuniedthe formula shou be

So here, x, y and z are the original position in 3D space, and x' and y' are the transformed position in 2D space.

Those formulas are for the game isometric projection, where y is "up" in the 3D space, and x and z are "north" and "east". Meanwhile, x' is "right" on the screen, and y' is "up" on the screen.

Start at the bottom of the cube in the perspective view of the first picture.

If you take one step north and one step east, you end up at the bottom, rear edge of the cube. That is, on the screen, 1 unit directly above the start point. x' = x - z = 1 - 1 = 0, so that formula checks out. y' = y + (x + z) / 2 = 0 + (1 + 1) / 2 = 1, so that also checks out.

Quote:
 but i calculate form the rotation matrix is :

Well, your first problem is that there is no such thing as z', because the transformed position is in 2 dimensions.

Also, moving to Isometric Land.

##### Share on other sites
Tunied    122
hi, thanks for moving the post to Isometric Land :)

sorry about the z' part . in my formula the x' y' z' is the 3D space coordinate, and the x , y is 2D screen coordinate.

Convert Spcace (1,0,1) to Screen (0,1)

both the real formula and my formula is right , beacuse the y' = 0;

so my formula only wrong when you put some things on the ground .(that case the y' is not 0).

is this possible to let me know where my math is wrong ?

beacuse the

must calculate by some math.

thanks a lot.

##### Share on other sites
Tunied    122

thanks a lot:

form wiki part. the formula is:

and then do the matrix multiply and for the Cx' Cy' part the result is :

the beta angle should be 45 degrees. so , cosBeta = sinBeta =

so the formula should like this way:

it's ok for just both side divide because it only will scale the picture.

so we do the divide and them use Dx , Dy inside Cx , Cy

the result is :

as you can see ,the real formula should be

so our formula must satisfaction this one:

but this not possible.

so what's wrong with my math??

##### Share on other sites
Tunied    122
finally i know what is wrong.

from top view , no matter the Isometric projection is game use or just true Isometric projection . also top view angel is 35.264 . not exist 30 degrees.

it's to late for me. i will wrote my idea down tomorrow. :)

##### Share on other sites
Tunied    122

really really sorry , my blog have some problem , so for now i only can upload load some picture first.