Load OpenEXR as PF_FLOAT16_RGBA

Design / architecture / roadmap discussions related to future of Ogre3D (version 2.0 and above)
Post Reply
User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 138
Joined: Wed Apr 23, 2014 3:49 pm
x 4

Load OpenEXR as PF_FLOAT16_RGBA

Post by TaaTT4 » Tue Sep 04, 2018 3:01 pm

I'd like to load an OpenEXR image as PF_FLOAT16_RGBA (since it gets loaded as PF_FLOAT32_RGBA by default). I've tried to following this old thread without success.

Doing so

Code: Select all

texture_unit 0
{
	texture Curve.exr 2d 0 PF_FLOAT16_RGBA

	tex_address_mode clamp
}
I can see with RenderDoc that texture takes R16G16B16A16_FLOAT format, but it's content is garbage.

Here you can find the OpenEXR image I'm using. I'm pretty sure its format is correctly floating point with 16 bits of precision.
0 x
Senior game programmer at Vae Victis
Working on Racecraft

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3770
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 131
Contact:

Re: Load OpenEXR as PF_FLOAT16_RGBA

Post by dark_sylinc » Tue Sep 04, 2018 5:58 pm

I have little experience in this area.

It sounds like either a problem with the EXR codec (if using our EXR codec), which at a quick glance only supports Float32 formats, or a problem with FreeImage codec (if using FreeImage's)

Looking at FreeImage's source code, they convert half to floats. And there is no half/float16 datatype in FreeImage headers either, so it's quite clear they do not support it.

You may have better luck with our built in EXR codec, and modify it slightly to load the raw half format. A quick google reveals that our code in EXRCodec::decode instead of doing this:

Code: Select all

frameBuffer.insert("R",             // name
                    Slice (FLOAT
it should do this:

Code: Select all

frameBuffer.insert("R",             // name
                    Slice (IMF::HALF
And modify the base & stride accordingly (and modify the pixel format we return!!!).

Cheers
Matias
0 x

Post Reply