0
$\begingroup$

Its possible to render an object with transparency on (to don't see the background) and also to get the mist channel with the transparency applied to? I would like the part marked in blue on the picture to be transparent, but the mist channel take it as white (I imagine that it considers that far away)enter image description here

$\endgroup$

2 Answers 2

2
$\begingroup$

In order to set pixels of the mist transparent where the original render is transparent, you can multiply the alpha pass with the mist pass.

The full steps to achieve this result are:

  1. Enable film transparency (Render Properties > Film > Transparent)
  2. Enable the mist pass (View Layer Properties > Passes > Data > Mist)
  3. Switch to the Compositing workspace or open the compositor and enable Use Nodes
  4. Add a Math node (Add > Converter > Math), set the mode to Multiply and use the Alpha of the render layer and the Mist as inputs. Alternatively this should also work with the Mix node set to Multiply and the factor set to 1. The effect is that the alpha is used to mask the mist. When the alpha is zero the result of the math node is zero as well, thus the result is transparent in exactly the same places as the alpha channel. enter image description here
  5. Use the result from the previous step for further compositing.

Below is a visualization of the intermediate steps of the compositing node tree.

Image pass Image pass

Alpha pass Alpha pass

Mist pass Mist pass

Mist pass multiplied with alpha pass (masked mist pass) Mist multiplied with alpha pass

Image pass mixed with masked mist pass (final result) Image pass mixed with masked mist pass

Compositing nodes Compositing nodes

$\endgroup$
1
  • $\begingroup$ Perfect. Thanks!!! $\endgroup$
    – Artichoke
    May 20, 2021 at 19:28
0
$\begingroup$

Even though I did have a few issues with a white border around my alpha'ed mist pass object, luckily I found a quick workaround I thought I'd share here.

So if you happen to have issues with a white outline on your alpha'ed mist pass a quick solution I discovered was adding an extra math node on the alpha set to Greater Than, this will starting eating your border without eating your mist when working close to a value of 1.0 (as in my case 0.999 did the trick)

Mist on alpha white border workaround

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .