Make ZED occlusion affect the alpha channel in Unreal’s render output

Hey everyone!

I’m using the ZED plugin in Unreal Engine to composite virtual objects into a live camera scene. I’d like to generate an image where the virtual objects are properly masked based on their occlusion (I’ve included images showing my current result and the desired outcome).

Right now, if I deselect “Show ZED Image” on the BP_ZED_Initializer—so the camera feed isn’t visible—I lose all occlusion effects.

Has anyone run into this before or know how I can achieve the proper occlusion masking? :smile:

Thanks in advance for any help!
/Emile

1 Like

I don’t know if that’s the easiest solution but you can create a custom material to compute this mask.
You can take our material as ref (you can find it in Plugins/Stereolabs/Content/ZED/Materials/Mono/M_ZED_Mono.uasset

Thanks! I’ll take a look at that one. I ended up getting it working using custom depth layers but your way seems more efficient :smile: