// 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
Returns |
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
|
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
dimensions).
srcG:
Int
dimensions).
srcB:
Int
dimensions).
toR:
Int
toG:
Int
toB:
Int
Throws
Exception
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
|
fromScale
(
scale
)
|