Is this a bug? weird noise in the mist pass (also on ZDepth pass)

HI there.

I’m wondering why are we getting this weird results, I’m not sure if it’s a bug or something we did to our shaders, in general our shaders are principled shader, in some cases we have a transparen shader for masking, or a translucen shader for thin translucency.

IF(!) what is happening is what I think it is:
Transparent shader for depth can effectively cause samples to be split into visible surface and what’s behind it. For abstract example: 30% transparency may give on average 2 samples of surface depth + 1 sample from behind. Important bit is “on average”. Resulting in high spread of values unless some insane sampling is used, and sometimes even then (with transparency ray termination etc.), which is perceived as noise.
To minimize that try to avoid in-between states of 0 and 100% transparency (notice that objects far away can also be semi-transparent when averaged). And try to render in separate layers when transparency+z is a must.
If you’re ok with just making transparent surfaces opaque in z-channel instead, use shaders that do transmission not transparency.
An ultimate solution, if you have the time, is to create a render layer with custom depth shaders (emission by factor of distance) the way you need, which allows to pull z-channel even out of somewhat opaque volumetrics. This way you also get your z antialiased and faster re-renders when you only need to redo z.

Thanks, that must be the problem.

The bad thing is that it’s impossible to render objects with transparent shader and objects without it in different layers, it’s a pretty complex scene with several million polygons (like SEVERAL hehe) and several thoushands of objects, completely impossible.

Maybe the custom pass with a material override could work up to some extend, but this is problematic, Z or Mist should work even with transparency, it works in other engines, otherwise the Z depth is completely unusable, and the same goes for the mist pass.

Hi there,
Here is a workaround for this noise effect when trying to use a mist pass with transparent objects in Cycles. Here is the shader node corresponding to this formula, :
mist(z) = pow( (z-d)/D, falloff )
For inverse quadratic, falloff is 0.5, it should be 1 for linear and 2 for quadratic

Mist pass from node material (top) vs Mist pass in Cycles (bottom) :

1 Like