Skip to main content

Configuring Per-Camera Visibility

When your 3D scene is being rendered from multiple cameras, the need sometimes arises to display some elements to only one type of camera and not others. MixCast offers a number of methods to ensure that only the desired objects end up being seen by the VR user and MixCast cameras.

Layer Culling Mask

A method of filtering visibility of objects that most developers are familiar with is using the Culling Mask field on a Camera component to exclude objects on certain layers from rendering. By default, MixCast cameras are set to copy the Culling Mask from the Main Camera (the headset view), but if you need finer control over the mask, here’s how to configure it.

Instructions
  1. Override the Layer Cam Prefab as described on this page
  2. Uncheck the Culling Mask field on the SetCameraParametersFromMainCamera component from the previous instructions.
  3. Set the Culling Mask field on the Camera component to whichever layers you want rendered to the MixCast camera’s view.

Per-Renderer Masking

The other main method of displaying or hiding objects from the MixCast camera is by using scripts provided in the SDK such as SetRenderersVisibleForMixCast and SetCanvasVisibleForMixCast. These components handle ensuring that the specified Renderer components (MeshRenderer, ParticleRenderer, etc) or Canvas components are only drawn for specific cameras.

Instructions
  1. Add a SetRenderersVisibleForMixCast or SetCanvasVisibleForMixCast component to the GameObject you want to hide.
  2. Configure the Show For Regular Cameras and Show For MixCast Cameras fields to determine which cameras this GameObject should be shown to.
    • (Optional) If you want to only show this object to specific types of MixCast Cameras, you would enable Show For MixCast Cameras, change MixCast Camera Mode to If Any Condition Met or If All Conditions Met, and then customize the conditions which determine the object’s visibility.
  3. (Optional) For the SetRenderersVisibleForMixCast script, you can manually specify the Renderer components to control by adding them to the Targets list. When first added, and also if this list is empty, it will be filled in OnEnable with all the Renderer components in the GameObject or its children.
Additional Notes

VR Controllers: Since the user in mixed reality footage is already displayed holding their controllers with their real camera, the virtual controller models are at best redundant, at worst distracting. To rectify this issue, you should employ the visibility techniques mentioned above to exclude the virtual controller models from rendering. If you’re using the SteamVR-provided SteamVR_RenderModel component to render your user’s controllers, MixCast provides the more tailored component SetRenderingControllerForMixCast to be attached to the same GameObject as the aforementioned script, otherwise the existing SetRenderingForMixCast component should work.

Tilt Five Wand(s): Unlike in VR, Tilt Five wands are often obscured by the virtual content when held over the board. To increase readability, MixCast provides an optional prefab that additionally renders the Tilt Five wands to the MixCast cameras, but not to the user’s glasses. You can find the prefab at MixCast/Extras/Prefabs/MixCast – TiltFive – Wands; just add this prefab to the first scene of your project to enable this functionality.

Suggest Edit