Rendering settings

Note: you are currently viewing documentation for a beta or an older version of Varjo

The Varjo XR plugin provides a variety of rendering settings to enable the desired functionality.

All settings can be modified in the Unity editor under Project Settings > XR Plug-in Management > Varjo.

Each rendering setting also has runtime functions to set and get the respective values. These functions can be found in the VarjoRendering class.


Stereo Rendering Mode

The stereo rendering mode.

VarjoStereoRenderingMode.Multipass — The scene is rendered in four separate passes: one for each view (left context, right context, left focus, right focus).

VarjoStereoRenderingMode.TwoPass — The scene is rendered in two passes: one two-wide instanced stereo rendering pass for the context displays and another for the focus displays.

VarjoStereoRenderingMode.Stereo — The scene is rendered in one two-wide instanced stereo rendering pass for the context displays. Focus views are not rendered and foveated rendering is disabled.

Default: VarjoStereoRenderingMode.TwoPass

Runtime functions:

// Set Stereo Rendering Mode
VarjoRendering.SetStereoRenderingMode(VarjoStereoRenderingMode value);

// Get Stereo Rendering Mode
VarjoRendering.GetStereoRenderingMode();

Note! If HDRP is used, HDRP single pass setting should be enabled when using two-pass rendering mode.


Separate Cull Pass For Focus Displays

When enabled, Unity will perform an extra culling pass for the focus displays. Otherwise the culling results for the context displays will be reused for the focus displays (the default and recommended setting).

Default: false

Runtime functions:

// Set Separate Cull Pass For Focus Displays
VarjoRendering.SetSeparateCullPass(bool value);

// Get Separate Cull Pass For Focus Displays
VarjoRendering.GetSeparateCullPass();


Foveated Rendering

When enabled, foveated rendering is enabled for the application.

Default: true

Runtime functions:

// Set Foveated Rendering
VarjoRendering.SetFoveatedRendering(bool value);

// Get Foveated Rendering
VarjoRendering.GetFoveatedRendering();


Context Scaling Factor
A scaling factor that can be used to reduce the rendering resolution for the context display surfaces.
Range: 0.1–1.0 Default: 1.0

Runtime functions:

// Set Context Scaling Factor
VarjoRendering.SetContextScalingFactor(float value);

// Get Context Scaling Factor
VarjoRendering.GetContextScalingFactor();


Focus Scaling Factor

A scaling factor that can be used to reduce the rendering resolution for the focus display surfaces.
Range: 0.1–1.0 Default: 1.0

Runtime functions:

// Set Focus Scaling Factor
VarjoRendering.SetFocusScalingFactor(float value);

// Get Focus Scaling Factor
VarjoRendering.GetFocusScalingFactor();


Opaque

Used to tell the Varjo Compositor that the submitted surfaces are meant to be opaque, and that the compositor should not perform any alpha blending against possible background applications when rendering the surfaces.

Default: true

Runtime functions:

// Set Opaque
VarjoRendering.SetOpaque(bool value);

// Get Opaque
VarjoRendering.GetOpaque();


Face-locked

When enabled, the compositor disables warping for the layer. Use only if the camera is face-locked.

Default: false

Runtime functions:

// Set Face-locked
VarjoRendering.SetFaceLocked(bool value);

// Get Face-locked
VarjoRendering.GetFaceLocked();


Flip Y

When enabled, the rendering results are flipped upside down before they are submitted to the compositor. Enable this if your scene appears upside down in the HMD.

Default: false

Runtime functions:

// Set Flip Y
VarjoRendering.SetFlipY(bool value);

// Get Flip Y
VarjoRendering.GetFlipY();


Occlusion Mesh

Use occlusion mesh.

Default: true

Runtime functions:

// Set Occlusion Mesh Enabled
VarjoRendering.SetOcclusionMeshEnabled(bool value);

// Get Occlusion Mesh Enabled
VarjoRendering.GetOcclusionMeshEnabled();


Session Priority

Used when multiple clients are running at the same time. Sessions with higher priority are rendered on top of lower ones.

Default: 0

Runtime functions:

// Set Session Priority
VarjoRendering.SetSessionPriority(int value);

// Get Session Priority
VarjoRendering.GetSessionPriority();


Submit Depth
When enabled, the application will pass depth surfaces to the compositor (alongside color surfaces). This allows the compositor to use Positional TimeWarp to improve rendering quality.

Default: true

Runtime functions:

// Set Submit Depth
VarjoRendering.SetSubmitDepth(bool value);

// Get Submit Depth
VarjoRendering.GetSubmitDepth();


Depth Sorting

Used to tell the Varjo Compositor that the application wants its contents to participate in per-pixel depth sorting. With depth sorting, if other applications (or the video pass-through view in XR headsets) have pixels closer to the camera than this application, those pixels are displayed instead of pixels from this application. When this option is in use, Submit Depth should be enabled as well.

Default: false

Runtime functions:

// Set Depth Sorting
VarjoRendering.SetDepthSorting(bool value);

// Get Depth Sorting
VarjoRendering.GetDepthSorting();


Depth Test Range

Enable the depth test range. Use Depth Test Near Z and Depth Test Far Z to control the range for which the depth test is evaluated.

Default: false

Runtime functions:

// Set Depth Test Range Enabled
VarjoRendering.SetDepthTestRangeEnabled(bool value);

// Get Depth Test Range Enabled
VarjoRendering.GetDepthTestRangeEnabled();


Depth Test Near Z

The minimum depth included in the depth test range (in meters).
Range: 0.0–50.0 Default: 0.0

Runtime functions:

// Set Depth Test Near Z
VarjoRendering.SetDepthTestNearZ(float value);

// Get Depth Test Near Z
VarjoRendering.GetDepthTestNearZ();


Depth Test Far Z

The maximum depth included in the depth test range (in meters).

Range: 0.0–50.0 Default: 1.0

Runtime functions:

// Set Depth Test Far Z
VarjoRendering.SetDepthTestFarZ(float value);

// Get Depth Test Far Z
VarjoRendering.GetDepthTestFarZ();