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$
1
$\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 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.