When Render Single Layer is enabled, switching to another View Layer and rendering a different frame range, Compositing File Output saves a frame of the previous (unwanted) layer #112769

Open
opened 2023-09-23 11:05:32 +02:00 by Kirill Buzmakov · 3 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.23

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-22 23:32, hash: 7c636c170273
Worked: -

Short description of error
When Render Single Layer is enabled, switching to another View Layer and rendering a different frame range, Compositing File Output saves the first frame (in the new frame range) of the previous (unwanted) layer.

Exact steps for others to reproduce the error

Per attached .blend:

  • Enable "Render Single Layer" in the View Layer tab in Properties.

  • In the "Cube" view layer, render out a sequence of frames (for example 5 to 10) using Compositing node "File Output". Use a separate folder for simpler reference (e.g. "Cube/Cube_")

  • Switch to the "Sphere" view layer. Change the frame range so that it includes new frames compared to before - for example, use 0-10. Render to another folder, e.g. Sphere/Sphere.

  • You will now notice that, despite using "Render Single Layer" and switching to Sphere, a new frame appeared in the Cube folder: Cube_0000 (or whatever other frame was first in the new sequence). This is incorrect behavior, in my opinion. Moreover, if the Cube already had a rendered frame in that range, it will get replaced by this new, incorrect frame.

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.23 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-22 23:32, hash: `7c636c170273` Worked: - **Short description of error** When Render Single Layer is enabled, switching to another View Layer and rendering a different frame range, Compositing File Output saves the first frame (in the new frame range) of the previous (unwanted) layer. **Exact steps for others to reproduce the error** Per attached .blend: - Enable "Render Single Layer" in the View Layer tab in Properties. - In the "Cube" view layer, render out a sequence of frames (for example 5 to 10) using Compositing node "File Output". Use a separate folder for simpler reference (e.g. "Cube/Cube_") - Switch to the "Sphere" view layer. Change the frame range so that it includes new frames compared to before - for example, use 0-10. Render to another folder, e.g. Sphere/Sphere. - You will now notice that, despite using "Render **Single** Layer" and switching to Sphere, a new frame appeared in the Cube folder: Cube_0000 (or whatever other frame was first in the new sequence). This is incorrect behavior, in my opinion. Moreover, if the Cube already had a rendered frame in that range, it will get replaced by this new, incorrect frame.
Kirill Buzmakov added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-09-23 11:05:33 +02:00
Member

Thanks for the report. Can confirm. Looks like an old issue (persists in 3.0 too)

Thanks for the report. Can confirm. Looks like an old issue (persists in 3.0 too)
Jesse Yurkovich added the
Module
VFX & Video
label 2023-10-04 04:42:16 +02:00
Member

This is due to a weak design where the previous RenderResult gets remembered (called pushedresult in code), the new single layer rendered (possibly on a different frame -- and this is where it breaks easily [but it also breaks when the pass structure is different in the layers]) and then in render_result_single_layer_end the layers that should be unaffected are replaced by what is found in the remembered pushedresult...which like I said can be from a different frame or can have different pass structure).

#95615 is related

This is due to a weak design where the previous `RenderResult` gets remembered (called `pushedresult` in code), the new single layer rendered (possibly on a different frame -- and this is where it breaks easily [but it also breaks when the pass structure is different in the layers]) and then in `render_result_single_layer_end` the layers that should be unaffected are replaced by what is found in the remembered `pushedresult`...which like I said can be from a different frame or can have different pass structure). #95615 is related
Member

This is due to a weak design where the previous RenderResult gets remembered (called pushedresult in code), the new single layer rendered (possibly on a different frame -- and this is where it breaks easily [but it also breaks when the pass structure is different in the layers]) and then in render_result_single_layer_end the layers that should be unaffected are replaced by what is found in the remembered pushedresult...which like I said can be from a different frame or can have different pass structure).

#95615 is related

To demonstrate the problem, here is a quick hack that would skip replacing the (unwanted) layer in case the framenumbers dont match.
I have done no further test in regards to causing issues elsewhere and this has the consequence that the "other" layer would just be blank in the RenderResult [which of course is unwanted as well], but this would at least solve the issue of the unwanted FileOutput node overwriting behavior:

diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc
index b811e60cade..fff1aa6283e 100644
--- a/source/blender/render/intern/render_result.cc
+++ b/source/blender/render/intern/render_result.cc
@@ -846,6 +846,7 @@ void render_result_single_layer_begin(Render *re)
   RE_FreeRenderResult(re->pushedresult);
 
   re->pushedresult = re->result;
