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

OVRPassthroughColorLut Class

Extends IDisposable
This class represents a color look-up table (LUT) that can be applied to an OVRPassthroughLayer in order to change the color reproduction of that passthrough layer.
Color LUTs map each RGB input color to a new RGB(A) color. It unlocks a number of effects:
  • Color grading and color correction
  • Stylizations, such as posterization or hue rotation
  • Color filtering and chroma keying
To apply a color LUT to a Passthrough layer, create a new instance of OVRPassthroughColorLut and call OVRPassthroughLayer.SetColorLut(). For more information and examples, see Color Mapping Techniques.

Constructors

OVRPassthroughColorLut ( initialLutTexture , flipY )
Initialize the color LUT data from a texture.
Color channels are inferred from texture format. Use UpdateFrom() to update LUT data after construction.
Signature
OVRPassthroughColorLut(Texture2D initialLutTexture, bool flipY=true)
Parameters
initialLutTexture: Texture2D  Texture to initialize the LUT from
flipY: bool  Flag to inform whether the LUT texture should be flipped vertically. This is needed for LUT images which have color (0, 0, 0) in the top-left corner. Some color grading systems, e.g. Unity post-processing, have color (0, 0, 0) in the bottom-left corner, in which case flipping is not needed.
OVRPassthroughColorLut ( initialColorLut , channels )
Set the color LUT data from an array of Color.
The resolution is inferred from the array size, thus the size needs to be a result of resolution = size ^ 3 * numColorChannels, where numColorChannels depends on channels. Use UpdateFrom() to update color LUT data after construction.
Signature
OVRPassthroughColorLut(Color[] initialColorLut, ColorChannels channels)
Parameters
initialColorLut: Color[]  Color array to initialize the LUT from
channels: ColorChannels  Color channels for one color LUT entry
OVRPassthroughColorLut ( initialColorLut , channels )
Set the color LUT data from an array of Color.
The resolution is inferred from the array size, thus the size needs to be a result of resolution = size ^ 3 * numColorChannels, where numColorChannels depends on channels. Use UpdateFrom() to update color LUT data after construction.
Signature
OVRPassthroughColorLut(Color32[] initialColorLut, ColorChannels channels)
Parameters
initialColorLut: Color32[]  Color32 array to initialize the LUT from
channels: ColorChannels  Color channels for one color LUT entry
OVRPassthroughColorLut ( initialColorLut , channels )
Set the color LUT data from an array of Color.
The resolution is inferred from the array size, thus the size needs to be a result of resolution = size ^ 3 * numColorChannels, where numColorChannels depends on channels. Use UpdateFrom() to update color LUT data after construction.
Signature
OVRPassthroughColorLut(byte[] initialColorLut, ColorChannels channels)
Parameters
initialColorLut: byte[]  Color byte array to initialize the LUT from
channels: ColorChannels  Color channels for one color LUT entry

Properties

Channels : ColorChannels
[Get]
The color channels contained in each of the resulting colors.
Can be ColorChannels.Rgb or ColorChannels.Rgba. This property is defined at construction time and cannot be modified.
Signature
ColorChannels Channels
IsInitialized : bool
[Get]
Deprecated
  • use IsValid instead.
Signature
bool IsInitialized
IsValid : bool
[Get]
Checks if the current state of the LUT is valid for use by an OVRPassthroughLayer.
Signature
bool IsValid
Resolution : uint
[Get]
The size of one edge of the color cube spanned by the LUT.
For example, a resolution of 16 means that the LUT encompasses 16 * 16 * 16 colors. This property is defined at construction time and cannot be modified.
Signature
uint Resolution

Methods

Dispose ()
Free the system resources associated with the color LUT.
Subsequent calls to OVRPassthroughLayer.SetColorLut() with this instance will fail.
Signature
void Dispose()
Returns
void
UpdateFrom ( colors )
Updates color LUT data from an array of Color.
The resolution (number of colors) must match the original specification at construction time. The alpha value is ignored if ColorChannels was set to Rgb.
Signature
void UpdateFrom(Color[] colors)
Parameters
colors: Color[]  Color array
Returns
void
UpdateFrom ( colors )
Updates color LUT data from an array of Color32.
The resolution (number of colors) must match the original specification at construction time. The alpha value is ignored if ColorChannels was set to Rgb.
Signature
void UpdateFrom(Color32[] colors)
Parameters
colors: Color32[]  Color array
Returns
void
UpdateFrom ( colors )
Updates color LUT data from an array of RGB(A) values.
The resolution (number of colors) must match the original specification at construction time. The expected number of bytes per color is 3 if ColorChannels was set to Rgb, 4 if it was set to Rgba.
Signature
void UpdateFrom(byte[] colors)
Parameters
colors: byte[]  Array of consecutive RGB(A) color tuples
Returns
void
UpdateFrom ( lutTexture , flipY )
Update color LUT data from a texture.
Color channels and resolution must match the original.
Signature
void UpdateFrom(Texture2D lutTexture, bool flipY=true)
Parameters
lutTexture: Texture2D  Color LUT texture
flipY: bool  Flag to inform whether the LUT texture should be flipped vertically. This is needed for LUT images which have color (0, 0, 0) in the top-left corner. Some color grading systems, e.g. Unity post-processing, have color (0, 0, 0) in the bottom-left corner, in which case flipping is not needed.
Returns
void

Static Methods

IsTextureSupported ( texture , errorMessage )
Check if the given texture is formatted correctly for the use as color LUT.
Signature
static bool IsTextureSupported(Texture2D texture, out string errorMessage)
Parameters
texture: Texture2D  Texture to check
errorMessage: out string  Error message describing acceptance fail reason
Returns
bool

Inner Enum

ColorChannels Enum

Enumeration Constants

MemberValue
Rgb
OVRPlugin.PassthroughColorLutChannels.Rgb
Rgba
OVRPlugin.PassthroughColorLutChannels.Rgba