4
$\begingroup$

I have a scene containing a hexagonal grid, with an orthographic camera.

At what angle should I put the camera so a rendered hex would exactly half the height in pixels that it would normally be if rendered from a straight top-down view?

I tried a 45 degree angle, but the top face was squashed to about 2/3rds instead of 1/2. I guestimated based on what looked right and got 55 degrees, but I need it to be exact.

$\endgroup$
7
$\begingroup$

60°

Orthographic camera projects rays that are perpendicular to its plane. The length of a projected segment can be calculated using trigonometry.

In the first example of the figure below (left), a camera sees the segment from the top. The "projected" length of the segment is equal to its true length. The more the camera starts to face the horizon, the shorter the projection will be.

enter image description here

From the second example (right) we can easily figure out what is the general formula to get the length of the segment's projection upon the camera plane.

$$ P = R\cos{\theta} $$

Where $P$ is the length of the projection, $R$ is the real length and $\theta$ is the angle.

In your case:

$$ P = \frac{R}{2} $$

Then we can write the general equation as:

$$ \frac{R}{2} = R\cos{\theta} $$

This holds when (one of the infinite possible solutions):

$$ \theta = \arccos{\frac{1}{2}} = 60 $$

In fact, the only combination of angles that makes a right-angled triangle whose one side length is half that of the hypotenuse is the 30-60 Triangle.

enter image description here

As the camera in its "angular resting" position is facing downward, the angle considered in the previous equations is the same angle you should put in the X rotation field.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.