+  re->pushedresult->framenr = re->r.cfra;
   re->result = nullptr;
 }
 
@@ -866,19 +867,26 @@ void render_result_single_layer_end(Render *re)
     RenderLayer *rl = static_cast<RenderLayer *>(re->result->layers.first);
 
     /* render result should be empty after this */
+    printf("render_result_single_layer_end removing %s from re->result->layers\n", rl->name);
     BLI_remlink(&re->result->layers, rl);
 
     /* reconstruct render result layers */
     LISTBASE_FOREACH (ViewLayer *, view_layer, &re->scene->view_layers) {
       if (STREQ(view_layer->name, re->single_view_layer)) {
+        printf("  render_result_single_layer_end adding %s frame %i to re->result->layers\n", re->single_view_layer, re->r.cfra);
         BLI_addtail(&re->result->layers, rl);
       }
       else {
         RenderLayer *rlpush = RE_GetRenderLayer(re->pushedresult, view_layer->name);
-        if (rlpush) {
+        if (rlpush && re->r.cfra == re->pushedresult->framenr) {
+          printf("  render_result_single_layer_end removing rlpush %s frame %i from re->pushedresult->layers\n", rlpush->name, re->pushedresult->framenr);
           BLI_remlink(&re->pushedresult->layers, rlpush);
+          printf("  render_result_single_layer_end adding  rlpush %s frame %i to re->result->layers\n", rlpush->name, re->pushedresult->framenr);
           BLI_addtail(&re->result->layers, rlpush);
         }
+        else {
+          printf("  render_result_single_layer_end skipping rlpush %s (frame %i does not match current frame %i)\n", rlpush->name, re->pushedresult->framenr, re->r.cfra);
+        }
       }
     }
   }
> This is due to a weak design where the previous `RenderResult` gets remembered (called `pushedresult` in code), the new single layer rendered (possibly on a different frame -- and this is where it breaks easily [but it also breaks when the pass structure is different in the layers]) and then in `render_result_single_layer_end` the layers that should be unaffected are replaced by what is found in the remembered `pushedresult`...which like I said can be from a different frame or can have different pass structure). > > #95615 is related To demonstrate the problem, here is a quick hack that would skip replacing the (unwanted) layer in case the framenumbers dont match. I have done no further test in regards to causing issues elsewhere and this has the consequence that the "other" layer would just be blank in the RenderResult [which of course is unwanted as well], but this would at least solve the issue of the unwanted FileOutput node overwriting behavior: ```diff diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc index b811e60cade..fff1aa6283e 100644 --- a/source/blender/render/intern/render_result.cc +++ b/source/blender/render/intern/render_result.cc @@ -846,6 +846,7 @@ void render_result_single_layer_begin(Render *re) RE_FreeRenderResult(re->pushedresult); re->pushedresult = re->result; + re->pushedresult->framenr = re->r.cfra; re->result = nullptr; } @@ -866,19 +867,26 @@ void render_result_single_layer_end(Render *re) RenderLayer *rl = static_cast<RenderLayer *>(re->result->layers.first); /* render result should be empty after this */ + printf("render_result_single_layer_end removing %s from re->result->layers\n", rl->name); BLI_remlink(&re->result->layers, rl); /* reconstruct render result layers */ LISTBASE_FOREACH (ViewLayer *, view_layer, &re->scene->view_layers) { if (STREQ(view_layer->name, re->single_view_layer)) { + printf(" render_result_single_layer_end adding %s frame %i to re->result->layers\n", re->single_view_layer, re->r.cfra); BLI_addtail(&re->result->layers, rl); } else { RenderLayer *rlpush = RE_GetRenderLayer(re->pushedresult, view_layer->name); - if (rlpush) { + if (rlpush && re->r.cfra == re->pushedresult->framenr) { + printf(" render_result_single_layer_end removing rlpush %s frame %i from re->pushedresult->layers\n", rlpush->name, re->pushedresult->framenr); BLI_remlink(&re->pushedresult->layers, rlpush); + printf(" render_result_single_layer_end adding rlpush %s frame %i to re->result->layers\n", rlpush->name, re->pushedresult->framenr); BLI_addtail(&re->result->layers, rlpush); } + else { + printf(" render_result_single_layer_end skipping rlpush %s (frame %i does not match current frame %i)\n", rlpush->name, re->pushedresult->framenr, re->r.cfra); + } } } } ```
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
3 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#112769
No description provided.