Regression: Stretched image in the viewport when viewed from the lamp object #101533

Closed
opened 2022-10-01 17:36:52 +02:00 by Oleg · 19 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.59

Blender Version
Broken: version: 3.3.0, branch: master, commit date: 2022-09-06 15:39, hash: 0759f671ce
Worked: (3.2.2)
Caused by 2e70d5cb98

Short description of error
Stretched image in the viewport when viewed from the lamp. Bug present on EEVEE and material preview

Exact steps for others to reproduce the error
Open default scene, select lamp, switch to view from a lamp (ctrl+numpad 0), switch to material preview mode or eevee rendered mode. Problem on all lamps except the Sun lamp.
Снимок.PNG

stretched out.blend

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.59 **Blender Version** Broken: version: 3.3.0, branch: master, commit date: 2022-09-06 15:39, hash: `0759f671ce` Worked: (3.2.2) Caused by 2e70d5cb98 **Short description of error** Stretched image in the viewport when viewed from the lamp. Bug present on EEVEE and material preview **Exact steps for others to reproduce the error** Open default scene, select lamp, switch to view from a lamp (ctrl+numpad 0), switch to material preview mode or eevee rendered mode. Problem on all lamps except the Sun lamp. ![Снимок.PNG](https://archive.blender.org/developer/F13603039/Снимок.PNG) [stretched out.blend](https://archive.blender.org/developer/F13603038/stretched_out.blend)
Author

Added subscriber: @SamBacket

Added subscriber: @SamBacket

#101817 was marked as duplicate of this issue

#101817 was marked as duplicate of this issue

Added subscriber: @mod_moder

Added subscriber: @mod_moder

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

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

Something strange. There are 2 things that confuse me here:

  • Is there a real opportunity to watch from the camera-lamp?
  • It looks like eevee does not take this into account, and converts the image for the camera, not the lamp (blur direction) (also, if you move the lamp to the camera and center it, as well as zoom in on the screen view, the effect is minimized)
Something strange. There are 2 things that confuse me here: - Is there a real opportunity to watch from the camera-lamp? - It looks like eevee does not take this into account, and converts the image for the camera, not the lamp (blur direction) (also, if you move the lamp to the camera and center it, as well as zoom in on the screen view, the effect is minimized)
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

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

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

I'll bisect it later. Regression, so raising the priority.

I'll bisect it later. Regression, so raising the priority.
Pratik Borhade changed title from Stretched image in the viewport when viewed from the lamp object on eevee to Regression: Stretched image in the viewport when viewed from the lamp object 2022-10-02 11:32:24 +02:00
Member

Added subscriber: @pioverfour

Added subscriber: @pioverfour
Member

First bad commit- 2e70d5cb98
cc @pioverfour

First bad commit- 2e70d5cb98 cc @pioverfour
Member

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

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

The single change that causes this is the addition of char focus_subtarget[64] in the CameraDOFSettings struct in DNA_camera_types.h.

After that, the lamp behaves exactly like a camera with f-stop and dof ratio at 0.0.

Actually, the behavior existed before, just not with lamps. It can be reproduced in Blender 3.2 with a mesh object for instance.
mesh_as_camera.blend

My understanding is that this revealed a pre-existing faulty behavior in Eevee’s DoF evaluation: it never checks that the cam->dof struct is actually defined for the object, which it’s not for lights, and it thus points to a bad location.

A possible fix?

diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c
index 0d14a0c5f61..caa63b9c54c 100644
--- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c
+++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c
@@ -189,7 +189,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata),
   const DRWContextState *draw_ctx = DRW_context_state_get();
   const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
 
-  Camera *cam = (camera != NULL) ? camera->data : NULL;
+  Camera *cam = (camera != NULL && camera->type == OB_CAMERA) ? camera->data : NULL;
 
   if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) {
     RegionView3D *rv3d = draw_ctx->rv3d;

In #101533#1426210, @mod_moder wrote:

  • Is there a real opportunity to watch from the camera-lamp?

Do you mean is there a use case for setting the light as a camera? If so, yes: it can be very useful to aim the light at a specific location.

The single change that causes this is the addition of `char focus_subtarget[64]` in the `CameraDOFSettings` struct in DNA_camera_types.h. After that, the lamp behaves exactly like a camera with f-stop and dof ratio at 0.0. Actually, the behavior existed before, just not with lamps. It can be reproduced in Blender 3.2 with a mesh object for instance. [mesh_as_camera.blend](https://archive.blender.org/developer/F13610249/mesh_as_camera.blend) My understanding is that this revealed a pre-existing faulty behavior in Eevee’s DoF evaluation: it never checks that the `cam->dof` struct is actually defined for the object, which it’s not for lights, and it thus points to a bad location. A possible fix? ``` diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 0d14a0c5f61..caa63b9c54c 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -189,7 +189,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), const DRWContextState *draw_ctx = DRW_context_state_get(); const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); - Camera *cam = (camera != NULL) ? camera->data : NULL; + Camera *cam = (camera != NULL && camera->type == OB_CAMERA) ? camera->data : NULL; if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) { RegionView3D *rv3d = draw_ctx->rv3d; ``` > In #101533#1426210, @mod_moder wrote: > - Is there a real opportunity to watch from the camera-lamp? Do you mean is there a use case for setting the light as a camera? If so, yes: it can be very useful to aim the light at a specific location.

I meant exactly that the lamp is set as a render camera

I meant exactly that the lamp is set as a render camera
Miguel Pozo self-assigned this 2022-11-07 13:03:27 +01:00

This issue was referenced by d0e9a8c46a

This issue was referenced by d0e9a8c46aba056144b1bfe8ddd55cc1d6ccc56e

This issue was referenced by 84d8698488

This issue was referenced by 84d86984885759f8f21d382cc8c699341be626a3
Member

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

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

@pioverfour Your suggested fix was right.

There was a similar issue in the workbench and the GP engine that I fixed too.

@pioverfour Your suggested fix was right. There was a similar issue in the workbench and the GP engine that I fixed too.
Member

In #101533#1442040, @pragma37 wrote:
@pioverfour Your suggested fix was right.

Good to know, thanks! I wasn’t too sure whether there could be a better one.

> In #101533#1442040, @pragma37 wrote: > @pioverfour Your suggested fix was right. Good to know, thanks! I wasn’t too sure whether there could be a better one.
Member
Added subscribers: @Guilherme-Emerich-Setubal, @OmarEmaraDev
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
6 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#101533
No description provided.