Combining two layers in the compositor

Question

I have a render with two different layers, one with an object, another with a reflection. I then combine the two layers in the compositor, like so.

itor-reflection1.jpg

The reflection appears just fine in the compositor, as you can see. But when I try to save the image as a PNG, there is no reflection, only the object (see image below). What am I doing wrong?

itor-reflection2.jpg

1 love
Reply
  • Martin Bergwerf replied
    Solution

    Hi Christian,

    Try using an Alpha Over Node instead of the Mix Node.

    (I don't know what is happening exactly, but by using the Mix, you get Alpha Values between 0 and 1.

    Maybe the PNG only uses 1 Bit for the Alpha (compression? I don't know) and thus a 0.5 Alpha of the ring gets rounded up to a 1 and a 0.4999 of the reflections gets rounded down to 0...something like that?)

    2 loves
  • Omar Domenech replied

    Maybe when you are saving the image, you are saving it straight from the raw render result and not the viewer node?

    Render-Result.png

  • mightpossibly replied

    Omar thanks for the suggestion - I'm afraid I tried both. You're definitely on to something, spikeyxxx. With the Alpha Over node, I get the reflection in my PNG. Problem is I also get 50% black/transparent background, from the glossy indirect-layer:

    compoisite3.jpg

    I was however able to make the black background transparent by using a Luminance Key node. Not sure if this was the most elegant solution, but I think I got the job done.composite4.jpg

  • Martin Bergwerf replied

    Cool!

    Yeah, the Alpha Over Node usually takes one Image without Alpha and one with...and you have two with a Transparent background.

    I had someone on Discord with a similar problem, just a few days ago. That's why I suggested not to use a Mix Node.

    My pseudo explanation is probably quite wrong, but Saving an Image with half transparency apparently can cause problems, with parts becoming completely transparent and others completely opaque...

    1 love
  • mightpossibly replied

    Here's the result when the render is combined with the photo in Photoshop and the grass parts masked out. Especially the edges don't look so good. But even if the result isn't perfect, I definitely learned something here

    compositor5.jpg

    I'm getting a feeling I'm going about this the wrong way though. My initial thought was to look for a tick for "Reflection catcher" similar to the Shadow Catcher property. But that obviously doesn't exist.

    The goal is to insert the object + its water reflection into my photo. For that I need to make the reflective plane only reflect the object and not the environment texture. Any ideas welcome, but regardless thanks a bunch for the responses so far. 

    compositor6.jpg

  • Martin Bergwerf replied

    You could disable the Glossy in the Ray Visibility of the World, but that also removes it from the Object and it's reflection. The Plane would be black with a reflection, so you can simply Add it to a photo:

    Reflection.png

    And other Lights will still reflect...

    A better result could be made, when using Blender 4.0, which has Light Linking.