When used inside a node group in multiple scenes, the defocus node does not refresh active camera data. #38340

Closed
opened 2014-01-23 20:20:15 +01:00 by Sam Brubaker · 20 comments

Version: 2.69 official (win 64)

How to reproduce: Render First Scene. The orange cube is in focus, as it is being used as the active camera's focal point. The defocus node is inside a node group used by both scenes. Now, render the second scene. Notice that the orange cube is out of focus even though the active camera is also using it as a focal point.

Expected behavior: Since both scenes are identical except for the cameras, and both cameras use the same focus, the orange cube should be in focus for both scenes. Instead, it seems that the defocus node persists in using the camera distance data from the first scene in which it was originally added.

Defocus_Node_Bug.blend

Version: 2.69 official (win 64) How to reproduce: Render First Scene. The orange cube is in focus, as it is being used as the active camera's focal point. The defocus node is inside a node group used by both scenes. Now, render the second scene. Notice that the orange cube is out of focus even though the active camera is also using it as a focal point. Expected behavior: Since both scenes are identical except for the cameras, and both cameras use the same focus, the orange cube should be in focus for both scenes. Instead, it seems that the defocus node persists in using the camera distance data from the first scene in which it was originally added. [Defocus_Node_Bug.blend](https://archive.blender.org/developer/F74356/Defocus_Node_Bug.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @rocketman

Added subscriber: @rocketman

Added subscribers: @Jeroen-Bakker, @monique, @LukasTonne

Added subscribers: @Jeroen-Bakker, @monique, @LukasTonne

Added subscriber: @brecht

Added subscriber: @brecht

I think this was added intentionally so that you could do compositing of multiple scenes in one compositing node setup, or use a separate scene for compositing and rendering.

The node remembers the scene, and perhaps that value should be exposed to the user. If empty it uses the current scene, if not you can get the current camera from another scene? I'm not sure what the default should be, perhaps it's least confusing if it's empty and uses the current scene.

I think this was added intentionally so that you could do compositing of multiple scenes in one compositing node setup, or use a separate scene for compositing and rendering. The node remembers the scene, and perhaps that value should be exposed to the user. If empty it uses the current scene, if not you can get the current camera from another scene? I'm not sure what the default should be, perhaps it's least confusing if it's empty and uses the current scene.
Author

@brecht, I wondered about that right after I reported this. That "feature" would be useful for just such a thing, but it seems wrong to make it ambiguous to the user.

I agree with your suggestion on how it could be fixed. That way, defocus can be used in one node group across all scenes if I want (I do want).

@brecht, I wondered about that right after I reported this. That "feature" would be useful for just such a thing, but it seems wrong to make it ambiguous to the user. I agree with your suggestion on how it could be fixed. That way, defocus can be used in one node group across all scenes if I want (I do want).
Member

This scene-dependency of compositor is quite horrible IMO. It's a quick solution for getting scene info into nodes, but design is weak and it breaks really easy with changing contexts.

Similar issue, where compositing without a scene also doesn't work because of this dependency of the Defocus node: #36745

This scene-dependency of compositor is quite horrible IMO. It's a quick solution for getting scene info into nodes, but design is weak and it breaks really easy with changing contexts. Similar issue, where compositing *without* a scene also doesn't work because of this dependency of the Defocus node: #36745
Member

Just for the record, here is a list of nodes which afaict currently store a scene reference in node->id:

Type Comment
Render Layers can be selected explicitly by user
Composite scene is identified by name during composite
Defocus used only for active camera object
File Output not used except for initializing output file format
Just for the record, here is a list of nodes which afaict currently store a scene reference in node->id: | Type | Comment | | ----- | ----- | | Render Layers | can be selected explicitly by user | | Composite | scene is identified by name during composite | | Defocus | used only for active camera object | | File Output | not used except for initializing output file format |
Author

@LukasTonne , That's a very good observation.

If you want to rectify this scene dependency of the Defocus Node, there could be an additional Input node called "Active Camera Data" which would feed DoF and Focus depth values into the Defocus Node.

That way, the Defocus Node would not need to reference any external scene data by itself. In a perfect system, only input nodes should do that.

