VSE: view > sequence render animation (bpy.ops.render.opengl) ignoring scene start frame #107726

Closed
opened 2023-05-08 09:49:42 +02:00 by Ivan Cappiello · 20 comments
Member

System Information
Operating system: macOS-13.3.1-arm64-arm-64bit 64 Bits
Graphics card: Metal API Apple M1 Pro 1.2

Blender Version
Broken: version: 3.5.1, branch: blender-v3.5-release, commit date: 2023-04-24 18:11, hash: e1ccd9d4a1d3
Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-04-02 15:08, hash: dc63f75837f2
Worked: (n.a)

Short description of error
VSE View > Sequence Render Animation (bpy.ops.render.opengl) ignores scene start frame and always set the current frame as start frame.

vseIssue.mp4

Exact steps for others to reproduce the error

  • Open the attached .blend file
  • switch to the "edit" scene
  • go to "Video Editing" workspace
  • move the cursor on the timeline to the blue area
  • In the Video Sequencer Preview (on top), got to View menu and do a Sequence Render Animation

from now on both the viewport render and VSE (bpy.ops.render.opengl) seems to ignore the start frame and use their relative current frame as start.

NOTE: this not happens on file load. But if you switch from edit scene, move the cursor and then switch back to anim scene and move the cursor on timeline again, the issue will be present. This will be more evident in VSE since will only render the blue color ignoring the orange (which is before current frame in my test file).

**System Information** Operating system: macOS-13.3.1-arm64-arm-64bit 64 Bits Graphics card: Metal API Apple M1 Pro 1.2 **Blender Version** Broken: version: 3.5.1, branch: blender-v3.5-release, commit date: 2023-04-24 18:11, hash: `e1ccd9d4a1d3` Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-04-02 15:08, hash: `dc63f75837f2` Worked: (n.a) **Short description of error** VSE `View` > `Sequence Render Animation` (bpy.ops.render.opengl) ignores scene start frame and always set the current frame as start frame. [vseIssue.mp4](attachments/a6ee5a48-f32a-4ef5-be8b-4fd6a51ec3e6) **Exact steps for others to reproduce the error** - Open the attached .blend file - switch to the "edit" scene - go to "Video Editing" workspace - move the cursor on the timeline to the blue area - In the Video Sequencer Preview (on top), got to `View` menu and do a `Sequence Render Animation` from now on both the viewport render and VSE (bpy.ops.render.opengl) seems to ignore the start frame and use their relative current frame as start. NOTE: this not happens on file load. But if you switch from edit scene, move the cursor and then switch back to anim scene and move the cursor on timeline again, the issue will be present. This will be more evident in VSE since will only render the blue color ignoring the orange (which is before current frame in my test file).
Ivan Cappiello added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-05-08 09:49:43 +02:00
Ivan Cappiello changed title from VSE: view > sequence render animation (buy.ops.render.opengl) ignoring scene start frame to VSE: view > sequence render animation (bpy.ops.render.opengl) ignoring scene start frame 2023-05-08 09:52:02 +02:00
Author
Member
@CorradoPiscitelli
Iliya Katushenock added the
Interest
Render Pipeline
Interest
Video Sequencer
labels 2023-05-08 10:27:48 +02:00
Member

Today's 3.6 seems to be working correctly here. I'm on linux.

Today's 3.6 seems to be working correctly here. I'm on linux.
Author
Member

@ChengduLittleA yes, downloaded the latest nightly and seems fixed.
still 3.5.1 seems affected. Probably the fix should be back ported.
Will update description accordingly.

EDIT:
With my updated test file the issue is present in both 3.5.1 and 3.6

@ChengduLittleA ~~yes, downloaded the latest nightly and seems fixed. still 3.5.1 seems affected. Probably the fix should be back ported. Will update description accordingly.~~ EDIT: With my updated test file the issue is present in both 3.5.1 and 3.6

I tested it in blender 3.5.1 but I didn't notice the problem. All frames have been rendered.
Has the problem been fixed?

I used the attached file.

(Note that Blender 3.5 is already frozen and no longer receives bug fixes)

I tested it in blender 3.5.1 but I didn't notice the problem. All frames have been rendered. Has the problem been fixed? I used the attached file. (Note that Blender 3.5 is already frozen and no longer receives bug fixes)
Germano Cavalcante added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-05-08 20:56:32 +02:00
Author
Member

seems that the simplified file i created to reproduce the issue, on reopening was working. So i came back to my original file. This file contains two scenes:

• anim - a simple 3D scene with a suzanne and a camera
• edit - a vse scene in which i added two color slugs on one track and the anim scene on another. The anim scene has also an offset in time on VSE track.

at this point 3D view and VSE are acting correctly, but if you go in VSE scene move the cursor on the timeline and then switch back to anim scene and move the cursor on timeline again, from now on both the viewport render and VSE (bpy.ops.render.opengl) seems to ignore the start frame and use their relative current frame as start.

NOTE: this not happens on file load. But if you switch from edit scene, move the cursor and then switch back to anim scene and move the cursor on timeline again, the issue will be present. This will be more evident in VSE since will only render the blue color ignoring the orange (which is before current frame).

i am adding a video demonstrating the issue and updating the scene file for rapid testing. Keep in mind that color slugs are useless except for fast showing that playhead is ignored in render.

i will edit the description with updated informations

seems that the simplified file i created to reproduce the issue, on reopening was working. So i came back to my original file. This file contains two scenes: • anim - a simple 3D scene with a suzanne and a camera • edit - a vse scene in which i added two color slugs on one track and the anim scene on another. The anim scene has also an offset in time on VSE track. at this point 3D view and VSE are acting correctly, but if you go in VSE scene move the cursor on the timeline and then switch back to anim scene and move the cursor on timeline again, from now on both the viewport render and VSE (bpy.ops.render.opengl) seems to ignore the start frame and use their relative current frame as start. NOTE: this not happens on file load. But if you switch from edit scene, move the cursor and then switch back to anim scene and move the cursor on timeline again, the issue will be present. This will be more evident in VSE since will only render the blue color ignoring the orange (which is before current frame). i am adding a video demonstrating the issue and updating the scene file for rapid testing. Keep in mind that color slugs are useless except for fast showing that playhead is ignored in render. i will edit the description with updated informations
Member

@icappiello dude where's the blend 😅 (the viewportRenderAnimation_bug.blendin the top of the thread doesn't have anim/edit scene)

@icappiello dude where's the blend 😅 (the `viewportRenderAnimation_bug.blend`in the top of the thread doesn't have anim/edit scene)
Author
Member

@icappiello dude where's the blend 😅 (the viewportRenderAnimation_bug.blendin the top of the thread doesn't have anim/edit scene)

hey @ChengduLittleA just redownloaded it and it has all the stuff!
You can switch the scene from the top bar, the you have to go in Video Editing layout cause blender doesn't store the interface layouts per scene.

> @icappiello dude where's the blend 😅 (the `viewportRenderAnimation_bug.blend`in the top of the thread doesn't have anim/edit scene) hey @ChengduLittleA just redownloaded it and it has all the stuff! You can switch the scene from the top bar, the you have to go in Video Editing layout cause blender doesn't store the interface layouts per scene.
Member

@icappiello ah sorry you actually updated the original file I thought it was still the old one 😅

But I'm still unable to replicate what's happening in your video, even I follow the step exactly... Both 3.5.1 and 3.6 works here...

@mano-wii You want to take a look again on your side?

@icappiello ah sorry you actually updated the original file I thought it was still the old one 😅 But I'm still unable to replicate what's happening in your video, even I follow the step exactly... Both 3.5.1 and 3.6 works here... @mano-wii You want to take a look again on your side?
Author
Member

@mano-wii can you please confirm the issue on your side?

@mano-wii can you please confirm the issue on your side?

Thanks for the detailed explanation.
I can confirm the issue shown in vseIssue.mp4, I've edited the description to make it clearer.

Thanks for the detailed explanation. I can confirm the issue shown in [vseIssue.mp4](attachments/a6ee5a48-f32a-4ef5-be8b-4fd6a51ec3e6), I've edited the description to make it clearer.
Germano Cavalcante added
Module
VFX & Video
Status
Confirmed
and removed
Status
Needs Information from User
labels 2023-06-13 23:56:55 +02:00

@mano-wii did you reproduce on Mac? seems to work fine on windows machine.

@mano-wii did you reproduce on Mac? seems to work fine on windows machine.
Author
Member

@iss seems at this point Mac related. @ChengduLittleA couldn't reproduce, that's why we asked @mano-wii to double check on mac-os and he confirmed already

@iss seems at this point Mac related. @ChengduLittleA couldn't reproduce, that's why we asked @mano-wii to double check on mac-os and he confirmed already

Ok, I don't have mac machine to check now, I can check next week.

Ok, I don't have mac machine to check now, I can check next week.
Author
Member

I can check next week.

@iss any progress?

> I can check next week. @iss any progress?

I can indeed reproduce this, but only on Mac machine. Will check why this happens.

I can indeed reproduce this, but only on Mac machine. Will check why this happens.

So far I have identified, that error happens in wm_event_do_handlers():

          if (is_playing_sound == 0) {
            const double time = BKE_sound_sync_scene(scene_eval);
            if (isfinite(time)) {
              int ncfra = round(time * FPS);
              if (ncfra != scene->r.cfra) {
                scene->r.cfra = ncfra;

I will have to look more at the code to understand what is this code for and how it can be fixed.

So far I have identified, that error happens in `wm_event_do_handlers()`: ``` if (is_playing_sound == 0) { const double time = BKE_sound_sync_scene(scene_eval); if (isfinite(time)) { int ncfra = round(time * FPS); if (ncfra != scene->r.cfra) { scene->r.cfra = ncfra; ``` I will have to look more at the code to understand what is this code for and how it can be fixed.

From what I gathered, the issue is, that BKE_sound_sync_scene() does not return NaN as soon as you change the frame. The function intentionally returns NaN when G.is_rendering is set.

Following code does fix the issue. @brecht would something like this be reasonable?

diff --git a/source/blender/editors/render/render_opengl.cc b/source/blender/editors/render/render_opengl.cc
index 9607065fdf3..9ad6d975587 100644
--- a/source/blender/editors/render/render_opengl.cc
+++ b/source/blender/editors/render/render_opengl.cc
@@ -936,6 +936,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
   CTX_wm_region_set(C, oglrender->prevar);
 
   MEM_delete(oglrender);
+  G.is_rendering = false;
 }
 
 static void screen_opengl_render_cancel(bContext *C, wmOperator *op)
@@ -993,6 +994,7 @@ static bool screen_opengl_render_anim_init(bContext *C, wmOperator *op)
     }
   }
 
+  G.is_rendering = true;
   oglrender->cfrao = scene->r.cfra;
   oglrender->nfra = PSFRA;
   scene->r.cfra = PSFRA;

Is is still unclear to me why the issue happens only on Mac.Will check on Windows machine.

From what I gathered, the issue is, that `BKE_sound_sync_scene()` does not return NaN as soon as you change the frame. The function intentionally returns NaN when `G.is_rendering` is set. Following code does fix the issue. @brecht would something like this be reasonable? ``` diff --git a/source/blender/editors/render/render_opengl.cc b/source/blender/editors/render/render_opengl.cc index 9607065fdf3..9ad6d975587 100644 --- a/source/blender/editors/render/render_opengl.cc +++ b/source/blender/editors/render/render_opengl.cc @@ -936,6 +936,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) CTX_wm_region_set(C, oglrender->prevar); MEM_delete(oglrender); + G.is_rendering = false; } static void screen_opengl_render_cancel(bContext *C, wmOperator *op) @@ -993,6 +994,7 @@ static bool screen_opengl_render_anim_init(bContext *C, wmOperator *op) } } + G.is_rendering = true; oglrender->cfrao = scene->r.cfra; oglrender->nfra = PSFRA; scene->r.cfra = PSFRA; ``` Is is still unclear to me why the issue happens only on Mac.Will check on Windows machine.

On further inspection, BKE_sound_scene_playing() does return -1 on Windows but on Mac it returns 0. This is because different synchronizer class is used - DefaultSynchronizer vs CoreAudioSynchronizer. Will make PR to audaspace to fix this.

That said, opengl render behaves erratically when rendering is started while playback is active, but this is same on both platforms and probably not a bug strictly speaking?

On further inspection, `BKE_sound_scene_playing()` does return -1 on Windows but on Mac it returns 0. This is because different synchronizer class is used - `DefaultSynchronizer` vs `CoreAudioSynchronizer`. Will make PR to audaspace to fix this. That said, opengl render behaves erratically when rendering is started while playback is active, but this is same on both platforms and probably not a bug strictly speaking?

On further inspection, BKE_sound_scene_playing() does return -1 on Windows but on Mac it returns 0. This is because different synchronizer class is used - DefaultSynchronizer vs CoreAudioSynchronizer. Will make PR to audaspace to fix this.

Seems better to fix it there indeed, G.rendering seems like a workaround.

That said, opengl render behaves erratically when rendering is started while playback is active, but this is same on both platforms and probably not a bug strictly speaking?

I would expect animation playback to get stopped when rendering starts.

> On further inspection, `BKE_sound_scene_playing()` does return -1 on Windows but on Mac it returns 0. This is because different synchronizer class is used - `DefaultSynchronizer` vs `CoreAudioSynchronizer`. Will make PR to audaspace to fix this. Seems better to fix it there indeed, `G.rendering` seems like a workaround. > That said, opengl render behaves erratically when rendering is started while playback is active, but this is same on both platforms and probably not a bug strictly speaking? I would expect animation playback to get stopped when rendering starts.
Member

-1 signals that there is actually no synchronizer working (that's what the DefaultSynchronizer does). Coreaudio and jack do have proper synchronizer support, so they are supposed to return 0 or 1.

The purpose of the synchronizers is to synchronize with other applications which may start/stop playback or move the playback position (i.e. seek). This is what is done in wm_event_do_handlers, where all three cases (-1, 0 and 1) are handled. As you can see in BKE_sound_sync_scene, G.is_rendering is checked there because there is some issue with playback during rendering. This has to be solved on the Blender side and yeah, G.is_rendering is ugly, but that's what we have at the moment.

-1 signals that there is actually no synchronizer working (that's what the `DefaultSynchronizer` does). Coreaudio and jack do have proper synchronizer support, so they are supposed to return 0 or 1. The purpose of the synchronizers is to synchronize with other applications which may start/stop playback or move the playback position (i.e. seek). This is what is done in `wm_event_do_handlers`, where all three cases (-1, 0 and 1) are handled. As you can see in `BKE_sound_sync_scene`, `G.is_rendering` is checked there because there is some issue with playback during rendering. This has to be solved on the Blender side and yeah, `G.is_rendering` is ugly, but that's what we have at the moment.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-09-06 04:40:52 +02: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
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#107726
No description provided.