HDRLoader: Handle RGBA source Buffer #4610
ThomasGorisse
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
My alpha bytes skipping solution doesn't seems to work: HDRLoader.createEnvironment(ByteBuffer.allocateDirect(
arImages[0].width * arImages[0].height *
arImages.size *
// RGB Bytes per pixel
6 * 2
).apply {
// Use the device hardware's native byte order
order(ByteOrder.nativeOrder())
val rgbaBytes = ByteArray(8) // ARGB Bytes per pixel
arImages.forEach { image ->
image.planes[0].buffer.let { imageBuffer ->
while (imageBuffer.hasRemaining()) {
// Only take the RGB channels
put(rgbaBytes.apply {
imageBuffer.get(this)
} // Skip the Alpha channel
.sliceArray(0..5))
}
}
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sorry, I just discovered what an hdr file is and that it's not only a RGB container at all. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
HDRLoader
is doing a great job coupled to theSpecularFilter
.filament/android/filament-utils-android/src/main/cpp/HDRLoader.cpp
Lines 36 to 91 in 9ff195c
But I have a case where my source buffer is in RGBA16F (ARCore estimated cubemap).
This involve that I have to create a new buffer in order to remove the alpha channel.
This wouldn't be a big issue in a normal usage case but in mine, I have to do it on every frame.
Would it possible to add an input format param to
nCreateHDRTexture
?If it's not applicable do you have any idea of the best way/less consuming way to strip the alpha channel from the buffer ?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions