Viewport "Focal Length" doesn't match Camera's focal length #78320

Open
opened 2020-06-26 17:24:03 +02:00 by Adam · 13 comments

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

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
Bastien Montagne was assigned by Adam 2020-06-26 17:24:03 +02:00
Author

Added subscribers: @50p, @ideasman42, @mont29, @padone

Added subscribers: @50p, @ideasman42, @mont29, @padone
Bastien Montagne removed their assignment 2020-06-26 17:31:12 +02:00

Added subscriber: @iss

Added subscriber: @iss

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

Are these steps applicable?

  • Press {key 0} to switch to camera view
  • Press {key Home} to maximize camera area so it matches viewport closely
  • Align view with object
  • Press {key Ctrl Alt 0}
    Camera is placed closer to object as viewport camera was.
Are these steps applicable? - Press {key 0} to switch to camera view - Press {key Home} to maximize camera area so it matches viewport closely - Align view with object - Press {key Ctrl Alt 0} Camera is placed closer to object as viewport camera was.

Added subscriber: @mano-wii

Added subscriber: @mano-wii

I don't really understand the concept of Focal Length in OpenGL
https://en.wikipedia.org/wiki/Focal_length

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:
ctrl-alt-0.gif

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

I don't really understand the concept of Focal Length in OpenGL https://en.wikipedia.org/wiki/Focal_length 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: ![ctrl-alt-0.gif](https://archive.blender.org/developer/F8654002/ctrl-alt-0.gif) 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 #43039.

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

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 #43039. 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 */
 #define CAMERA_PARAM_ZOOM_INIT_CAMOB 1.0f
-#define CAMERA_PARAM_ZOOM_INIT_PERSP 2.0f
+#define CAMERA_PARAM_ZOOM_INIT_PERSP 1.0f
 
 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.

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 */ #define CAMERA_PARAM_ZOOM_INIT_CAMOB 1.0f -#define CAMERA_PARAM_ZOOM_INIT_PERSP 2.0f +#define CAMERA_PARAM_ZOOM_INIT_PERSP 1.0f 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.

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.

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

I'd say there is not much to add from the perspective of the triaging team, now the developer module needs to decide on how to proceed?

I'd say there is not much to add from the perspective of the triaging team, now the developer module needs to decide on how to proceed?
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:24:21 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#78320
No description provided.