Holdouts and Cryptomattes Leaves Thin Transparent Edge

Hi everyone,

I’m working on a project where I render out separate elements in Blender to composite the final shot in After Effects. However, I’ve run into an issue when using the Holdout feature to create an alpha for my smoke object (see attached image).


Screenshot 2025-03-10 130159

The problem is that the holdout leaves a thin transparent outline (1-2 pixels wide) around the edges. Checking the Premultiplied option on my Alpha Over node doesn’t fix the issue—in fact, it makes the result look different from the regular render where no compositing is applied.

I’ve also noticed a similar issue with Cryptomatte, where objects leave a small transparent gap around their borders. This isn’t limited to smoke; I’ve seen it happen with other elements as well.

Has anyone else run into this issue? Any help would be greatly appreciated!

blender file
holdout test.blend (1.3 MB)

Hi, try increasing the roughness on the sphere to max i think it’s the results of the reflection.

Its not a material issue. There is a bit of transparency around the edges of the holdout that is causing the outline.

Yes, it’s an unfortunate consequence of the way holdouts work. Let’s step through the math in an example:

In this image, rendered all together, a pixel on this soft edge where Suzanne overlaps the sphere is 50% Suzanne, 50% sphere: half gray, half red, solid alpha. All good, as expected.

Now, let’s render with holdouts. In the sphere render, this pixel is now half sphere, half holdout: 50% red, 50% transparent.

In the Suzanne render, the same pixel is half Suzanne, half background (aka holdout): 50% gray, 50% transparent.

Now let’s look at what happens as we layer these up. We put the sphere over the background, and since this pixel is half-transparent, we get a 50-50 mix of the sphere color and the BG color: 50% cyan, 50% red.

Now we add Suzanne, and since this pixel is half-transparent, we get a 50-50 mix of Suzanne’s color and what’s behind her: 50% gray, 50% [mix of red and cyan].

One way to look at the problem is that the two elements are both holding each other out: even though the sphere isn’t actually eating away at Suzanne, the way we think of a holdout, there’s an alpha hole in the Suzanne layer in the shape of the sphere (and everywhere else too, but along that edge it’s the same difference), and there’s an alpha hole in the sphere layer in the shape of Suzanne. The semitransparency is being accounted for in two places, so it’s doubling up.

One thing you can do is add the two elements (and their alphas) together before layering them over the background: since they’ve both been reduced by the amount of the other, adding takes them back to full strength (minus imprecision from sampling noise: you can see a tiny bit of cyan peeking through in spots since the summed alpha only came to 0.97-whatever in those areas).

This works fine with solid objects, although I don’t think it’d work in your case, since it assumes both sides are holding each other out, and I assume your sphere render isn’t held out by the volume.

One thing that might work for you here is a disjoint-over: an over operation with a couple extra steps meant for double-holdout scenarios like this. The formula is

A+B(1-a)/b, A+B if a+b<1, where
A: the channels of the FG input
B: the channels of the BG input
a: the FG’s alpha
b: the BG’s alpha

which can be done in any program, since it’s just basic math operations.

In Blender, it would look like this if the Mix Color node operated on alpha,

but since it (frustratingly) doesn’t, it looks like this, which is just the same thing but manually per-channel. If anyone has a better way, I welcome it!

Regular over:


Disjoint-over:

4 Likes

And the Cryptomatte problem is another shade of the same issue: the Cryptomatte value for the sphere in that same pixel would be 0.5—since the pixel is half sphere—which means any adjustments you do using the matte will be applied at half strength. Imagine you want to desaturate the sphere. If you did it in the 3D scene, the sphere portion of that pixel would become gray, then it would be blended with the gray Suzanne, resulting in a fully gray pixel. However, if you do it with Cryptomatte, you’ll get 50% desaturation applied to a 50% gray, 50% red pixel, resulting in a less saturated, but still faintly red pixel.

2 Likes

Can you share a Blender file with that node group? I’d love to add it to my asset library :slight_smile:

Sure—it’s not cleaned up at all, still just that spaghetti from the screenshot, but if it might be useful!

disjoint-over.blend (1.5 MB)

It feels like there must be a more streamlined way to do it, but I’m aware we’re dealing with Blender’s compositor here…

3 Likes

Wow, thanks for such a detailed reply! I had a feeling this issue wouldn’t have a simple fix.

I tried implementing your node setup in my scene, but I’m running into an issue—my output is coming out blank. When I connect the holdout layer to the Alpha Over node, it does combine the two render layers, but the result looks noticeably different from when they’re simply rendered together.

Do you know what might be causing this? Here’s the Blend file for reference.

holdout test.blend (1.3 MB)


You plugged into the wrong input :
image

@carterbk thanks a lot for that detailed explanation ! even if I kinda know the issue this makes it 100% clear now !

When I plug it into the other socket I get a preview, but it wasn’t looking quite the same. Although I simply plugged the output directly to the viewer/compositor nodes and it seemed to have worked.

1 Like

Hum, Keep in mind that nodes sockets order in blender works top to bottom , where in many other apps like PS it’s bottom to top.
What you did before was to alpha over a white layer on top of your comp, and it’s likely that you want the comp to be on top of a white layer.

Why it doesn’t look like what you want is another question :slight_smile:

1 Like

This node setup seems to work well for compositing directly in Blender, but it doesn’t seem to be suited for rendering separate layers for compositing in another program like After Effects. Is there a way to adapt this method for external compositing, or would a different approach be necessary?

@carterbk

Yes, it’s a compositing operation—an alternative to the standard “over”—so it’s meant to be used during the composite.

Like I mentioned before, the formula is A+B if a+b<1, else A+B(1-a)/b, which is just math, so even if the program you’re in doesn’t have it as an inbuilt blend mode, you can assemble it yourself.

Now, that’s easy enough in a nodal compositor like Fusion or Blender, but yes, it’d probably be frustrating trying to do that in a layer-based program like After Effects: while I’m sure it’s possible, you’ll be fighting AE’s alpha handing the whole way and it’ll probably require a rather silly number of nested precomps.