VSE renders with alpha transparent PNG image incorrectly #52522

Closed
opened 2017-08-24 04:04:32 +02:00 by Satoshi Yamasaki · 8 comments

System Information
Windows 10 Pro x64, GeForce GTX 1060 6GB

Blender Version
Broken: 2.79-7b397cd (RC2), 2.79 RC1
Worked: 2.78c

Short description of error
VSE renders incorrectly between a Scene strip and an Image strip which has a PNG file saved by Gimp with "Save background color" and "Save color values from transparent pixels" options.

Exact steps for others to reproduce the error

  1. In VSE, insert a scene strip in channel 1
  2. Insert an image strip in channel 2 and specify an image file that I mentioned above.
  3. Set "Alpha Over" blend option of the image strip.
  4. (Optional)Enable "Use Backdrop" option of VSE header.
  5. Render with [F12]. You can see VSE doesn't render translucency of the image.

Or, You can download the attached file and test the blend file in it.

Thanks,
279VSEBug.zip

**System Information** Windows 10 Pro x64, GeForce GTX 1060 6GB **Blender Version** Broken: 2.79-7b397cd (RC2), 2.79 RC1 Worked: 2.78c **Short description of error** VSE renders incorrectly between a Scene strip and an Image strip which has a PNG file saved by Gimp with "Save background color" and "Save color values from transparent pixels" options. **Exact steps for others to reproduce the error** 1) In VSE, insert a scene strip in channel 1 2) Insert an image strip in channel 2 and specify an image file that I mentioned above. 3) Set "Alpha Over" blend option of the image strip. 4) (Optional)Enable "Use Backdrop" option of VSE header. 5) Render with [F12]. You can see VSE doesn't render translucency of the image. Or, You can download the attached file and test the blend file in it. Thanks, [279VSEBug.zip](https://archive.blender.org/developer/F723477/279VSEBug.zip)
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @SatoshiYamasaki

Added subscriber: @SatoshiYamasaki

Added subscribers: @Sergey, @mont29

Added subscribers: @Sergey, @mont29
Sergey Sharybin was assigned by Bastien Montagne 2017-08-30 20:06:41 +02:00

The problems comes from render result having a float buffer of pixels, while PNG reading generates a byte buffer.

@Sergey iirc, you did the optimization of freeing byte pixel of a strip's result when it has float values? Not sure how to fix this, something like that sort of does the trick, though color space seems to be wrong, probably not the right fix:

diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 3a04bd79360..5b1f50a8027 100644
    - a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3688,6 +3688,17 @@ static ImBuf *seq_render_strip_stack_apply_effect(const SeqRenderData *context,
  float facf = seq->blend_opacity / 100.0f;
  int swap_input = seq_must_swap_input_in_blend_mode(seq);
 
+       printf("%p, %p  ||  %p, %p\n", ibuf1->rect, ibuf2->rect, ibuf1->rect_float, ibuf2->rect_float);
+
+       if (ibuf1->rect_float != NULL && ibuf2->rect_float == NULL) {
+               IMB_float_from_rect(ibuf2);
+               imb_freerectImBuf(ibuf2);
+       }
+       else if (ibuf2->rect_float != NULL && ibuf1->rect_float == NULL) {
+               IMB_float_from_rect(ibuf1);
+               imb_freerectImBuf(ibuf1);
+       }
+
  if (swap_input) {
          if (sh.multithreaded)
                  out = seq_render_effect_execute_threaded(&sh, context, seq, cfra, facf, facf, ibuf2, ibuf1, NULL);
The problems comes from render result having a float buffer of pixels, while PNG reading generates a byte buffer. @Sergey iirc, you did the optimization of freeing byte pixel of a strip's result when it has float values? Not sure how to fix this, something like that sort of does the trick, though color space seems to be wrong, probably not the right fix: ```lang=diff diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 3a04bd79360..5b1f50a8027 100644 - a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3688,6 +3688,17 @@ static ImBuf *seq_render_strip_stack_apply_effect(const SeqRenderData *context, ``` float facf = seq->blend_opacity / 100.0f; int swap_input = seq_must_swap_input_in_blend_mode(seq); ``` + printf("%p, %p || %p, %p\n", ibuf1->rect, ibuf2->rect, ibuf1->rect_float, ibuf2->rect_float); + + if (ibuf1->rect_float != NULL && ibuf2->rect_float == NULL) { + IMB_float_from_rect(ibuf2); + imb_freerectImBuf(ibuf2); + } + else if (ibuf2->rect_float != NULL && ibuf1->rect_float == NULL) { + IMB_float_from_rect(ibuf1); + imb_freerectImBuf(ibuf1); + } + ``` if (swap_input) { if (sh.multithreaded) out = seq_render_effect_execute_threaded(&sh, context, seq, cfra, facf, facf, ibuf2, ibuf1, NULL); ```

Added subscriber: @ponderz

Added subscriber: @ponderz

This issue was referenced by 71f0c32dad

This issue was referenced by 71f0c32dad840e4967f8e16f67eadcace16e2125

Changed status from 'Open' to: 'Resolved'

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

Thank you guys!

Thank you guys!
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#52522
No description provided.