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

Lut

Lut

class Lut(val dimension: Int = 16)
Passthrough lookup tables (LUTs) transform the colors that passthrough displays. You can use them to evoke a certain style, such as tinting everything red when you are low on health, or to emulate a lighting environment, like dimming lights when a movie starts.
Passthrough LUTs are represented by a 3D color "cube" with the dimensions of 16x16x16 or 32x32x32 representing input RGB values. Each of the 16^3 or 32^3 values are mapped to a 32-bit RGBA color value (each color channel being 0-255).
See our guide on Passthrough LUTs for more details.
Usage:
// initialize lut
val lut = Lut()
for (r in 0..15) {
    for (g in 0..15) {
        for (b in 0..15) {
            // set a mapping color for each RGB value in the (0-15)^3 range
            lut.setMapping(r, g, b, r * 4 + r / 4, g * 4 + g / 4, b * 4 + b / 4)
        }
    }
}

// alternatively, for a simple scaling, you can use `Lut.fromScale(Vector3)`
val lut = Lut.fromScale(Vector3(0.25f))

// loading from a bitmap is possible too
val lut = Lut.fromBitmap(BitmapFactory.decodeFile("lut.png"))

// finally, apply it to the passthrough
scene.setPassthroughLUT(lut)

Constructors

NameSummary
Lut
constructor(dimension: Int = 16)

Types

NameSummary
Companion
object Companion

Properties

NameSummary
dimension
val dimension: Int = 16

The dimension of the LUT (16 or 32), defaults to 16.

Functions

NameSummary
getTable
fun getTable(): IntArray

Returns a 1D array representation of the 3D color lookup table.
setMapping
fun setMapping(srcR: Int, srcG: Int, srcB: Int, toR: Int, toG: Int, toB: Int)

Sets a specific RGB to be set to a different RGB value in the LUT.

Companion

object Companion

Functions

NameSummary
fromBitmap
fun fromBitmap(bitmap: <Error class: unknown class>): Lut?

Creates a LUT object from a Bitmap loaded from disk.
fromScale
fun fromScale(scale: Vector3): Lut

Creates a LUT where RGB are scaled component-wise by the given XYZ scale.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon