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

OVROverlay Class

Extends MonoBehaviour
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
  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

Enumeration OverlayShape

Determines the on-screen appearance of a layer.
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

Enumeration OverlayType

Whether the layer appears behind or infront of other content in the scene.
None
No description available
Underlay
No description available
Overlay
No description available

Fields

Specify overlay's type.
If true, the texture's content is copied to the compositor each frame.
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 srcRectLeft[Get]
Rect srcRectRight[Get]
Rect destRectLeft[Get]
Rect destRectRight[Get]
bool invertTextureRects[Get]
bool overrideTextureRectMatrix[Get]
bool overridePerLayerColorScaleAndOffset[Get]
Vector4 colorScale[Get]
Vector4 colorOffset[Get]
bool useExpensiveSuperSample[Get]
bool useExpensiveSharpen[Get]
bool hidden[Get]
If true, the layer will be created as an external surface.
externalSurfaceObject contains the Surface object. It's effective only on Android.
The width which will be used to create the external surface.
It's effective only on Android.
The height which will be used to create the external surface.
It's effective only on Android.
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.
The noDepthBufferTesting will stop layer's depth buffer compositing even if the engine has "Depth buffer sharing" enabled on Rift.
OVRPlugin.EyeTextureFormat layerTextureFormat[Get]
Specify overlay's shape.
The left- and right-eye Textures to show in the layer.
If you need to change the texture on a per-frame basis, please use OverrideOverlayTextureInfo(..) to avoid caching issues.
bool isAlphaPremultiplied[Get]
bool useBicubicFiltering[Get]
bool useLegacyCubemapRotation[Get]
bool useEfficientSupersample[Get]
bool useEfficientSharpen[Get]
bool useAutomaticFiltering[Get]
The Surface object (Android only).
Will be triggered after externalSurfaceTextueObject get created.

Properties

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

Protected Fields

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

Public Statics

static OVROverlay[] instances[Get]

Object Data for protected-static-attrib

static Material tex2DMaterial[Get]
static readonly Material[] cubeMaterial[Get]

Member Functions

delegate void ExternalSurfaceObjectCreated ( )
Use this function to set texture and texNativePtr when app is running GetNativeTexturePtr is a slow behavior, the value should be pre-cached.
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 UpdateTextureRectMatrix ( )
void SetPerLayerColorScaleAndOffset
( Vector4 scale,
Vector4 offset )
void ResetEditorPreview ( )

Object Data for protected-static-func

static bool NeedsTexturesForShape
( OverlayShape shape )

Protected Functions

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 DestroyLayerTextures ( )
void DestroyLayer ( )
bool LatchLayerTextures ( )
OVRPlugin.LayerDesc GetCurrentLayerDesc ( )
Rect GetBlitRect
( int eyeId,
int width,
int height,
bool invertRect )
void BlitSubImage
( Texture src,
int width,
int height,
Material mat,
Rect rect )
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 SetupEditorPreview ( )

Static Member Functions

static bool IsPassthroughShape
( OverlayShape shape )
Did you find this page helpful?
Thumbs up icon
Thumbs down icon