# What is the camera direction vector for an isometric view?

What values correspond to a 3D vector for screen-normal from within an isometric game?

It needs to be in game coordinates. It is a standard isometric where tiles are rotated 45 degrees and half height (in 2D projection).

For example [+x,0] in game corresponds to north-east on screen. But what is the vector leading out of the screen. This vector is always the same (a fixed orthographic projection).

• Ideally the vector would be represented the same way, since the world coordinates are not isometric, only the visual representation of the world is. – MichaelHouse Sep 9 '13 at 22:15
• Yeah, but same as what. I know I need to rotate to rotate it 45° to left (starting from heading north [0, -y] in iso coordinates). This way it will head up (in screen coordinates). Then I need to somehow rotate it towards me (out of the screen). That's when I got lost. – SmartK8 Sep 9 '13 at 22:20
• I mean they would be represented without rotation. There are considerably less headaches when making an isometric game if the coordinates system for the game world is a standard 2D (or 3D) cartesian coordinates system. The isometric property just comes from the visual representation. – MichaelHouse Sep 9 '13 at 22:28
• My conversion algorithms work well, but this is not a conversion (at least I think so). I need vector in iso coordinates that leads outside the monitor (is normal to a monitor screen). – SmartK8 Sep 9 '13 at 22:32
• If you have two (linearly independent) vectors and require one orthogonal to both of them, simply calculate the cross- or vector-product of the original two vectors. Then normalize. – Pieter Geerkens Sep 9 '13 at 22:39

I need vector in iso coordinates that leads outside the monitor (is normal to a monitor screen).

It's two rotations. Your tiles are half as high as they are wide. Projection/dot product is proportional to cosine, and arccosine(1/2) == 60 degrees, which means that's your first rotation. It is followed by a 45-degree rotation.

You start with unit-z, 0, 0, 1
The first 60 degree rotation (about the x-axis) yields (0, -ROOT(3)/2, 0.5)
The next 45 degree rotation (about the z-axis) yields -ROOT(2)*ROOT(3)/4, -ROOT(2)*ROOT(3)/4, 0.5)

Invert it, and it's your camera's direction.

Vector3 camera_forward = (0.612375, 0.612375, -0.50000);


(I assumed that up-left was position Y, and up-right was positive X)

Maybe I'm missing something right now (bare with me; it's late in the night).

Essentially you'll just need two tiny steps here to get from world space to screen space (i.e. from world coordinates to screen coordinates):

• Rotate your coordinates by 45° (rotation axis pointing out of the screen).
• Divide the new y coordinate by 2.

For the other way (from screen coordinates to world coordinates) you just reverse this:

• Multiply the y coordinate by 2.
• Rotate your coordinates by -45°.

Remember that you're doing isometric projection, not perspective projection (so you don't have to fiddle with real rotation along the x axis).

• But I don't need conversion. I need what vector in iso coordinates corresponds to a vector out of the screen. I as I've said in iso coordinates (for example) is [0, -1, 0] north, but what is the vector leading out of the screen. – SmartK8 Sep 9 '13 at 22:30
• What exactly are you trying to achieve? – Mario Sep 9 '13 at 22:33
• Exactly what I've said, there's no way around it. I really don't how to explain it better. Imagine a vector leading from this isometric "ground" to screen, it would be a point from every place on that ground. But what is the vector from the ground to a screen in iso coordinates (it is 3D vector). – SmartK8 Sep 9 '13 at 22:35
• I understood that part, but why do you need it? Do you want to do raycasting for mouse interaction? – Mario Sep 9 '13 at 22:36
• I need it for light calculation, I don't know how is it relevant? – SmartK8 Sep 9 '13 at 22:37