Page MenuHome

Viewport "Focal Length" doesn't match Camera's focal length
Needs Information from User, NormalPublic


I've noticed that camera's focal length and viewport's focal lengths don't match. I agree with the Alessandro Padovani (padone) who created the parent task.

Basically, when you have a scene and want to do a quick test render of what you see in the viewport you need to set the camera's position/rotation to viewport's view. To do that you first view the scene using the viewport then set the camera's position/rotation using Ctrl+Alt+0 (numpad) and hit F12. The problem with this is viewport's focal length and camera's focal length don't match even though they are both set to 50mm.
When you hit Ctrl+Alt+0, camera's position/rotation is set but what camera sees is actually zoomed in which seems like 100mm. So, if you want the camera to see what the viewport sees then you need to change viewport focal length to twice of what camera is.

I don't know what the parent task was closed.

I'm using Blender 2.90
Build date: 2020-06-23

Event Timeline

Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.Mon, Jun 29, 7:41 PM

Are these steps applicable?

  1. Press 0 to switch to camera view
  2. Press Home to maximize camera area so it matches viewport closely
  3. Align view with object
  4. Press Ctrl+Alt+0

Camera is placed closer to object as viewport camera was.

I don't really understand the concept of Focal Length in OpenGL

It seems that this is related to the focus of the image and not the matrix or edges of the projection.

I also tested using the same settings for clip start and cilp end and apparently the origin point is in the expected position:

Perhaps the edges of the camera have to match the smallest side idk

Not sure how this is applicable to openGL but in context of cameras this is really just field of view. I think this report is not titled correctly. It may look like this is FL issue while it is camera placement issue. Steps I wrote down are destilled from last post in T43039.

Still not sure if this would be a bug, but it does look like a bug.

This change causes the projection matrix of the camera and the viewport to have the same field of view:

diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index 812f5d520d7..2bcb055acec 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -88,7 +88,7 @@ typedef struct CameraParams {
 /* values for CameraParams.zoom, need to be taken into account for some operations */
 void BKE_camera_params_init(CameraParams *params);
 void BKE_camera_params_from_object(CameraParams *params, const struct Object *camera);

It would also be necessary to change other default values such as the viewport depth of field and perhaps the initial camera's bounds.

That seems to resolve issue I outlined, so I would send that for review regardless. Still I would wait for response if this is actually issue originally reported maybe.