3
$\begingroup$

I want to create a square image for an album cover that combines a yet-to-be-taken real world photograph (probably taken with a Sony A7S camera) with some stuff I model in Blender. I want the lighting and shadows to match exactly.

To help me better frame my image, I decided to change the output dimensions of my blender project. I changed Resolution X to 1080 px. This appears to have increased the field of view -- Blender shows me more of the things in my scene, which seems backward somehow. I didn't really notice this at first. I set my camera's focal length to 50mm to match my real-world lens and proceeded to make an elaborate scene that looks good in the square frame. Here are two example images to demonstrate the FOV change. Here's the camera view in the default blender file: enter image description here

Just changing the Resolution X increases the FOV vertically. This is counterintuitive. enter image description here

Planning my photo shoot, and to make it easier to frame things properly during photography, I decided to change the Resolution X back to 1920. I want to see the blender scene to look exactly like the camera's screen, which is not square. I changed the Resolution X back up to 1920 px and the field of view shrank. Now my camera is cropping the top and bottom of my desired image.

To illustrate, I've moved the camera in the default blender file to closely frame the cube: enter image description here

Changing Resolution X back to 1920 now reduces the field of view, chopping off the top and bottom of the cube. enter image description here

I could easily move the camera in blender again, but now I'm really worried that my real-world camera image may look nothing like blender. Note that I didn't change any camera settings or any object locations, I just changed the output dimensions. Also, preparation for the photoshoot is a non-trivial process. Some of my blender objects are enormous and we will be simulating sight lines at the photo shoot by placing some stand-in objects (e.g., a ladder for a 40m building). If I have to move the camera at the actual photoshoot, all these stand-in objects would be in the wrong place and the sight lines would be ruined. I have to do a lot of trigonometric angle calculations to properly place lights and stuff.

So my main question is Why does reducing Resolution X increase my camera's FOV and increasing it reduce FOV?. My more important question is What settings, aside from camera focal length, must I set to ber sure my blender scene match my Sony A7S camera?

$\endgroup$
9
  • $\begingroup$ In my answer to another question I explained how the camera is displayed in Blender and that explains how this change happens, because when you enter different X or Y dimensions you do not change the focal length, sensor size or display size of the camera. Maybe take a look at my calculations in this answer or download my attached blend file to play around: blender.stackexchange.com/questions/95989/… $\endgroup$ Apr 19 at 6:03
  • $\begingroup$ @GordonBrinkmann thank you for your comment. I've read your post, but am not sure I understand it. I'll need to digest it for a bit. $\endgroup$
    – S. Imp
    Apr 19 at 6:08
  • $\begingroup$ As I said, maybe play around with the file to see the dependencies. Unfortunately that doesn't help you to get the correct setting to match your camera, it's just the reason for the changing field of view. $\endgroup$ Apr 19 at 6:20
  • $\begingroup$ @GordonBrinkmann I have downloaded your file, and am not sure what lesson I am supposed to take from it. You have a 50mm lens looking at nothing in particular. The settings of the camera are unremarkable except the Shift Y is 0.5 -- and I don't really know what that is meant to accomplish. Regarding your other post, you talk about the 'width of the displayed camera' as being 2 meters. This is, of course, an absurd size for a camera, which is much smaller. I fail to see how the other post is supposed to answer my question, but suspect that is some concept I'm missing. $\endgroup$
    – S. Imp
    Apr 20 at 15:47
  • 1
    $\begingroup$ You don't seem ungrateful, don't worry. Actually the other guy wanted especially this, the viewport size. Since the Camera Object is no real camera, it works a little different. But even with a real sensor it would be like this because of one thing: the X and Y resolution matter for the size of your rendered image in the first place, not for the FOV directly just like it doesn't matter if you have 18 or 24 megapixel digicam. But the width/height ratio matters. If you use the default sensor size of 36mm and sensor fit set to Auto, then this the width and the heigth is according to the ratio. $\endgroup$ Apr 20 at 16:45
7
$\begingroup$

In short

If you set Focal Length and Sensor Size values matching your real-cam ... it should work. Those two values represent perspective (optics) behaviour, including FOV (sure without lens distortions and other optics defects). Dimension values (Resolution X/Y in px) are as naming states - about rendered dimension, that can be set as cropped or extended result over sensor FOV.


Closer

You have to stop think about render Dimension / Resolution parameters as something that represents real camera FOV. X/Y values here relates to sensor size only in sense of max Width or Height. The rest of format is "cropped" or "extended" over sensor FOV.

To limit rendered format to one of the real-cam sensor size (width / height) you have to choose under Camera Properties > Camera > Sensor Fit > Horizontal or Vertical. Don't use Auto, this use squared size of sensor.


