From 7aaa7aa9dd79b8c6e37f351fd67a93ba07fbb883 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 18 May 2019 20:52:20 +0200 Subject: 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 --- source/blender/makesrna/intern/rna_image.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'source/blender/makesrna/intern/rna_image.c') diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 40c8c7e1582..c033e393625 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -680,12 +680,26 @@ static void rna_def_image(BlenderRNA *brna) "STRAIGHT", 0, "Straight", - "Transparent RGB and alpha pixels are unmodified"}, + "Store RGB and alpha channels separately with alpha acting as a mask, also known as " + "unassociated alpha. Commonly used by image editing applications and file formats like " + "PNG"}, {IMA_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", - "Transparent RGB pixels are multiplied by the alpha channel"}, + "Store RGB channels with alpha multipled in, also known as associated alpha. The natural " + "format for renders and used by file formats like OpenEXR"}, + {IMA_ALPHA_CHANNEL_PACKED, + "CHANNEL_PACKED", + 0, + "Channel Packed", + "Different images are packed in the RGB and alpha channels, and they should not " + "affect each other. Channel packing is commonly used by game engines to save memory"}, + {IMA_ALPHA_IGNORE, + "NONE", + 0, + "None", + "Ignore alpha channel from the file and make image fully opaque"}, {0, NULL, 0, NULL, NULL}, }; @@ -744,15 +758,6 @@ static void rna_def_image(BlenderRNA *brna) "Apply render part of display transformation when displaying this image on the screen"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); - prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_IGNORE_ALPHA); - RNA_def_property_ui_text( - prop, - "Use Alpha", - "Use the alpha channel information from the image or make image fully opaque"); - RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); - prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DEINTERLACE); -- cgit v1.2.3