Search code examples
unity-game-enginehololens

Rendering camera output to a Render Texture and displaying with a clear background


I have a hololens app made in unity using the URP. I added a second camera of render type base and set the output texture to a custom render texture. I set the camera background type as uninitialized. I created a material and set the render texture as the surface input base map. I then created a plane, dragged the material onto it, and positioned it in the field of view of the main camera. I added a cube in the field of view of the second camera. I followed this link to do this... Rendering to a Render Texture

The result is I see the plane and the output of the second camera (cube) in the main camera, which is what I want. But I see the entire plane as well as a black background. Is there a way that I can make the plane appear transparent so only the cube is displayed?

Camera

Render Texture

Material

Plane with render texture

Main camera with cube and black background


Solution

  • Your plane's material is set to Surface Type -> Opaque.

    Changing that to

    • Surface Type -> Transparent
    • Blending Mode -> Alpha

    should solve your issue.

    enter image description here