VR Tunnelling Pro
Plug-and-Play VR Comfort
CAGE Modes

These modes replace the colored vignette with a fully 3D cage anchored to the Motion Transform. This is a highly flexible way to give the user a static reference frame instead of just fade out the "real" world.

SKYBOX Mode will often be slightly faster, but the CAGE modes allow easy editing, depth perception and moving objects as desired. The CAGE modes work as follows.

  • CAGE_COLOR draws 3D objects on a plain color background.
  • CAGE_SKYBOX uses a cubemap background.
  • CAGE_OVERLAY draws the cage directly on the VR world, without a background. This allows for a "fake cockpit" effect amongst others.

TIP: VRTP includes starter cage cubemaps in VrTunnellingPro/Prefabs/Skyboxes. By default these import at low res. For full quality, switch to 4096.

To use these modes, set Background Mode to either, and create an empty gameobject parented to the Motion Transform object. Drag this gameobject into the Cage Parent field. Now, any children of this object will be drawn in the vignette.

Note that you MUST use unlit shaders for these objects - no lighting is rendered for cage objects.

Shaders

VRTP includes four unlit shaders for use on cage objects, in the material shader menu under VrTunnellingPro/Cage.

  • Opaque: Opaque textured shader with color and brightness.
  • Transparent: As Opaque but alpha blended.
  • Opaque Fogged: As Opaque but with fog.
  • Transparent Fogged: As Transparent but with fog.

The Fogged shaders use settings from the Tunnelling effect in the Fog Settings section (see below). They do not use Unity's fog, so you can use different settings in the world and in the cage.

TIP: To write custom shaders affected by the cage fog, use VrTunnellingPro/Shaders/CageFog.cginc. Follow the VRTP cage shaders for implementation.

Settings

CAGE_SKYBOX mode settings
CAGE_SKYBOX mode settings. The other modes are identical but
without the Effect Skybox field.
  • Cage Parent: Parent of cage objects.
    • Automatically disabled - not drawn in normal rendering.
  • Cage Settings:
    • Apply Color: If ticked, entire vignette will be tinted by Effect Color.
      • Fog color is always Effect Color.
      • In CAGE_COLOR mode, background color is always Effect Color.
    • Effect Skybox (CAGE_SKYBOX only): The background skybox to use (must be a cubemap).
    • Downsampling: Render the cage at full (0) half (1) or quarter (2) resolution.
    • MSAA: Antialiasing setting for cage rendering.
      • AUTO: Use quality settings for cage MSAA.
      • OFF: Force no MSAA for cage rendering.
      • X2,X4,X8: Force 2, 4 or 8x MSAA for cage rendering.
    • Update Every Frame: If true, check for added/destroyed cage objects every frame.
      • This will create a small amount of garbage every frame.
      • You can move, modify, enable or disable existing cage objects without this!
      • Consider using UpdateCage() manually when adding/removing cage objects to avoid unnecessary GC allocation.
  • Fog Settings: These settings only affect in-built cage fogged shaders or custom ones using CageFog.cginc. Effect Color sets the fog color.
    • Density: Overall density of fog. Affects how quickly fog builds up over distance.
    • Power: Fog falloff. Higher values will build up more abruptly.
    • Strength: Blending. At 0, fog has no effect. At 1, fog has full effect.
  • Iris Z Rejection: Supported by this mode as long as Mask Mode is OFF. See Background Modes for details.

TIP: You can move, modify, enable or disable existing cage objects without turning on Update Every Frame!

Prefabs

The included ComfortCubes and ComfortCubesPolar cage prefabs
The included ComfortCubes and ComfortCubesPolar cage prefabs

VRTP includes some example cage prefabs in VrTunnellingPro/Prefabs/Cages. ComfortCubes and ComfortCubesPolar are grids of cubes in two arrangements to give users a strong static reference. VehicleCage is a simple, long grid useful for cockpit-based games where most motion is in the direction of the vehicle.

CAGE_SKYBOX and CAGE_COLOR modes
Left: CAGE_COLOR mode. Right: CAGE_SKYBOX mode. Both use the ComfortCubes cage prefab.