Image Texture material node in Cycles handles semitransparency incorrectly #35812

Closed
opened 2013-06-21 02:11:11 +02:00 by Yu Asakusa · 4 comments

%%%--- Operating System, Graphics card ---
Windows 7 64-bit Service Pack 1, Mobile Intel 4 Series Express Chipset

- Blender version with error, and version that worked ---

Error:

In particular, if the image file contains semitransparent white pixels (R=G=B=1 and 0<A<1 in straight alpha), they become either semitransparent gray (R=G=B<A in premultiplied alpha) or semitransparent whiter-than-white (R=G=B>A in premultiplied alpha), depending on whether the “Open Shading Language” checkbox in the Render tab of the Properties window is checked or not.

- Steps for others to reproduce the error (preferably based on attached .blend file) ---
  1. Save the attached files (image-material-node.blend and gradation.png) in the same directory, and open image-material-node.blend.
  2. Make sure the Open Shading Language checkbox is turned off, and render.
  3. Turn on the Open Shading Language checkbox, and render.

Actual behavior:
In both step 2 and step 3, the plane is rendered as gradation. In step 2, the gradation is from white on the left to black on the right. In step 3, the gradation is from black to gray to black.

Expected behavior:
In both step 2 and step 3, the plane should be rendered as black, because all pixels in gradation.png are semitransparent white.

Notes:

  • The mere fact that steps 2 and 3 give different results can be also viewed as evidence that there is something wrong, but I believe both results are incorrect.
  • By changing the blend type of the MixRGB node from Difference to Subtract, we can tell whether RGB are larger or alpha is larger. In step 2, RGB are larger, meaning that the output of the Image Texture node is semitransparent whiter-than-white. In step 3, alpha is larger, meaning that the output of the Image Texture node is semitransparent gray.
  • gradation.png was made with GIMP 2.8.4. Just in case, I made the same image with Paint.NET 3.5.10, but the result is the same.
  • The Image input node in the compositor handles semitransparency correctly.
  • [#34679] and [#34966] seem related, but they are marked as fixed.
    %%%
%%%--- Operating System, Graphics card --- Windows 7 64-bit Service Pack 1, Mobile Intel 4 Series Express Chipset - Blender version with error, and version that worked --- Error: * Blender r57620 64-bit (http://builder.blender.org/download/blender-2.67-r57620-win64.zip) * Blender 2.67b 64-bit (official binary) Working: * None I know of - Short description of error --- The Image Texture material node in Cycles seems to handle semitransparency incorrectly. In particular, if the image file contains semitransparent white pixels (R=G=B=1 and 0<A<1 in straight alpha), they become either semitransparent gray (R=G=B<A in premultiplied alpha) or semitransparent whiter-than-white (R=G=B>A in premultiplied alpha), depending on whether the “Open Shading Language” checkbox in the Render tab of the Properties window is checked or not. - Steps for others to reproduce the error (preferably based on attached .blend file) --- 1. Save the attached files (image-material-node.blend and gradation.png) in the same directory, and open image-material-node.blend. 2. Make sure the Open Shading Language checkbox is turned off, and render. 3. Turn on the Open Shading Language checkbox, and render. Actual behavior: In both step 2 and step 3, the plane is rendered as gradation. In step 2, the gradation is from white on the left to black on the right. In step 3, the gradation is from black to gray to black. Expected behavior: In both step 2 and step 3, the plane should be rendered as black, because all pixels in gradation.png are semitransparent white. Notes: * The mere fact that steps 2 and 3 give different results can be also viewed as evidence that there is something wrong, but I believe both results are incorrect. * By changing the blend type of the MixRGB node from Difference to Subtract, we can tell whether RGB are larger or alpha is larger. In step 2, RGB are larger, meaning that the output of the Image Texture node is semitransparent whiter-than-white. In step 3, alpha is larger, meaning that the output of the Image Texture node is semitransparent gray. * gradation.png was made with GIMP 2.8.4. Just in case, I made the same image with Paint.NET 3.5.10, but the result is the same. * The Image input node in the compositor handles semitransparency correctly. * [#34679] and [#34966] seem related, but they are marked as fixed. %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%If you use both the color and alpha output of an Image Texture node, it will output unpremultiplied/straight RGB channels. So then it is valid to for RA. The reason it works that way is because it's more convenient for the typical mix shader node setup, if you plug alpha in the mix shader socket to blend, it already multiplies with the alpha, and you don't want that to happen twice.
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Textures#Image_Texture

There was an issue with the OSL version not working as intended, fixed that now.%%%

%%%If you use both the color and alpha output of an Image Texture node, it will output unpremultiplied/straight RGB channels. So then it is valid to for R<A or R>A. The reason it works that way is because it's more convenient for the typical mix shader node setup, if you plug alpha in the mix shader socket to blend, it already multiplies with the alpha, and you don't want that to happen twice. http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Textures#Image_Texture There was an issue with the OSL version not working as intended, fixed that now.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author

%%%Oops, I did not know the Color output of the Image Texture node depended on whether the Alpha output was used or not. Thank you for the pointer. (I think that is very confusing, but it is a separate issue.)%%%

%%%Oops, I did not know the Color output of the Image Texture node depended on whether the Alpha output was used or not. Thank you for the pointer. (I think that is very confusing, but it is a separate issue.)%%%
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#35812
No description provided.