I recently started playing around with volumetric materials (fog) and now need to mask the volume by opacity to render it differently via post processing.
Although having the mask would already help a lot, I also really need the distance from the camera (depth) for the masked pixels.
​​​​
As far as I'm aware Custom Depth usually would be the way to go here. The problem is though that it seems that additive/volumetric materials seem to not really work with Custom Depth. I enabled the custom depth pass on the static mesh the material is applied to but the object doesn't show up in the custom depth buffer visualisation. Changing the option to include translucent objects in the pass (in the material options) doesn't change this either..
And neither does enabling stencils etc. In the project settings (common fixes for custom depth problems I found through google).

I suspect that additive blendmodes are just excluded from the Custom depth pass right now? On the other hand volumetric materials appear with the correct depth on the screen so they have to appear in the depthbuffer as far as I understand, right?

I don't have too much knowledge on how buffers work in UE4 (and in general) so I'm really unsure on how to go about this from here.

If custom depth is indeed not enabled on additive materials would there be any way to read it out of the depth buffer manually?
I guess that would only work through C++ and though I'm not proficient at all with C++ I would be happy for any advice/direction on whether this is doable and if so how you would go about it.

I haven't found anything on this in the web but if I overlooked something I would be really thankful for a link.

Thanks a lot!