If you want to stay in range of real camera for example Sony A7S

  • go to Camera Properties > Camera > Sensor Fit, switch from Auto to Horizontal or Vertical and set Sensor Size to 35.8 x 23.9 mm
  • go to Camera Properties > Lens and set appropriate Focal Length (here 35 mm)

These two parameters mimic your real cam. To see what real camera see (real FOV) enabled under Viewport Display > Sensor

enter image description here

Dashed rectangle is Sensor size, green square is Camera object in size 1920x1080 px when Sensor Fit > Horizontal. From that you can see that your sensor is able to capture movie file in 1920 x 1280 px (1.5 proportion).

Anymway with this setup blender camera should mimic real-cam FOV.

By changing X or Y values under Output Properties > Dimension > Resolution you can see only FOV-width is changing when Sensor Fit is set to Vertical or FOV-Height is changing when Sensor Fit is set to Horizontal.

enter image description here

So what is changing here is not Camera Field of View (FOV), but only resolution and aspect of rendered image.

I was always asking my self why this Dimension > Resolution is not a part of camera properties ... and here it is - they are two separate things. It looks confusing just because changing Output > Resolution is changing shape of Camera object in 3D view. That gives an impression I'm changing camera itself, but in reality it is more like you are cutting printed image by scissors or adding more canvas on sides, because sensor and all the optics is still the same unchanged in camera properties.

Any advanced explanation is welcomed, so in mean time ... I hope this helps a bit.

Also for more convenient work to match other real-cam setups try Real Camera addon.


Note: There was a Bug Viewport Display > Sensor for 2.91 a.92 version. Fixed now for 2.93 ... Thanks to @RobertGuetzkow

$\endgroup$
7
  • $\begingroup$ I appreciate your response, and I am aware of the focal length and sensor size settings for an individual camera, but I'm still completely confused that changing the output resolution of my camera would enlarge the FOV when I increase Resolution X and then crop my image when I decrease Resolution X. The Sensor Fit setting is a completely mystery to me, and poorly explained in the documentation. $\endgroup$
    – S. Imp
    Apr 20 at 15:41
  • $\begingroup$ I tried my best ... check if the edit make a sense for you. $\endgroup$
    – vklidu
    Apr 20 at 18:53
  • $\begingroup$ I think I'm beginning to understand. The camera's field of view is derived from a fundamental calculation based on the output dimensions one specifies in your project's Dimensions specified in the Output Properties tab. It is entirely possible to get a wildly different FOV for identical camera settings, if your Dimensions specify a ratio different from that of your camera. The Sensor Fit settings are critical in dictating this behavior. $\endgroup$
    – S. Imp
    Apr 20 at 19:38
  • $\begingroup$ I think this would be much easier to understand if Blender would show you what your camera sensor actually sees when you hit ctrlpad-zero, and then within that area, perhaps show you what part of your camera's FOV is actually going to be rendered with a colored outline of some kind. The rendered output image dimensions can often be just a subset of what the camera sees. $\endgroup$
    – S. Imp
    Apr 20 at 19:44
  • $\begingroup$ Yes, to your thoughts :) And I can understand if it is pour propagation of this system for you, but in reality I came to this topic probably twice in 20 years and since nobody complain it seems no one cares. Integration CG usually works just take a footage set video dimension, focal legth, sensor size for tracking solver to make a better job, that's all. Later if you want to change resolution to a different aspect - you don't care what was original real-cam FOV. Even more when movie file is cropped by real cam as well. $\endgroup$
    – vklidu
    Apr 20 at 20:26
4
$\begingroup$

I guess @vklidu has already explained everything, but since my linked answer to a different question was maybe misunderstable I tried a visualization of the relations between image size, focal length, sensor size and the FOV to answer one part of your question: Why does reducing Resolution X increase my camera's FOV and increasing it reduce FOV? (The following might not be correct for real cameras, but for Blender camera objects.)

First of all, the specific X and Y resolutions in pixels do not matter for the FOV (or else scaling to 50% would change the FOV, too) - it's like comparing an older digicam with 18 MP to a newer one with 24 MP, one might have a better resolution but if they both have a 36 mm sensor with a 50 mm lens, the FOV should (ideally) be the same. The only thing that matters is the ratio between them, so for the FOV it's the same if your image is 1920 × 1080 pixels, 960 × 540 pixels or just a tiny 16 × 9 pixels.

(The following calculations are assuming that the Sensor Fit is set to "Auto" - this means, Blender is using the larger image dimension as the base for the equations.)

For a given distance d from the camera's position the FOV's larger dimension LD at a sensor size s and focal length f is computed as follows:

LD = d × s / f

In a horizontal image the larger dimension is the width w:

w = d × s / f

The smaller dimension SD of the FOV at the distance d is LD multiplied by the image's aspect ratio of smaller resolution SR to larger resolution LR:

SD = LD × SR / LR

Typically in a horizontal image of the FOV is the height h and the aspect ratio of the image is height divided by width y / x which gives a ratio < 1.

h = w × y / x

The different variables in a usual horizontal image are shown here:

fov formulas

Now for the reason why decreasing Resolution X increases the camera's FOV. Let's say we use the camera's default settings with a focal length f = 50 mm, a sensor size s = 36 mm. In the image above the three poles are a distance d = 10 m away from the camera, the left and right pole standing 7.2 m apart. We use a default image resolution of 1920 × 1080 pixels.

According to the above formula, the FOV width w at a distance d of 10 m is:

w = 10 m × 36 mm / 50 mm = 7.2 m

For the FOV height h visible in a distance d of 10 m we get:

h = 7.2 m × 1080 / 1920 = 7.2 m × 0.5625 = 4.05 m

As you can see in the following picture, the outer poles standing 7.2 m apart are at the edge of the FOV:

fov 16:9

If you now change the image resolution from 1920 × 1080 to 1080 × 1080, absolutely nothing happens to the FOV width w at a distance d = 10 m, because as long as x is not bigger than y, the formulas calculate as before. So although the value w = 7.2 m stays the same, this does have an effect on the FOV height h, because a square image resolution changes the y/x ratio:

h = 7.2 m × 1080 / 1080 = 7.2 m × 1 = 7.2 m

And this is what you are experiencing when decreasing the Resolution X of the image down until the values are the same, the FOV width stays the same and the height increases. This stays true as long as x >= y, so when you set a square image size it looks like this:

fov square

Now comes the seemingly strange thing... if you now continue to decrease the Resolution X or start increasing Resolution Y, then Sensor Fit > "Auto" is responsible for automatically flipping the formulas because in a vertical image the width is smaller than the height. I guess the "Auto" option is working as if you had a real camera and held it rotated by 90°. Since the sensor inside the camera is rotated as well now the vertical resolution is the one that is determined by focal length and sensor size, which results in now having these "re-arranged" formulas calculating the FOV:

h = d × s / f

w = h × x / y

By continuously decreasing the Resolution X (or increasing Resolution Y after reaching x = y) this results in increasing height at a constant width until height = width and then height keeps its size while the width now decreases.

fov 9:16

I found a website with a FOV calculator (for real cameras, not Blender camera objects), if you enter the above values there you'll find the results are the same. A focal length of 50 mm with a sensor size of 36 mm × 24 mm cropped to a 16:9 image ratio results in a FOV width of 7.2 m and a height of 4.05 m in a distance of 10 m (actually they are using units, because for the result it doesn't matter if you enter all values in meters, feet or even Blender units). This works for horizontal images. The difference there is, there is no "Auto Fit" like in Blender, i.e. if you set a square cropping aspect ratio of 1:1, you don't get 7.2 × 7.2 m for the FOV but 4.8 × 4.8 m. That's due to the fact that in real cameras cropping an image to square means you have to cut off the sides of the image, because a real physical sensor will not increase it's height, while the Blender "Auto Fit" option assumes that when the width is 36 mm and the ratio is 1:1, then the height is 36 mm as well. Here's the link: FoV Calculator

fov calculator

$\endgroup$
4
  • $\begingroup$ Thank you! This is impressive, and it will take some time for me to digest it. I wonder if it's fair to say "X and Y resolutions in pixels do not matter for the FOV?" If you choose a Resolution X or Y ratio that is wildly different than your camera's dimensions, the FOV in Blender is likely to look totally different than your camera. This is really the essence of my confusion. $\endgroup$
    – S. Imp
    Apr 20 at 23:22
  • $\begingroup$ I've added a sentence to that paragraph, I thought I made it clear in my comments earlier but again, of course the pixels matter in relation to each other since that calculates the ratio, but as long as the ratio is the same the FOV stays. I said X and Y don't matter, not the ratio between X and Y doesn't matter. So images with 1920x1080 pixels, 960x540 pixels or any images with a 16:9 pixel ratio will have the exact same FOV, in that way the absolute pixels have no effect on the FOV. $\endgroup$ Apr 21 at 4:29
  • 2
    $\begingroup$ I'm a math primitive so will have to stay with my "easy-peasy" explanation :), but your descriptive and beautifully presented graphics are really pleasant to follow. Thank you for such a hard work. $\endgroup$
    – vklidu
    Apr 21 at 9:06
  • 1
    $\begingroup$ Maths is the only thing I'm half-decent at :D Made another edit to my answer with a link to a (real camera) FoV Calculator website where you can compare the values and maybe use for computing values you might insert in Blender. $\endgroup$ Apr 21 at 10:00

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.