Scene Capture 2D with custom depth as mask

Is it possible to use custom depth as a mask when capturing a scene with SceneCapture2D? So only meshes that use custom depth would be captured, with transparent background. Something like “Use custom depth as mask” in High Resolution Screenshot window. I can’t see any option like that in SceneCapture2D, so maybe it would be doable with some help of blendable post process?

there is no option like this but you can do it by some kind of compositing in a postprocess material.

  • your render target
  • scenetexture:custom depth (black & white - actor rendered to custom depth should be black- multiply scenetexture:custon depth by something like 0.0001).
  • a vectorparameter, simple rgb color, black.

Then use custom depth render as a mask:

  • to display parts of the render target where custom depth render is black
  • to display a black background when custom depth is white.
    So you can isolate the actors you want.
    Background won’t be transparent but you can then further add the background you want, using this same kind of compositing stuff in the same PPmaterial.

Hope it helps.

Thank you! I’ll dig into this.