# Isometric projection, calculate camera angle for specific tile height

I'm experimenting with different tile dimensions while rendering 3D assets for an isometric game (or dimetric to be exact). Everyone does a 2:1 ratio so the tiles in isometric view are 256wx128h, which requires a 30 degree down-angle of the camera. I'm trying to find out what angle my camera needs to be in order to produce a tile that is 256wx160h.

I suck at math so I found this link but it's giving me some questionable results https://c2isogame.wordpress.com/2017/02/10/how-to-get-height-level-of-tile-in-iso-view/amp/

According to the page, the formula for a tile 256wx128h is atand(128/sqrt(256^2+256^2)), which equals 19.47, and that's obviously not 30.

What is the general formula to find camera angle for any tile size in dimetric projection?

• Why was this question downvoted? Oct 29 '21 at 5:52
• it's natural to feel frustrated when you get a downvote without explanation, but it's not OK to call other users rude names in response. I've edited your comment. I'm also going to raise the topic in chat to remind users to please leave constructive feedback when down-voting posts. Oct 29 '21 at 12:19
• Depending on your rendering software it might be too much work to do precise renders, mostly because of the filtering it happens when rendering. A simpler approach would be to make a mask of the exact proportions you want, then apply that mask on your renders later, then you just need the camera angles, using XYZ rotation it is 60 0 45 to a isometric projection. Here is some more information on camera projections from wikipedia en.wikipedia.org/wiki/3D_projection there are nice images for referencing. Oct 29 '21 at 14:32
• Oct 29 '21 at 15:58

## 1 Answer

What we want to find here is an angle that foreshortens the depth axis of your plane to your target height:width ratio $$\\frac h w\$$.

If we chose the angle 0°, we'd be looking parallel to the depth axis, so it would be foreshortened down to 0%. We'd be looking at the tile edge-on, so it would have no height at all.

If we choose the angle 90°, we'd be looking straight down at the plane, so it wouldn't be foreshortened at all, and would be drawn at 100% the width of the unforeshortened horizontal axis.

So we have some function of angle that's 0 at 0° and 1 at 90° - sounds a lot like Sine!

Let's prove it. Looking down with an angle of $$\\alpha\$$ on a line of length $$\l\$$ The length of the projection in our image plane is $$\p\$$:

You'll notice that the two triangles are similar (same angles). So the ratios between their sides will match. Let's call the vertical rise $$\v\$$ and the hypotenuse of the bottom triangle $$\h\$$. Then we can write...

\begin{align} \frac p v &= \frac l h\\ p &= l \frac v h\\ p &= l \sin \alpha \end{align}

Which gives us $$\\alpha = \sin^{-1} \frac p l\$$

For the 2:1 dimetric projection, that's $$\\sin^{-1} \frac 1 2 = 30 ^ \circ\$$

And for your 256:160 target, that's $$\\sin^{-1} \frac {160} {256} = \sin^{-1} \frac 5 8 = 38.682... ^ \circ\$$

• Like a boss.... Thank you for the precious explanation. Oct 29 '21 at 15:21