@LukasTonne , That's a very good observation. If you want to rectify this scene dependency of the Defocus Node, there could be an additional Input node called "Active Camera Data" which would feed DoF and Focus depth values into the Defocus Node. That way, the Defocus Node would not need to reference any external scene data by itself. In a perfect system, only input nodes should do that.

I think the standard solution would be to include camera data in the EXR metadata, and in Blender it would also be in the RenderResult then. I couldn't quickly find a standard for this metadata, but if you Google for "exr camera metadata" you'll find a bunch of information about people doing similar things.

I think the standard solution would be to include camera data in the EXR metadata, and in Blender it would also be in the RenderResult then. I couldn't quickly find a standard for this metadata, but if you Google for "exr camera metadata" you'll find a bunch of information about people doing similar things.
Author

I agree, @brecht , but which scene's camera data would the output node use? You would still have the same issue as with the Defocus node, in that the node is taking invisible inputs (i.e., camera data) that are not exposed to the user.

If I have an EXR with camera data, but I'm compositing it with another scene with camera data, I would need to specify what camera data goes where. Currently, the Defocus node invisibly pulls the camera data from the scene in which it was first added. How can we unblock the user from choosing the relevant camera inputs for the Defocus and other output nodes?

I agree, @brecht , but which scene's camera data would the output node use? You would still have the same issue as with the Defocus node, in that the node is taking invisible inputs (i.e., camera data) that are not exposed to the user. If I have an EXR with camera data, but I'm compositing it with another scene with camera data, I would need to specify what camera data goes where. Currently, the Defocus node invisibly pulls the camera data from the scene in which it was first added. How can we unblock the user from choosing the relevant camera inputs for the Defocus and other output nodes?

Added subscriber: @Sergey

Added subscriber: @Sergey

@brecht, @LukasTonne what would be the plan here?

@brecht, @LukasTonne what would be the plan here?
Member

I would suggest to only use scene (or other ID pointers) in node->id when they are real ID block references that can be selected by the user. These would then stay fixed across changing contexts as well, which avoids a lot of ugly code in blenkernel.

For cases where the node->id is actually context dependent (composite, defocus) it should not be used at all. Rather for these nodes the context (which is given for a compositor execution) then defines the actual scene from which to take camera data and output render data.

This should also fix issues where the hard scene pointer gets outdated, see #38473.

It would also allow for flexible behavior as suggested by @brecht above: If no ID is selected by the user, the context can be used instead.

I would suggest to only use scene (or other ID pointers) in `node->id` when they are *real* ID block references that can be selected by the user. These would then stay fixed across changing contexts as well, which avoids a lot of ugly code in blenkernel. For cases where the `node->id` is actually context dependent (composite, defocus) it should not be used at all. Rather for these nodes the context (which is given for a compositor execution) then defines the actual scene from which to take camera data and output render data. This should also fix issues where the hard scene pointer gets outdated, see #38473. It would also allow for flexible behavior as suggested by @brecht above: If no ID is selected by the user, the context can be used instead.

So I think in practice that means:

  • Composite and File Output: remove node->id usage and get scene from context
  • Defocus node: make the node->id scene user editable, and if NULL get scene from the context.

Making camera data something you can read from EXR and pass along in the node editor would be nice but beyond the scope of a bugfix I think, the changes above should be relatively simple?

So I think in practice that means: * Composite and File Output: remove node->id usage and get scene from context * Defocus node: make the node->id scene user editable, and if NULL get scene from the context. Making camera data something you can read from EXR and pass along in the node editor would be nice but beyond the scope of a bugfix I think, the changes above should be relatively simple?
Lukas Tönne self-assigned this 2014-02-04 16:12:16 +01:00
Author

That sounds like a fine solution. Thanks, Everyone!

That sounds like a fine solution. Thanks, Everyone!

This issue was referenced by blender/blender-addons-contrib@1687023776

This issue was referenced by blender/blender-addons-contrib@1687023776a3ce0de41a4cfe0ebc72a5ebadabe4

This issue was referenced by 1687023776

This issue was referenced by 1687023776a3ce0de41a4cfe0ebc72a5ebadabe4
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Closed by commit 1687023776.

Closed by commit 1687023776.
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
5 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#38340
No description provided.