I create equirectangular .hdr images in Maya for use as environment maps in ThreeJS. These allow me to create complex lighting and match its appearance exactly in ThreeJS. I’m migrating from r129 to r147, and my textures are coming in differently. It seems that ThreeJS now forces HDR images to be read as sRGB-encoded?
HDR images rendered correctly as Linear/Raw color in r129, closely matching Maya’s and Photoshop’s display:
HDR images rendered way wrong by ThreeJS in 147, and pretty closely matched in Maya by having it interpret them as sRGB:
I see that in the HDR example, ReinhardToneMapping is applied to the renderer, but this actually doesn’t match the proper appearance of the .hdr file as it would appear in other rendering environments:
(comparison between the .hdr file on its own, and the file as-rendered in the demo. Correct color is upper left, ThreeJS’ display is lower right.)
My best match using Reinhard:
Reinhard makes the image too saturated and higher-contrast, even when the overall luminance is a close match. Actually, the deficiencies here are the opposite of what is seen with the previous image, where Three’s version is lower-contrast and lower-saturation, meaning that if one asset looks right under Reinhard mapping then other assets probably look wrong. (I also had to use an exposure value of 5 here, whereas the official demo only uses 2)
Also, although the two look similar when viewed as images, applying them as envMaps shows a radical difference in brightness:
ReinhardToneMapping gets close, but it’s not as correct as just reading the HDR files as Linear in the first place.
I’ve experimented with as many variations of
texture.encoding = THREE.LinearEncoding; as I can think of, and none of them have made any difference in how the texture displays. Is this flag ignored? Is there a way to correct this that I’ve missed?
This seems to happen with all HalfFloat DataTextures.