Images: change alpha settings to support channel packing
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sat, 18 May 2019 18:52:20 +0000 (20:52 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 19 May 2019 12:36:42 +0000 (14:36 +0200)
commit7aaa7aa9dd79b8c6e37f351fd67a93ba07fbb883
tree6d64084b9b104ad3d9f2bbff2b3d0404ec356862
parent3b23b5c638feae0ad6319440771b83a64a1f9ebe
Images: change alpha settings to support channel packing

This also replaces the Use Alpha setting. We now have these alpha modes:

* Straight: store RGB and alpha channels separately with alpha acting as a
  mask, also known as unassociated alpha.
* Premultiplied: transparent RGB pixels are multiplied by the alpha channel.
  The natural format for renders.
* Channel Packed: different images are packed in the RGB and alpha channels,
  and they should not influence each other. Channel packing is commonly used
  by game engines to save memory.
* None: ignore alpha channel from the file and make image fully opaque.

Cycles OSL does not correctly support Channel Packed and None yet, we are
missing fine control over the OpenImageIO texture cache to do that.

Fixes T53672
21 files changed:
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_shader.cpp
intern/cycles/render/image.cpp
intern/cycles/render/image.h
intern/cycles/render/nodes.cpp
intern/cycles/render/nodes.h
intern/cycles/util/util_texture.h
source/blender/blenkernel/BKE_blender_version.h
source/blender/blenkernel/intern/image.c
source/blender/blenloader/intern/versioning_260.c
source/blender/blenloader/intern/versioning_280.c
source/blender/editors/space_image/image_buttons.c
source/blender/imbuf/IMB_imbuf.h
source/blender/imbuf/IMB_imbuf_types.h
source/blender/imbuf/intern/colormanagement.c
source/blender/imbuf/intern/divers.c
source/blender/imbuf/intern/readimage.c
source/blender/makesdna/DNA_image_types.h
source/blender/makesrna/intern/rna_image.c
source/blender/nodes/shader/nodes/node_shader_tex_image.c
source/blender/render/intern/source/imagetexture.c