Download

Transparent background on iOS

I’m trying to get a transparent background in Unreal Engine scene, so I can place another UIView behind UE4 view. I have achieved this by setting:

  1. clearColor on MTLRenderPassColorAttachmentDescriptor to f.e. MTLClearColorMake(0.0, 0, 0, 1.0)
  2. opaque on CAMetalLayer to false

but the background UIView blends with the UE4 view’s foreground: table, chairs, and floor as if the UE4 view itself was translucent: screenshot with bleed-through.

Expected scene, hacked by creating a black&transparent frame of unreal view.

I’m pretty new to Metal, so I cannot fully grasp where I could disable translucency computation in the code.

Also, is there an easy way to generate black&transparent masks at runtime?