Anchors and masking
Masks are always anchored to the coordinates of the used tracking system. They can use various different anchors.
This document goes over what anchors are and how masks are attached to them.
Table of Contents
Anchors
Anchor is the origin that the mask uses for tracking its location. This applies to both position and rotation.
Varjo marker
Varjo Marker allows tracking of a printed marker with mixed reality cameras, and they work with any headset tracking system. By default, markers are configured for tracking static positions. This works well for masks that do not move around, such as cockpits. For objects that require movement, prediction can be enabled for the markers. If you need to track something that can be picked up and moved in the real world, the prediction needs to be enabled. Enabling prediction will lessen the tracking accuracy of the markers. Use default static markers whenever it is possible.
Varjo markers are our primary suggestion for locking in masks that do not need to move around and the user is seated.
SteamVR tracker
SteamVR trackers are exclusive to SteamVR tracking. They can be tracked in real-time within the SteamVR tracking space. Their accuracy is the same whether they are in place or moving.
SteamVR trackers are our primary suggestion when masks require fast movement or when the user is standing and walking around.
Controller
Controllers can be used as anchors. However, as that is not their primary function, you may encounter limitations on how they perform in this use case. Both their shape and tracking are optimized for being held in hand.
Using controllers as anchors is not recommended.
World origin
World origin is the zero point of the world that is assigned when you setup your tracking system. If you add a mask to the world without anchoring it to anything, world origin is the anchor.
Inside-out tracking
When inside-out tracking is in use, the origin is defined when you set up your tracking environment.
SteamVR tracking When SteamVR tracking is in use, the origin is defined in SteamVR room setup.
Other tracking systems
Other tracking systems will have their own ways of defining the origin. Please consult the manufacturer of your tracking system or plugin.
Origin override
With any tracking system, you can override the current origin directly from Varjo Base.
The override will set the origin to wherever the headset is at the moment.
Attaching a mask to an anchor
Varjo supports two types of masking. Basic alpha mask that blends application alpha with underlying application or video pass-through and blend control mask that punches the mask through other application. You can read more about different cases here: Understanding advanced multi-app cases.
In this example, we are masking a cockpit with a Varjo marker. You can apply the same logic to any anchor or use case.
1. Setting up the enviroment
First attach an anchor to the object you want to mask. Place the anchor in a way that it can be tracked well.
You can see two markers in this example image, one medium marker next to the instruments and one large marker next to the joystick. Of the two, the medium marker is in a better position for Varjo marker tracking.
2. Creating the mask
Create the mask geometry in a 3D program. The origin of the 3D model needs to match the anchor location in the real world.
In this case, the origin is next to the joystick.
3. Anchoring and using the mask
Bring the mask geometry to your program and attach it to the marker.
Here is an example shown in Unity where the mask geometry is parented to a marker. The origin of the mask is where the marker is. The same concepts apply to any rendering engine.
When taken into use, the mask should be rendered in a way that it results the desired masking effect. In Unity, for example, you need to apply a specific material for alpha masks that forces transparency to all pixels within the mask.
When the application is run with the mask, you can see the real world in the masked region and virtual content elsewhere.
Lab Tools
Varjo Lab Tools can be used to create masks and assign them anchors. This way you can mask out programs that do not support masking natively and you do not have source code access to.