Scene strip with Alpha over not working as expected
Closed, ResolvedPublic

Description

System Information
Windows 10 x64
I7-6700HQ
GTX960M



Blender Version

Broken: 2.78 BuildBot(3ceb68c) 2017-03-18
Worked: 2.78c Official (e92f235283)

Short description of error

Blending scene strip with alpha over blend type, works ok in opengl preview but the blending in not applied when the image is rendered.
Alpha is set to transparent in render properties

Left Buildbot----------Right Official 2.78c


Exact steps for others to reproduce the error

Just open the blend file and render image or tick/untick "Opengl preview" in the VSE "Scene Preview/Render/OpenGL Preview" and "Refresh Sequencer"
Zip contents:

1 Blend file
1 Png image

Oscar (KINjO) updated the task description. (Show Details)

@Oscar: The same behaviour under OS X 10.11 too in mentioned blender versions.

But I dont see relation or I don't think i mentioned this issue in T51001. Your issue is related to strip alpha in OpenGL preview (version 2.78c as working). My issue is metastrip opacity in final Render (version 2.78c as not working).

@Oscar: The same behaviour under OS X 10.11 too in mentioned blender versions.

But I dont see relation or I don't think i mentioned this issue in T51001. Your issue is related to strip alpha in OpenGL preview (version 2.78c as working). My issue is metastrip opacity in final Render (version 2.78c as not working).

Yes, you are right, sorry i misread your bug report.

Aaron Carlisle (Blendify) triaged this task as Normal priority.Apr 16 2017, 8:12 PM

Indeed something seems weird here. @Olly Funkster (Funkster) can you take a look?

There's something pretty odd going on here. Firstly, I wound my source back to the commit that was tagged as 2.78c, and it still exhibits the problem. Secondly, the problem is nothing to do with the operation of "alpha over", but instead to do with the render result display.

If you render to an image editor window rather than just unticking OpenGL Preview, you should notice that the combo box for choosing the render layer is missing in the problematic build - in the working 2.78c it will appear between the Slot and Pass combo boxes, and will be set to "Composite".

In the broken builds, the box is missing because the scene being rendered has no layers in its renderresult->layers linked list. What you end up seeing is just the default "RenderLayer" layer from the source scene, which is why it seems like the alpha is broken. If you put some more VSE layers on top of the 3D scene, you still just get the 3D scene in the render output.

I'm now digging in the render pipeline to try to figure out where it's going wrong. Why it's build-environment dependent, I have no idea!

Hello Funkster! I made another quick test and in my test the combo box appears in both Blender versions. See the attached image, many thanks for looking into this.

Ah okay, thanks for the extra info. If you add another sequence strip (anything will do, color strip maybe?) on top of the scene strip, what ends up being displayed?

Hi,color strip added on top, the color strip is rendered.

Whoops, sorry - I mis-spoke before. I had added a text strip, forgetting that those default to "alpha over". Seems it doesn't matter where they are in the layer stack, if you have any other strips that are supposed to combine with the scene render (Add, Subtract, Multiply, Alpha over / under, Over Drop blend modes) then you either get nothing, or the 3D scene render, as your output (which thus doesn't match the OpenGL preview).

Seems I do get the "Composite" combo box in the buildbot builds, just not in my own builds. Not sure now whether I'm definitely looking in the right place due to the discrepancy between official builds and my own - I'll keep digging.

Okay, probably best to ignore pretty much everything I said above. I think I had my git in a mess (this seems to happen to me quite often now I come to think of it...) resulting in my jumping back to 2.78c still having the issue.

The problem stems from the fact that the rendered scene is in floating point, and the rest of the sequencer data is in 8-bit int. There's a thing that's there to convert the other channels into float and then do all operations from that point on in floating point, but if the colour spaces of the scene and the sequencer are identical (which I think they always are out of the box) then it doesn't bother with the conversion to float, so you just get empty data.

The problem is in colormanagement.c - IMB_colormanagement_transform_from_byte_threaded():

if (STREQ(from_colorspace, to_colorspace)) {
    /* If source and destination color spaces are identical, skip
     * threading overhead and simply do nothing
     */
    return;
}

This doesn't make sense, because even if the colour spaces are identical it still needs to translate from byte to float.

This change came in rBce629c5d ... @Sergey Sharybin (sergey) what would you think of getting rid of this test? I tried it quickly and it fixes the issue.

@Olly Funkster (Funkster), that check can not be avoided without performance drop. What we can do is to run much simpler byte-to-float conversion (IMB_buffer_float_from_byte) for such cases, which will still be faster that starting all the threading and creating pixel processors.

@Sergey Sharybin (sergey) sorry for the diff spam, uploaded it as you were typing. Sounds much better to use the simple conversion!