I am trying to create a simple solid color skybox with a solid color indirect light. I understand that the lighting will look flat but it's ok for my use case.
This is what I have tried so far:
val oneWhitePixel =
ByteBuffer.wrap(byteArrayOf(0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte()))
val whitePixelBuffer = Texture.PixelBufferDescriptor(
oneWhitePixel,
Texture.Format.RGB,
Texture.Type.UBYTE
)
val indirectLightCube = Texture.Builder()
.width(1)
.height(1)
.sampler(Texture.Sampler.SAMPLER_CUBEMAP)
.format(Texture.InternalFormat.RGB8)
.build(engine)
.also { texture ->
texture.setImage(engine, 0, whitePixelBuffer)
}
val indirectLight = IndirectLight.Builder()
.reflections(indirectLightCube)
.build(engine)
However, this results in only the top (+Y) and right face (+X) being lit while the rest of the cube remains black as shown below.
I have also looked at this discussion in the Filament repo and tried using FaceOffsets in the setImage() method but I couldn't get it to work without throwing a BufferOverflowException
This is my attempt at using FaceOffsets:
val faceOffsets = IntArray(6)
faceOffsets[0] = 0
faceOffsets[1] = 1
faceOffsets[2] = 2
faceOffsets[3] = 3
faceOffsets[4] = 4
faceOffsets[5] = 5
texture.setImage(engine, 0, whitePixelBuffer, faceOffsets) // This method seems to be deprecated for java as well
Could anyone point me in the right direction to implement this?
Thank you in advance!
