Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-01-21 20:57:00 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-06-02 19:04:38 +0300
commit33f5e8f2391944acf8c6cc56bcc352bc10af016c (patch)
treedc18c07bdd6d7e257b92250cac1293f693be0325 /intern/cycles/scene/image.cpp
parent10488d54d9836b04f36d95269552bd449dd97e7e (diff)
Cycles: load 8 bit image textures as half float for some color spaces
For non-raw, non-sRGB color spaces, always use half float even if that uses more memory. Otherwise the precision loss from conversion to scene linear or sRGB (as natively understood by the texture sampling) can be too much. This also required a change to do alpha association ourselves instead of OIIO, because in OIIO alpha multiplication happens before conversion to half float and that gives too much precision loss. Ref T68926
Diffstat (limited to 'intern/cycles/scene/image.cpp')
-rw-r--r--intern/cycles/scene/image.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/intern/cycles/scene/image.cpp b/intern/cycles/scene/image.cpp
index 2aa9a6bc1a1..1b44162351a 100644
--- a/intern/cycles/scene/image.cpp
+++ b/intern/cycles/scene/image.cpp
@@ -272,17 +272,12 @@ void ImageMetaData::detect_colorspace()
compress_as_srgb = true;
}
else {
- /* Always compress non-raw 8bit images as scene linear + sRGB, as a
- * heuristic to keep memory usage the same without too much data loss
- * due to quantization in common cases. */
- compress_as_srgb = (type == IMAGE_DATA_TYPE_BYTE || 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 (type == IMAGE_DATA_TYPE_USHORT) {
+ if (type == IMAGE_DATA_TYPE_BYTE || type == IMAGE_DATA_TYPE_USHORT) {
type = IMAGE_DATA_TYPE_HALF;
}
- else if (type == IMAGE_DATA_TYPE_USHORT4) {
+ else if (type == IMAGE_DATA_TYPE_BYTE4 || type == IMAGE_DATA_TYPE_USHORT4) {
type = IMAGE_DATA_TYPE_HALF4;
}
}