Develop
Develop
Select your platform

Passthrough Transitioning Motif

Updated: Sep 4, 2025
The Passthrough Transitioning motif demonstrates the transition from fully immersive VR experiences to passthrough mixed reality experiences using the Passthrough API. In this sample project, you can adjust the visibility of your surroundings by manipulating a slider, which regulates the level of passthrough. Alternatively, you can directly switch from one mode to another with the press of a button.
The project also shows you how to use the Boundary API to disable the guardian while in passthrough mode for a seamless MR experience.

Requirements

Project Setup

  1. Import the Passthrough Transitioning motif assets, including scripts, shaders, prefabs, and materials.
  2. With the XR Camera Rig selected in the Hierarchy, go to the Inspector, and under OVR Manager → Quest Features, set Passthrough Support to Supported, and under OVR Manager → Insight Passthrough & Guardian Boundary, check Enable Passthrough.
  3. Add an OVR Passthrough Layer component, and set its Compositing > Placement to Underlay.
  4. Add the Passthrough Fader prefab to the CenterEyeAnchor.
  5. Reference the OVR Passthrough Layer on the Passthrough Fader component.
  6. Set up a way to call the public TogglePassthrough method of the PassthroughFader class, with either the Controller Buttons Mapper Building Block or the Menu Panel prefab.
To transition between VR and passthrough, place a sphere as a child of the main camera. Use a shader, configured at runtime with a custom fader script, to manipulate the sphere. This enables adjusting fade speed, direction, distance, and effects like dissolving the sphere in a random pattern (Perlin noise). All you need to set this up in your project is the custom PassthroughFader shader from this project and the PassthroughFader class or a similar class to manipulate the shader's properties.

Contextual Passthrough

Contextual passthrough means that passthrough should be enabled based on system recommendations. In other words, if the user is in passthrough mode in their home environment, the operating system can detect this and display the system splash screen and the Unity scene in passthrough. In VR mode, the system splash screen will be shown with a black background like before.
If you have enabled contextual passthrough and still cannot see the effect being applied, try updating your AndroidManifest.xml by navigating to MetaToolsUpdate Android Manifest file in the Unity Editor.
Splash Screen (Black)Splash Screen (Black)
Splash Screen (Passthrough Contextual)Splash Screen (Passthrough Contextual)
Note
Contextual PT for the system splash screen can only be enabled with Unity 6 or a Unity Pro license.

Conditional Passthrough

Passthrough can also be used to switch between MR and VR game modes or to conditionally show parts of the environment, such as when opening menus or changing scenes. This allows players to feel more comfortable and immersed, leading to longer play sessions.
Keep in mind that enabling passthrough is asynchronous. System resources like cameras can take a few hundred milliseconds to be activated, during which time passthrough is not yet rendered and experienced as black flicker. You can avoid this by using the passthroughLayerResumed event, which is emitted once the layer is fully initialized and passthrough is visible. Additionally, you don’t just want to immediately go from passthrough to VR but rather use a shader to smoothly transition between the two.

Passthrough Transitioning Sample Scenes

Both scenes come with a Passthrough Fader prefab, which is located on the CenterEyeAnchor. It contains the PassthroughFader class. The prefab also contains an audio source used to play audio clips whenever you fade in or out.
PassthroughFader UnderlayPassthroughFader Underlay
PassthroughFader SelectivePassthroughFader Selective
The passthrough fader slider scene comes with a PassthroughFaderSlider prefab, which is located on the CenterEyeAnchor. It contains the PassthroughFaderSlider component. The passthrough dissolver scene comes with a PassthroughDissolver prefab, which is located outside the CenterEyeAnchor, so that the dissolution pattern does not move with your head but instead stays anchored in the scene. It contains the PassthroughDissolver class.
PassthroughFaderSliderPassthroughFaderSlider
PassthroughFaderDissolvePassthroughFaderDissolve
The PassthroughDissolver shader is applied to the sphere, and therefore, you need the PerlinNoiseTexture script to generate a texture, which you can easily modify by changing the values in the inspector. If you were to use the PassthroughDissolverSG ShaderGraph shader, you can simply remove the PerlinNoiseTexture component since the texture is already generated within the ShaderGraph. Everything else works the same.

Passthrough Fading Scripts

The PassthroughFader class handles smooth transitions between VR and Passthrough. It includes logic to:
This script supports both Underlay and Selective modes, configurable via the Inspector.
PassthroughFader UnderlayPassthroughFader Underlay Script
PassthroughFader SelectivePassthroughFader Selective Script

Key Properties

  • Fade Speed & Fade Direction – for both modes
  • Selective Distance – limits visible content in selective mode (e.g., tabletop games)
  • Unity Events – triggers for fade in/out start & complete (e.g., audio cue triggers)

Other Scripts

  • PassthroughFaderSlider – enables manual fading via UI slider + optional guardian toggle
  • PassthroughDissolver – uses dissolve level instead of inverted alpha
  • AudioController – adjusts audio volume based on dissolve state
  • PerlinNoiseTexture – generates procedural texture for the PassthroughDissolver shader. Learn more.

Passthrough Transitioning Shaders

Passthrough Transitioning utilizes a custom HLSL shader to smoothly fade between VR and passthrough modes. The main shader used by both the Passthrough Fader and Slider is called PassthroughFader.

Shader Highlights

  • _InvertedAlpha: Inverts alpha transparency to produce fade effects
  • _FadeDirection: Controls direction of fade using UV coordinates
    • 0 – red channel
    • 1 – right to left
    • 2 – top to bottom
    • 3 – center outwards
  • Smooth transitions via smoothstep
Note
On the sphere using the shader, set Cull Off and render queue to Transparent-1 (2999) to avoid z-fighting and ensure proper depth layering behind other materials.

Dissolve Effects

To create stylish dissolves between VR and passthrough, the PassthroughFaderDissolve scene is included. It uses the PassthroughDissolver class to manipulate shader parameters for a patterned transition.
  • PassthroughDissolver: Uses external PerlinNoiseTexture script to generate dissolve patterns
  • PassthroughDissolverSG: ShaderGraph variant with built-in noise pattern, no extra script required

Resources

Did you find this page helpful?