Fix T64578: Cycles clamps HDR colors for 16bit integer image with colorspace

This commit is contained in:
Brecht Van Lommel 2019-05-14 11:22:07 +02:00
parent 20421ef952
commit be967c0b3c
Notes: blender-bot 2023-02-14 08:08:56 +01:00
Referenced by issue #64578, Correct 16bit byte image transform to scene-linear in Eevee, but not in Cycles
1 changed files with 9 additions and 0 deletions

View File

@ -186,6 +186,15 @@ void ImageManager::metadata_detect_colorspace(ImageMetaData &metadata, const cha
* due to quantization in common cases. */
metadata.compress_as_srgb = (metadata.type == IMAGE_DATA_TYPE_BYTE ||
metadata.type == IMAGE_DATA_TYPE_BYTE4);
/* If colorspace conversion needed, use half instead of short so we can
* represent HDR values that might result from conversion. */
if (metadata.type == IMAGE_DATA_TYPE_USHORT) {
metadata.type = IMAGE_DATA_TYPE_HALF;
}
else if (metadata.type == IMAGE_DATA_TYPE_USHORT4) {
metadata.type = IMAGE_DATA_TYPE_HALF4;
}
}
}