Passthrough
Extension introduces
XR_HTC_passthrough
allows developers to create an application with Passthrough (Underlay for now). Passthrough Underlay is a feature that shows passthrough image under content layer.
Supported Platforms and devices
Platform | Headset | Supported | |
PC | PC Streaming | Focus3/ XR Elite | X |
Pure PC | Vive Cosmos | X | |
Vive Pro series | X | ||
AIO | Focus3/ XR Elite | V |
Enable Plugins
- Edit > Plugins > Search for OpenXR and ViveOpenXR and make sure they are enabled.
- Note that the " SteamVR " and " OculusVR " plugin must be disabled for OpenXR to work.
- Restart the engine for the changes to take effect.
How to use OpenXR Passthrough Unreal Feature
- Please make sure ViveOpenXR is enabled.
- Edit > Project Settings > Plugins > Vive OpenXR > Click Enable Passthrough under Passthrough to enable OpenXR Passthrough extension.
- Restart the engine to apply new settings after clicking Enable Passthrough.
- For the available Passthrough functions, please refer to ViveOpenXRAndroidPassthroughFunctionLibrary.cpp.
-
Passthrough Blueprint functions.
Type Passthrough to get the Passthrough blueprint functions your content needs.
-
Create Passthrough Underlay
Use this function to create a Passthrough Underlay .
The InPassthroughLayerForm parameter specifies the type of Passthrough Underlay to be created.
Planar: a full screen passthrough that covers the entire FOV.
Projected: a passthrough only covers part of the FOV, in which the area is determined by a custom mesh and its transform. -
Destroy Passthrough Underlay
Use this function to destroy any Passthrough Underlay created previously. -
Is Passthrough Enabled
Use this function to check if the Passthrough feature is enabled or not. -
Set Passthrough Alpha
Use this function to set the opacity of the Passthrough Underlay.
The “alpha” parameter specifies the target opacity (Clamped to range [0,1]). -
Set Passthrough Mesh
Use this function to specify the mesh data of the customized mesh for Projected Passthrough Underlay.
“ vertices ” specifies the vertices of the mesh.
“ indices ” specifies the triangle indices of the mesh.
Note: If you derive vertices and indices from GetSectionfromStaticMesh.
Please make sure the setting Allow CPUAccess of the static mesh which In Mesh referenced is enabled . The setting is at Details > Advanced of the static mesh asset.
-
Set Passthrough Mesh Transform
Use this function to set the space type and the transformation of the mesh to be used by Projected Passthrough Underlay.” meshSpaceType ” specifies the XrSpace configuration to be used by Projected Passthrough Underlay, which is defined as follows:
-
Set Passthrough Mesh Transform Location
Use this function to set the scale of the Projected Passthrough Underlay. -
Set Passthrough Mesh Transform Rotation
Use this function to set the orientation of the Projected Passthrough Underlay. -
Set Passthrough Mesh Transform Scale
Use this function to set the scale of the Projected Passthrough Underlay. -
Set Passthrough Mesh Transform Space
Use this function to set the space type to be used by Projected Passthrough Underlay.
Refer to “ vi. ” for details on “meshSpaceType”.
-
-
You can refer to Content > Passthrough > Blueprints > BP_PassthroughTestManager for the use of the blueprint functions above.
-
The last thing to show passthrough underlay is to poke the hole with materials in your map. The following steps will show you how to create the needed assets by hand and use them to poke the hole. You can refer to
Content
>
Passthrough
>
Blueprints
>
BP_PassthroughClearMeshes
and
Content
>
Passthrough
>
Materials
>
ClearAlpha and ClearColor
for further details.
-
Two materials are needed to poke the hole. Right-click on the Content Browser to create two Materials , and name ClearAlpha and ClearColor.
-
Open up the ClearAlpha material. On the left panel Details > Material, change the Material Domain to Surface , Blend Mode to Translucent , Shading Model to Unlit.
Select Write Only Alpha in Details > Translucency.
-
In the Material Graph, right-click Emissive Color and Opacity to Promote them to Parameter . Then set the Emissive Color Param to (0,0,0,1) and set the Opacity Param to (1.0).
Remerber to Apply and Save the Material.
-
Open up the ClearColor Material. On the left side panel Details > Material, change the Material Domain to Surface , Blend Mode to Masked , Shading Model to Unit.
-
In the Material Graph, right-click on Emissive Color to Promote to Parameter .
Then set the Emissive Color Param to (0,0,0,1).
Remember to Apply and Save the Material.
-
Create an Actor blueprint class to combine ClearAlpha and ClearColor effects. Right-click on Content Browser to create a Blueprint Class and select Actor as Pick Parent Class .
Named it BP_PassthroughClearMeshes.
-
Open up the BP_PassthroughClearMeshes, add two static mesh components and name them ClearAlpha and ClearColor on the left-side panel Components .
-
Select Engine/EngineSky/SM_SkySphere as Static mesh in Details for both meshes components ClearAlpha and ClearColor. And select the material ClearAlpha and ClearColor as the Material > Element 0 of the corresponding meshes components ClearAlpha and ClearColor.
-
Place the BP_PassthroughClearMeshes you just created in the Passthrough Map
-
Play the sample map
- Make sure the OpenXR Passthrough extension is enabled, the setting is in Edit > Project Settings > Plugins > Vive OpenXR .
-
The sample map is under Content > Passthrough > Map .
-
Sample map controls.
Right A Press: StartPlanarPassthrough.
Right B Press: StartProjectedPassthrough.
Right Thumb Stick: Move ProjectedPassthrough mesh.
Left Thumb Stick: Rotate ProjectedPassthrough mesh. - Start playing the Passthrough map, press A you will see the PlanarPassthrough , and press B you will see the ProjectedPassthrough, you can also push the left and right controller thumb stick to move and rotate the passthrough mesh.