Add OVROverlay script to an object with an optional mesh primitive rendered as a TimeWarp overlay instead by drawing it into the eye buffer. This will take full advantage of the display resolution and avoid double resampling of the texture. More...

Inheritance diagram for OVROverlay:

Public Types

enum  OverlayShape {
  OverlayShape.Quad = OVRPlugin.OverlayShape.Quad, OverlayShape.Cylinder = OVRPlugin.OverlayShape.Cylinder, OverlayShape.Cubemap = OVRPlugin.OverlayShape.Cubemap, OverlayShape.OffcenterCubemap = OVRPlugin.OverlayShape.OffcenterCubemap,
  OverlayShape.Equirect = OVRPlugin.OverlayShape.Equirect, OverlayShape.ReconstructionPassthrough = OVRPlugin.OverlayShape.ReconstructionPassthrough, OverlayShape.SurfaceProjectedPassthrough = OVRPlugin.OverlayShape.SurfaceProjectedPassthrough, OverlayShape.Fisheye = OVRPlugin.OverlayShape.Fisheye
}
 Determines the on-screen appearance of a layer. More...
 
enum  OverlayType { OverlayType.None, OverlayType.Underlay, OverlayType.Overlay }
 Whether the layer appears behind or infront of other content in the scene. More...
 

Public Member Functions

delegate void ExternalSurfaceObjectCreated ()
 
void OverrideOverlayTextureInfo (Texture srcTexture, IntPtr nativePtr, UnityEngine.XR.XRNode node)
 Use this function to set texture and texNativePtr when app is running GetNativeTexturePtr is a slow behavior, the value should be pre-cached More...
 
void SetSrcDestRects (Rect srcLeft, Rect srcRight, Rect destLeft, Rect destRight)
 Sets the source and dest rects for both eyes. Source explains what portion of the source texture is used, and dest is what portion of the destination texture is rendered into. More...
 
void UpdateTextureRectMatrix ()
 
void SetPerLayerColorScaleAndOffset (Vector4 scale, Vector4 offset)
 

Static Public Member Functions

static bool IsPassthroughShape (OverlayShape shape)
 

Public Attributes

OverlayType currentOverlayType = OverlayType.Overlay
 Specify overlay's type More...
 
bool isDynamic = false
 If true, the texture's content is copied to the compositor each frame. More...
 
bool isProtectedContent = false
 If true, the layer would be used to present protected content (e.g. HDCP). The flag is effective only on PC. More...
 
Rect srcRectLeft = new Rect()
 
Rect srcRectRight = new Rect()
 
Rect destRectLeft = new Rect()
 
Rect destRectRight = new Rect()
 
bool invertTextureRects = false
 
bool overrideTextureRectMatrix = false
 
bool overridePerLayerColorScaleAndOffset = false
 
Vector4 colorScale = Vector4.one
 
Vector4 colorOffset = Vector4.zero
 
bool useExpensiveSuperSample = false
 
bool hidden = false
 
bool isExternalSurface = false
 If true, the layer will be created as an external surface. externalSurfaceObject contains the Surface object. It's effective only on Android. More...
 
int externalSurfaceWidth = 0
 The width which will be used to create the external surface. It's effective only on Android. More...
 
int externalSurfaceHeight = 0
 The height which will be used to create the external surface. It's effective only on Android. More...
 
int compositionDepth = 0
 The compositionDepth defines the order of the OVROverlays in composition. The overlay/underlay with smaller compositionDepth would be composited in the front of the overlay/underlay with larger compositionDepth. More...
 
bool noDepthBufferTesting = true
 The noDepthBufferTesting will stop layer's depth buffer compositing even if the engine has "Depth buffer sharing" enabled on Rift. More...
 
OVRPlugin.EyeTextureFormat layerTextureFormat = OVRPlugin.EyeTextureFormat.R8G8B8A8_sRGB
 
OverlayShape currentOverlayShape = OverlayShape.Quad
 Specify overlay's shape More...
 
Texture [] textures = new Texture[] { null, null }
 The left- and right-eye Textures to show in the layer. More...
 
bool isAlphaPremultiplied = false
 
System.IntPtr externalSurfaceObject
 The Surface object (Android only). More...
 
ExternalSurfaceObjectCreated externalSurfaceObjectCreated
 Will be triggered after externalSurfaceTextueObject get created. More...
 

Static Public Attributes

static OVROverlay [] instances = new OVROverlay[maxInstances]
 

Protected Attributes

IntPtr [] texturePtrs = new IntPtr[] { IntPtr.Zero, IntPtr.Zero }
 
bool isOverridePending
 

Properties

bool previewInEditor [get, set]
 Preview the overlay in the editor using a mesh renderer. More...
 
int layerId [get]
 
static string OpenVROverlayKey [get]
 

Detailed Description

Add OVROverlay script to an object with an optional mesh primitive rendered as a TimeWarp overlay instead by drawing it into the eye buffer. This will take full advantage of the display resolution and avoid double resampling of the texture.

We support 3 types of Overlay shapes right now

  1. Quad : This is most common overlay type , you render a quad in Timewarp space.
  2. Cylinder: [Mobile Only][Experimental], Display overlay as partial surface of a cylinder
    • The cylinder's center will be your game object's center
    • We encoded the cylinder's parameters in transform.scale, **[scale.z] is the radius of the cylinder **[scale.y] is the height of the cylinder **[scale.x] is the length of the arc of cylinder
  • Limitations **Only the half of the cylinder can be displayed, which means the arc angle has to be smaller than 180 degree, [scale.x] / [scale.z] <= PI **Your camera has to be inside of the inscribed sphere of the cylinder, the overlay will be faded out automatically when the camera is close to the inscribed sphere's surface. **Translation only works correctly with vrDriver 1.04 or above
  1. Cubemap: Display overlay as a cube map
  2. OffcenterCubemap: [Mobile Only] Display overlay as a cube map with a texture coordinate offset
    • The actually sampling will looks like [color = texture(cubeLayerSampler, normalize(direction) + offset)] instead of [color = texture( cubeLayerSampler, direction )]
    • The extra center offset can be feed from transform.position
    • Note: if transform.position's magnitude is greater than 1, which will cause some cube map pixel always invisible Which is usually not what people wanted, we don't kill the ability for developer to do so here, but will warn out.
  3. Equirect: Display overlay as a 360-degree equirectangular skybox.

Member Enumeration Documentation

◆ OverlayShape

Determines the on-screen appearance of a layer.

Enumerator
Quad 
Cylinder 
Cubemap 
OffcenterCubemap 
Equirect 
ReconstructionPassthrough 
SurfaceProjectedPassthrough 
Fisheye 

◆ OverlayType

Whether the layer appears behind or infront of other content in the scene.

Enumerator
None 
Underlay 
Overlay 

Member Function Documentation

◆ ExternalSurfaceObjectCreated()

delegate void OVROverlay.ExternalSurfaceObjectCreated ( )

◆ IsPassthroughShape()

static bool OVROverlay.IsPassthroughShape ( OverlayShape  shape)
static

◆ OverrideOverlayTextureInfo()

void OVROverlay.OverrideOverlayTextureInfo ( Texture  srcTexture,
IntPtr  nativePtr,
UnityEngine.XR.XRNode  node 
)

Use this function to set texture and texNativePtr when app is running GetNativeTexturePtr is a slow behavior, the value should be pre-cached

◆ SetPerLayerColorScaleAndOffset()

void OVROverlay.SetPerLayerColorScaleAndOffset ( Vector4  scale,
Vector4  offset 
)

◆ SetSrcDestRects()

void OVROverlay.SetSrcDestRects ( Rect  srcLeft,
Rect  srcRight,
Rect  destLeft,
Rect  destRight 
)

Sets the source and dest rects for both eyes. Source explains what portion of the source texture is used, and dest is what portion of the destination texture is rendered into.

◆ UpdateTextureRectMatrix()

void OVROverlay.UpdateTextureRectMatrix ( )

Member Data Documentation

◆ colorOffset

Vector4 OVROverlay.colorOffset = Vector4.zero

◆ colorScale

Vector4 OVROverlay.colorScale = Vector4.one

◆ compositionDepth

int OVROverlay.compositionDepth = 0

The compositionDepth defines the order of the OVROverlays in composition. The overlay/underlay with smaller compositionDepth would be composited in the front of the overlay/underlay with larger compositionDepth.

◆ currentOverlayShape

OverlayShape OVROverlay.currentOverlayShape = OverlayShape.Quad

Specify overlay's shape

◆ currentOverlayType

OverlayType OVROverlay.currentOverlayType = OverlayType.Overlay

Specify overlay's type

◆ destRectLeft

Rect OVROverlay.destRectLeft = new Rect()

◆ destRectRight

Rect OVROverlay.destRectRight = new Rect()

◆ externalSurfaceHeight

int OVROverlay.externalSurfaceHeight = 0

The height which will be used to create the external surface. It's effective only on Android.

◆ externalSurfaceObject

System.IntPtr OVROverlay.externalSurfaceObject

The Surface object (Android only).

◆ externalSurfaceObjectCreated

ExternalSurfaceObjectCreated OVROverlay.externalSurfaceObjectCreated

Will be triggered after externalSurfaceTextueObject get created.

◆ externalSurfaceWidth

int OVROverlay.externalSurfaceWidth = 0

The width which will be used to create the external surface. It's effective only on Android.

◆ hidden

bool OVROverlay.hidden = false

◆ instances

OVROverlay [] OVROverlay.instances = new OVROverlay[maxInstances]
static

◆ invertTextureRects

bool OVROverlay.invertTextureRects = false

◆ isAlphaPremultiplied

bool OVROverlay.isAlphaPremultiplied = false

◆ isDynamic

bool OVROverlay.isDynamic = false

If true, the texture's content is copied to the compositor each frame.

◆ isExternalSurface

bool OVROverlay.isExternalSurface = false

If true, the layer will be created as an external surface. externalSurfaceObject contains the Surface object. It's effective only on Android.

◆ isOverridePending

bool OVROverlay.isOverridePending
protected

◆ isProtectedContent

bool OVROverlay.isProtectedContent = false

If true, the layer would be used to present protected content (e.g. HDCP). The flag is effective only on PC.

◆ layerTextureFormat

OVRPlugin.EyeTextureFormat OVROverlay.layerTextureFormat = OVRPlugin.EyeTextureFormat.R8G8B8A8_sRGB

◆ noDepthBufferTesting

bool OVROverlay.noDepthBufferTesting = true

The noDepthBufferTesting will stop layer's depth buffer compositing even if the engine has "Depth buffer sharing" enabled on Rift.

◆ overridePerLayerColorScaleAndOffset

bool OVROverlay.overridePerLayerColorScaleAndOffset = false

◆ overrideTextureRectMatrix

bool OVROverlay.overrideTextureRectMatrix = false

◆ srcRectLeft

Rect OVROverlay.srcRectLeft = new Rect()

◆ srcRectRight

Rect OVROverlay.srcRectRight = new Rect()

◆ texturePtrs

IntPtr [] OVROverlay.texturePtrs = new IntPtr[] { IntPtr.Zero, IntPtr.Zero }
protected

◆ textures

Texture [] OVROverlay.textures = new Texture[] { null, null }

The left- and right-eye Textures to show in the layer.

Note
If you need to change the texture on a per-frame basis, please use OverrideOverlayTextureInfo(..) to avoid caching issues.

◆ useExpensiveSuperSample

bool OVROverlay.useExpensiveSuperSample = false

Property Documentation

◆ layerId

int OVROverlay.layerId
get

◆ OpenVROverlayKey

string OVROverlay.OpenVROverlayKey
staticget

◆ previewInEditor

bool OVROverlay.previewInEditor
getset

Preview the overlay in the editor using a mesh renderer.


The documentation for this class was generated from the following file: