How do I apply gamma correct to CubeMap textures?

I previously tried CubeMap with a 6-sided jpeg texture.

However, the overall background appears to be dark.

PlayCanvas + CubeMap result:
image

I expect the following results

Probably because the color profile embedded in the jpeg is not referenced.
I would like to manually gamma correct the texture, but I couldn’t figure out how to do it. I’d be happy to get some advice.

Hmm, that’s a good question, calling @slimbuck, he may know how to do this.

Hi @cx20,

When I load the JPG in the browser it looks gamma correct so I don’t believe that’s the issue. I guess another setting must be off. Can you share code for me to take a look?

Thanks!

Hi @slimbuck Thank you for your reply.

The code to display the current CubeMap is as follows

Hi @cx20,

Sorry for my slow response.

Turns out you’re right! The JPG’s color profile is completely ignored by the engine. This appears to be a WebGL option which we set at https://github.com/playcanvas/engine/blob/master/src/graphics/device.js#L965.

I will investigate further why this is disabled, but for now I suggest re-saving the images with a plain old sRGB color profile instead. (GIMP’s built in sRGB profile seems to work fine).

Thanks!

1 Like

FYI: https://github.com/playcanvas/engine/issues/2424

I noticed a high quality HDR file in the following repository and decided to export it to JPG again using GIMP from there.

Below are links to new samples and display results. I think it’s much better than before.

PlayCanvas + new CubeMap result: