API reference
API reference
Select your platform
No SDKs available
No versions available

OVROverlay Class

Add OVROverlay script to an object with an optional mesh primitive rendered as a TimeWarp overlay instead by drawing it into the eye buffer.
OVROverlay extends MonoBehaviour.

Overview

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, OverlayShape.KeyboardHandsPassthrough = OVRPlugin.OverlayShape.KeyboardHandsPassthrough, OverlayShape.KeyboardMaskedHandsPassthrough = OVRPlugin.OverlayShape.KeyboardMaskedHandsPassthrough
}
Determines the on-screen appearance of a layer.
enum
OverlayType {
}
Whether the layer appears behind or infront of other content in the scene.

Data Fields

Specify overlay's type.
bool
If true, the texture's content is copied to the compositor each frame.
bool
If true, the layer would be used to present protected content (e.g.
Rect
Rect
Rect
Rect
bool
bool
bool
Vector4
Vector4
bool
bool
bool
hidden[Get]
bool
If true, the layer will be created as an external surface.
int
The width which will be used to create the external surface.
int
The height which will be used to create the external surface.
int
The compositionDepth defines the order of the OVROverlays in composition.
bool
The noDepthBufferTesting will stop layer's depth buffer compositing even if the engine has "Depth buffer sharing" enabled on Rift.
OVRPlugin.EyeTextureFormat
Specify overlay's shape.
Texture[]
The left- and right-eye Textures to show in the layer.
bool
bool
bool
bool
bool
bool
System.IntPtr
The Surface object (Android only).
ExternalSurfaceObjectCreated
Will be triggered after externalSurfaceTextueObject get created.

Properties

bool
Preview the overlay in the editor using a mesh renderer.
int
layerId[Get]
OVRPlugin.LayerLayout
layout[Get]
bool
int
static string

Object Data

IntPtr[]
bool
OVRPlugin.LayerDesc
int
int
GCHandle
IntPtr
int
int
Renderer
rend[Get]

Static Fields

static OVROverlay[]

Object Data

static Material
static Material

Public Member Functions

delegate void
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.
void
SetSrcDestRects
( Rect srcLeft,
Rect srcRight,
Rect destLeft,
Rect destRight )
Sets the source and dest rects for both eyes.
void
void
SetPerLayerColorScaleAndOffset
( Vector4 scale,
Vector4 offset )
void

Object Data

static bool

Object Data

bool
CreateLayer
( int mipLevels,
int sampleCount,
OVRPlugin.EyeTextureFormat etFormat,
int flags,
OVRPlugin.Sizei size,
OVRPlugin.OverlayShape shape )
bool
CreateLayerTextures
( bool useMipmaps,
OVRPlugin.Sizei size,
bool isHdr )
void
void
bool
OVRPlugin.LayerDesc
Rect
GetBlitRect
( int eyeId )
void
BlitSubImage
( Texture src,
RenderTexture dst,
Material mat,
Rect rect,
bool invertRect )
bool
PopulateLayer
( int mipLevels,
bool isHdr,
OVRPlugin.Sizei size,
int sampleCount,
int stage )
bool
SubmitLayer
( bool overlay,
bool headLocked,
bool noDepthBufferTesting,
OVRPose pose,
Vector3 scale,
int frameIndex )
void

Static Public Member Functions

static bool

Details

Detailed Description

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
  3. Cubemap: Display overlay as a cube map
  4. 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.
  5. Equirect: Display overlay as a 360-degree equirectangular skybox.

Member Enumerations

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

Fields

OverlayType OVROverlay.currentOverlayType
Specify overlay's type.
bool OVROverlay.isDynamic
If true, the texture's content is copied to the compositor each frame.
bool OVROverlay.isProtectedContent
If true, the layer would be used to present protected content (e.g.
HDCP), the content won't be shown in screenshots or recordings.
Rect OVROverlay.srcRectLeft
No description available.
Rect OVROverlay.srcRectRight
No description available.
Rect OVROverlay.destRectLeft
No description available.
Rect OVROverlay.destRectRight
No description available.
bool OVROverlay.invertTextureRects
No description available.
bool OVROverlay.overrideTextureRectMatrix
No description available.
bool OVROverlay.overridePerLayerColorScaleAndOffset
No description available.
Vector4 OVROverlay.colorScale
No description available.
Vector4 OVROverlay.colorOffset
No description available.
bool OVROverlay.useExpensiveSuperSample
No description available.
bool OVROverlay.useExpensiveSharpen
No description available.
bool OVROverlay.hidden
No description available.
bool OVROverlay.isExternalSurface
If true, the layer will be created as an external surface.
externalSurfaceObject contains the Surface object. It's effective only on Android.
int OVROverlay.externalSurfaceWidth
The width which will be used to create the external surface.
It's effective only on Android.
int OVROverlay.externalSurfaceHeight
The height which will be used to create the external surface.
It's effective only on Android.
int OVROverlay.compositionDepth
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.
bool OVROverlay.noDepthBufferTesting
The noDepthBufferTesting will stop layer's depth buffer compositing even if the engine has "Depth buffer sharing" enabled on Rift.
OVRPlugin.EyeTextureFormat OVROverlay.layerTextureFormat
No description available.
OverlayShape OVROverlay.currentOverlayShape
Specify overlay's shape.
Texture [] OVROverlay.textures
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.
bool OVROverlay.isAlphaPremultiplied
No description available.
bool OVROverlay.useBicubicFiltering
No description available.
bool OVROverlay.useLegacyCubemapRotation
No description available.
bool OVROverlay.useEfficientSupersample
No description available.
bool OVROverlay.useEfficientSharpen
No description available.
bool OVROverlay.useAutomaticFiltering
No description available.
System.IntPtr OVROverlay.externalSurfaceObject
The Surface object (Android only).
ExternalSurfaceObjectCreated OVROverlay.externalSurfaceObjectCreated
Will be triggered after externalSurfaceTextueObject get created.

Properties

bool OVROverlay.previewInEditor
Preview the overlay in the editor using a mesh renderer.
int OVROverlay.layerId
No description available.
OVRPlugin.LayerLayout OVROverlay.layout
No description available.
bool OVROverlay.isOverlayVisible
No description available.
int OVROverlay.texturesPerStage
No description available.
string OVROverlay.OpenVROverlayKey
No description available.

Object Data

IntPtr [] OVROverlay.texturePtrs
No description available.
bool OVROverlay.isOverridePending
No description available.
LayerTexture [] OVROverlay.layerTextures
No description available.
OVRPlugin.LayerDesc OVROverlay.layerDesc
No description available.
int OVROverlay.stageCount
No description available.
int OVROverlay.layerIndex
No description available.
GCHandle OVROverlay.layerIdHandle
No description available.
IntPtr OVROverlay.layerIdPtr
No description available.
int OVROverlay.frameIndex
No description available.
int OVROverlay.prevFrameIndex
No description available.
Renderer OVROverlay.rend
No description available.

Public Statics

OVROverlay [] OVROverlay.instances
No description available.

Object Data

Material OVROverlay.tex2DMaterial
No description available.
Material OVROverlay.cubeMaterial
No description available.

Member Functions

delegate void OVROverlay.ExternalSurfaceObjectCreated ( )
No description available.
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.
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.
void OVROverlay.UpdateTextureRectMatrix ( )
No description available.
void OVROverlay.SetPerLayerColorScaleAndOffset
( Vector4 scale,
Vector4 offset )
No description available.
void OVROverlay.ResetEditorPreview ( )
No description available.

Object Data

static bool OVROverlay.NeedsTexturesForShape
( OverlayShape shape )
No description available.

Object Data

bool OVROverlay.CreateLayer
( int mipLevels,
int sampleCount,
OVRPlugin.EyeTextureFormat etFormat,
int flags,
OVRPlugin.Sizei size,
OVRPlugin.OverlayShape shape )
No description available.
bool OVROverlay.CreateLayerTextures
( bool useMipmaps,
OVRPlugin.Sizei size,
bool isHdr )
No description available.
void OVROverlay.DestroyLayerTextures ( )
No description available.
void OVROverlay.DestroyLayer ( )
No description available.
bool OVROverlay.LatchLayerTextures ( )
No description available.
OVRPlugin.LayerDesc OVROverlay.GetCurrentLayerDesc ( )
No description available.
Rect OVROverlay.GetBlitRect
( int eyeId )
No description available.
void OVROverlay.BlitSubImage
( Texture src,
RenderTexture dst,
Material mat,
Rect rect,
bool invertRect )
No description available.
bool OVROverlay.PopulateLayer
( int mipLevels,
bool isHdr,
OVRPlugin.Sizei size,
int sampleCount,
int stage )
No description available.
bool OVROverlay.SubmitLayer
( bool overlay,
bool headLocked,
bool noDepthBufferTesting,
OVRPose pose,
Vector3 scale,
int frameIndex )
No description available.
void OVROverlay.SetupEditorPreview ( )
No description available.

Static Member Functions

static bool OVROverlay.IsPassthroughShape
( OverlayShape shape )
No description available.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon