ID Masks, Cryptomatte, and Volume Shaders

For what it might be worth … I’m creating an Earth. The largest and outermost sphere is the atmosphere. It occludes the clouds and surface so those can’t have an ID, and they’re too small anyway. The atmosphere has only a volume scatter shader going to the volume. There is no surface on the material. For this reason cryptomatte doesn’t see it either. Essentially it can’t be defined as a mask. I tried adding a transparent shader as the surface. Transparent or not, it turned the entire planet black. Of course with no surface none of the ID mask stuff worked either. I was stuck … until I found a workaround.

You have to have compositing active for this to work (use nodes checked) but if you didn’t you wouldn’t need masks anyway. I made a duplicate of the atmosphere and created a new layer containing only that duplicate, to which I assigned a transparent shader to the surface and no volume. Then I rendered away, and simply ignored the “atmosphere mask” layer in the compositor. The null layer containing its duplicate atmosphere still shows up through the cryptomatte node so now I have my mask and all is well from there.

I spent many thousands of years searching for a solution to this problem and nothing was found online. Hopefully this will help somebody at some point in the future.

1 Like

Could show some images illustrating this method?