Page MenuHome

[WIP] Show Background Image Beneath Transparent Objects
Needs ReviewPublic

Authored by Jeroen Bakker (jbakker) on Aug 8 2019, 12:53 PM.
This revision needs review, but there are no reviewers specified.

Details

Summary

Camera background images were not shown beneath transparent objects.
This patch performs an alpha under for background images for cycles.

In order to see the difference the Film transparency needs to be turned on.

Note that workbench and EEVEE still needs to be adapted as they don't
write the alpha value in the framebuffer.

This image shows the old behavior (left) vs the new behavior (right)

Diff Detail

Repository
rB Blender
Branch
T65988 (branched from master)
Build Status
Buildable 4335
Build 4335: arc lint + arc unit

Event Timeline

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Aug 8 2019, 12:58 PM
Jeroen Bakker (jbakker) planned changes to this revision.Aug 8 2019, 1:38 PM
  • alpha channel of source image is ignored. Add a shader that does premultiply the colors with the alpha

Use Alpha premul for camera images

Jeroen Bakker (jbakker) retitled this revision from Show Background Image Beneath Transparent Objects to [WIP] Show Background Image Beneath Transparent Objects.Aug 8 2019, 2:05 PM
Jeroen Bakker (jbakker) planned changes to this revision.Aug 9 2019, 10:22 AM

Move the drawing of the checkerboard to object_mode.

Postpone rendering of checkerboard for better compositing

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Aug 9 2019, 11:32 AM

Removed unused code

@Jeroen Bakker (jbakker) what is the current status of this patch? Trying to see if it may fit in 2.81 (it seems a bit late for that though to be honest).

Part of the issues has been resolved inside as in it works better than it currently does. It works with cycles, but only with a single background image. EEVEE and Workbench still needs to be adapted as they do not support alpha film in the viewport. Supporting multiple background is a OIT question. The non transparent part needs to be rendered front to back. and the transparent part needs to be rendered back to front for better result. The draw engines are a bit in between and can intervene.

IMO it is solvable to 95% of what we want.

Draw order for alpha under pass