0
\$\begingroup\$

I have a 2.5D game. I have multiple layers of objects to simulate parallax, and for maximum flexibility, I am using Unity3D to create it.

I have "Free Aspect" selected. I have an orthographic camera that needs to be pulled back on the Z axis to -10 to see everything on the screen. My orthographic size needs to be set to "6" to make sure everything is seen, otherwise it just is mega zoomed in.

Why is it that when I try to pull my camera back, so it's -40, the orthographic size is unaffected? If orthographic size is the "zoom" on the camera, then surely pulling the whole camera back and zooming in should do the trick, or vice versa?

Putting in a value of 6 feels super arbitrary, so I want to know what can be done to make the orthographic size 1 and still see everything on my screen.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Distance to the camera has no effect, because orthographic projection is a form of parallel projection and has no perspective. It still matters, because objects that are located behind the camera will not be rendered, hence why the Z coordinate still matters \$\endgroup\$ Jul 19 at 12:03
  • 1
    \$\begingroup\$ @TomDoodler that looks like the seed of a correct answer. \$\endgroup\$
    – DMGregory
    Jul 19 at 12:04
  • 2
    \$\begingroup\$ @user15916373, can you explain why the arbitrary number 1 is preferable to the arbitrary number 6? Why is it that you want your whole world to fit within 2 world units of height? That seems like an odd constraint to choose. \$\endgroup\$
    – DMGregory
    Jul 19 at 12:05
  • \$\begingroup\$ @DMGregory Good point. The answer is I was looking at few tutorials like this one (youtube.com/watch?v=3xXlnSetHPM&ab_channel=PressStart), where orthographic size is recalculated for every screen dimension. It seemed like if I had an easier number to deal with, like "1", some of those calculations might be simpler to understand? But as you say, they're both arbitrary and I understand that based on what was said above. \$\endgroup\$ Jul 19 at 12:10
  • \$\begingroup\$ @user15916373 You can't always just make certain numbers 1 to make calculations easier. Calculating the size of the earth would be easier if it weighed 1kg, but it doesn't. \$\endgroup\$
    – user253751
    Jul 19 at 17:27

1 Answer 1

6
\$\begingroup\$

Distance to the camera has no effect, because orthographic projection is a form of parallel projection and has no perspective.

Imagine a cube. Now draw a line from each corner towards the camera. In perspective projection, which is modelled after how our eyes see the world, these lines all collapse in a single point, which in reality is the focal point of your eye.

In parallel projection, these lines do not collapse into a single point, but rather all point in the same direction, being parallel with no point of intersection, ever. Now imagine a piece of paper, where all the lines impact. Moving the paper towards the cube or away from it has no effect on the location of the points of impact of the lines, because they are parallel. Thus, the size of the projection on the paper stays the same, no matter how far away the paper is from the cube.

In Unity, the distance still matters, because objects that are located behind the camera will not be rendered.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This makes total sense and your explanation was great. Thanks. \$\endgroup\$ Jul 19 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .