Advanced Camera Tools and focal length

Hi all,

I’m struggling with the focal length from Advanced Camera Tools. I’m using the PC only camera debug window to read the camera properties.

I create a scene, set a custom aspect ratio (which forces SketchUp to internally use a horizontal FOV, not a vertical) and set up a focal length. Then, without moving the camera, I create an Advanced Camera Tools camera in the same place. In Advanced Camera Tools I select a physical camera, e.g. a 35 mm one. Finally I copy the W/H (ratio) value of the ACT scene and apply it in my own scene using the debug window.

This gives me two seemingly identical cameras. However, if I query SketchUp for the focal length two widely different values are returned.

Does anyone know if there are additional camera properties not shown in this dialog? Judging from the debug window, the focal length isn’t used internally but is converted into a fov value (angular value). However this value is identical for my two scenes. It seems there is a difference between the two scenes in convertion between focal length and field of view though.

Here are the code snippets I use:

# Show camera debug window.
Sketchup.send_action(10624)

# Add scene with custom aspect ratio and focal length.
camera = Sketchup.active_model.active_view.camera
camera.focal_length = 35
camera.aspect_ratio = 4/3.0
Sketchup.active_model.pages.add

# Get current focal length.
Sketchup.active_model.active_view.camera.focal_length

Lol, it seems I have a history of finding things myself minutes after I write a post about it and force myself to sort out my thoughts. Just found the Camera#image_width method!

Hard to find when you are not looking for it but I had a vague memory of there being a method I couldn’t make sense of, that I mixed up with the Camera#height method for parallel projection cameras in the past.

1 Like

If I understand everything correctly focal length is in reality a measurement of angle of view, not the physical focal length of the lens. Two cameras with differently large lenses and sensors, at different distances, but the same same angle of view, are considered to have the same “focal length”, not?

The next question is why the SketchUp core/Ruby API has gone through the trouble of optionally saving an image width for a scene, and have it affect the focal length. An “undefined” image width is expressed with a value of 0. It certainly adds complexity and makes it harder to understand what is going on, but is there any gain from it? Couldn’t the physical focal length just be calculated internally in ACT if it’s needed there, or is it useful when importing the SketchUp model in other softwares, e.g. for rendering?

The history of this is lost to me. But yes, the API is weird. Even the fact that by default AOV in SU is vertical. But the moment you set an aspect ratio it switches to horizontal. (That was even a big problem before because the API did let you query whether the AOV was horizontal or vertical.

You can see in Safe Frames how it avoids the visual “jump” when setting the aspect ratio:

Yup - explaining the problem to someone else is an effective method of getting better clarity on the problem. Hence “talking to the parrot”.

When image width is set to 0 it is considered to be undefined - and will default to 36mm.

Source code comment from the property:

  // This is the width of the image projected onto the "film".  It is used
  // to convert from lens angle (field of view) to focal length.
  // If this is not set, it uses 36mm for the width to agree with
  // what we were doing prior to 4.0
1 Like

Thanks Thomas!

You know a lot more about cameras than I’ll probably ever do. Could you confirm I’ve understood it correctly that the focal length of a camera typically isn’t referring to the actual focal length, but to what focal length would give the same angle of view for a 36 mm film (thus being a measurement of aov)?

Also, is there a more specific term for this “non-physical” focal distance? I’d like to write up a feature request for getting and setting this property, but don’t know what to call it.

Edit: It seems to be called equivalent focal length.

Edit2: Or 35 mm equivalent focal length to be more precise (35 mm being the height of the film, film transport included, with the width being 36 mm).

Maybe a little off topic in regards to SketchUp’s camera but in terms of real lenses, that’s not quite correct. The focal length of the lens is a distance the image plane. It matters not how large the image plane (film, sensor, etc.) is. In a simple single lens system that is the distance from the image plane to the middle of the lens. In complex lens systems such as those used on camera, the point will often be in air somewhere in the system or in front of or behind the lens system. For the sake of simplifying the discussion, though, you can think of those complex lens systems as a simple single lens.

The angle of view is a function of the focal length and also the size of the sensor/film. That table I sent you the link to shows different angles of view based on film or sensor size. Here are three focal lengths represented and the angles shown for the horizontal length of the 35mm film frame.

You can imagine that if the frame or image sensor is shorter, the angle of view for the given focal length will be narrower. And, assuming the lens had the angle of coverage available, if the film/sensor is larger, the angle of view will be wider for the given focal length. (Angle of coverage is a design characteristic. Manufacturers typically do things to their lenses such as adding masks to limit the angle of coverage to only slightly more than that required for the film/sensor.)

1 Like

Logged as #242.

No. Focal length is focal length, that is, roughly, the distance between the lens and the film. Digital camera specs often use a number that denotes a 35 mm “focal length” to indicate that the lens has a field of view roughly identical to a 35 mm lens of the denoted focal length. Camera specs usually also tell the actual focal length of the lens. This is just because photographers used to talk more about focal lengths than view angles. But when you buy a 50 mm lens for a “full frame” camera you get a "normal"lens whereas in a medium format camera like your native Hasselblad the same focal length lens is a wideangle.

1 Like

I would concur that the focal length of a real world lens is absolute but it “behaves” differently depending on the film/sensor size it is used with. The smaller the sensor the narrower the effective FOV becomes for an equivalent focal length and visa versa.

The SU FOV default to vertical has always seemed an odd choice, as my experience in the real world has always favored the horizontal FOV. Given that aspect ratios are more generally wider than higher (even if using camera sideways in stills as opposed to cinematography), the horizontal becomes the more important consideration to ensure the lens can cover the sensor without vignetting. The vertical part is then more of a crop depending on aspect ratio.

If in the below example the consideration is given to the vertical FOV (red) there is the danger of vignetting at the sides (not just the corners), whereas if the consideration is given to the horizontal (green) then we can be sure the whole sensor is covered correctly.

Note that in a camera, the FOV is measured diagonally across the frame. This removes the vignetting issue totally.