Developing mixed reality applications for XR-3 and XR-1 Developer Edition is quick and easy with the Varjo XR plugin. Follow these instructions to get started.
Once you have set up the Varjo plugin (see Getting Started with the Varjo plugin for Unity) there are a couple of additional steps to complete. The Varjo XR plugin settings can be found in the Project Settings dialog. Under the XR Plug-in Management tab, select Varjo and disable the Opaque option. You can also do this from a script using the provided runtime functions. See Rendering Settings for additional information.
To enable or disable rendering the image from the video pass-through cameras, use the following methods:
// Start rendering the video see-through image VarjoMixedReality.StartRender(); // Stop rendering the video see-through image VarjoMixedReality.StopRender();
When enabled, you will see the image from the video pass-through cameras when your application renders 0 in the color buffer. You can do this either by using a stencil mask or by making the camera clear to 0. For instructions on how to set up a stencil mask, see Masking. To make the camera clear to 0, set the camera’s Clear Flags to Solid Color and set RGBA(0,0,0,0) as the background color.
You can find instructions for High Definition Render Pipeline and Universal Render Pipeline below.
Using mixed reality with High Definition Render Pipeline
When using HDRP, make sure to use a color buffer format with an alpha channel. In the Project Settings dialog, select the Quality tab and under HDRP settings select the HD Render Pipeline Asset. Set the Color Buffer Format dropdown to R16G16B16A16. You will need to do this for all HDRP assets in use.
To make the camera clear to 0, set the camera’s Background Type to Color and set RGBA(0,0,0,0) as the background color.
Using mixed reality with Universal Render Pipeline
When using URP, you will need to modify the camera settings to be able to write into the alpha channel of the color buffer. For video pass-through to work, make sure the camera’s Post Processing and HDR settings are disabled.
To make the camera clear to 0, set the camera’s Background Type to Solid Color and set RGBA(0,0,0,0) as the background color.