Render objects on transparent background with mist pass (Cycles): unwanted fringe

I have a scene with an array of cubes. I am using Cycles to render.

I want to use the Mist effect to make the cubes in the distance fade away.

I want to render this array with a transparent background.

When I combine the Mist output (from RenderLayer node) with my render, I see a fringe. The edges in the alpha channel and the edges in the Mist pass don’t quite line up (I am guessing). It looks like the Mist pass has edges that go out farther than the edges in the alpha channel.

What are some good ways to have my mist, yet have transparent background? I tried figuring it out on my own, but I’m not getting anywhere.

I don’t think it’ll help to attach my blend file, because my own ideas for compositing the mist with the alpha-channeled render aren’t working, and I’m flailing about here. I meant to try using the alpha channel to mask the Mist pass, but I don’t think I figured that out.

Try applying the mist effect after you put your backplate in, or multiply/mask the mist pass with your alpha channel. Either should work, I think.

Thanks, J, I’ll try these! :slight_smile:

OH, I just realized: I was trying to multiply/mask the miss past with my alpha, but my attempts totally failed. I don’t have a feel for the Set Alpha or Alpha Over nodes.

If you see an example explained somewhere, folks, please just point me to it. I’m not a Node Ranger, more like a Node Toad.