// 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)
class Lut(val dimension: Int = 16)
Lut
(
dimension
)
|
Signature
constructor(dimension: Int = 16) Parameters dimension: Int
The dimension of the LUT (16 or 32), defaults to 16.
Returns Lut |
dimension
: Int
[Get] |
The dimension of the LUT (16 or 32), defaults to 16.
Signature
val dimension: Int = 16 |
getTable
()
|
Returns a 1D array representation of the 3D color lookup table.
Signature
fun getTable(): IntArray Returns IntArray
The internal table pixels.
|
setMapping
(
srcR
, srcG
, srcB
, toR
, toG
, toB
)
|
Sets a specific RGB to be set to a different RGB value in the LUT.
Signature
fun setMapping(srcR: Int, srcG: Int, srcB: Int, toR: Int, toG: Int, toB: Int) Parameters srcR: Int
The red component of the source color (less than dimensions).
srcG: Int
The green component of the source color (less than dimensions).
srcB: Int
The blue component of the source color (less than dimensions).
toR: Int
The red component of the destination color (8-bit).
toG: Int
The green component of the destination color (8-bit).
toB: Int
The blue component of the destination color (8-bit).
Throws Exception
If the source color is out of range based on the dimensions.
|
fromBitmap
(
bitmap
)
|
Creates a LUT object from a Bitmap loaded from disk.
The bitmap is a 2D representation of the 3D LUT and must be 256x16 or 1024x32 pixels.
Signature
fun fromBitmap(bitmap: Bitmap): Lut? Parameters bitmap: Bitmap
The bitmap to create the LUT from.
|
fromScale
(
scale
)
|