dark edge artifacts on unassociated alpha images when used as cycles textures. #34679

Closed
opened 2013-03-18 19:43:29 +01:00 by GuillermoEspertino · 7 comments

%%%Debian Testing 64 bit
GeForce 9600GT

Blender 2.66a

I'm trying to re-create shadeless materials with cycles, in order to use RGBA images as planes with no shading and transparency.
The method used is the same that the addon "Images to planes" uses (alpha is used to mix a camera-rays-only emissive shader to a transparent shader)
It works as expected with EXR files (associated alpha) but artifacts are visible when the image has unassociated alpha (PNG)

The attached file shows the problem. The left plane was created from a PNG with the described method and the right plane uses an EXR file.
It's easily reproducible using the images to plane addon to create the basic shader from a PNG and an EXR file.

%%%

%%%Debian Testing 64 bit GeForce 9600GT Blender 2.66a I'm trying to re-create shadeless materials with cycles, in order to use RGBA images as planes with no shading and transparency. The method used is the same that the addon "Images to planes" uses (alpha is used to mix a camera-rays-only emissive shader to a transparent shader) It works as expected with EXR files (associated alpha) but artifacts are visible when the image has unassociated alpha (PNG) The attached file shows the problem. The left plane was created from a PNG with the described method and the right plane uses an EXR file. It's easily reproducible using the images to plane addon to create the basic shader from a PNG and an EXR file. %%%

Changed status to: 'Open'

Changed status to: 'Open'

%%%Currently cycles ignores color management settings (such as color spaces and alpha mode) when loading images. Packing images so blender side image loading is used will make alpha looking correct.

Brecht, not sure if you'll consider this is a bug or todo or maybe you already have fix for this issue.%%%

%%%Currently cycles ignores color management settings (such as color spaces and alpha mode) when loading images. Packing images so blender side image loading is used will make alpha looking correct. Brecht, not sure if you'll consider this is a bug or todo or maybe you already have fix for this issue.%%%

%%%I'm working on a fix, but there is something strange about the EXR image file here, it doesn't seem to be associated alpha? How was this file created?

Yet it somehow shows fine in the Blender image editor, but when disabling Use Alpha it's clear that the RGB channels are not premultiplied. Not sure what's going on here.%%%

%%%I'm working on a fix, but there is something strange about the EXR image file here, it doesn't seem to be associated alpha? How was this file created? Yet it somehow shows fine in the Blender image editor, but when disabling Use Alpha it's clear that the RGB channels are not premultiplied. Not sure what's going on here.%%%

%%%oops!
Sorry, I didn't check that. The image was created with GIMP 2.9. Apparently the exr exporter plugin doesn't associate alpha and keeps GIMP's unassociated images.
However, this might bring some interesting information, because I tried again and saved an associated EXR from Blender's compositor and when I replaced the unassociated EXR with the associated EXR in my example, the dark fringe appeared.
My gut says it's a double association: The PNG is interpreted as unasocciated correctly, so it gets multiplied. The wrong EXR is intepreted wrongly as associated, so it doesn't get multiplied. If cycles is multiplying by alpha again, it would make sense to see a dark fring both in proper associated and unassociated, but not in an unassociated image treated mistakenly as associated.%%%

%%%oops! Sorry, I didn't check that. The image was created with GIMP 2.9. Apparently the exr exporter plugin doesn't associate alpha and keeps GIMP's unassociated images. However, this might bring some interesting information, because I tried again and saved an associated EXR from Blender's compositor and when I replaced the unassociated EXR with the associated EXR in my example, the dark fringe appeared. My gut says it's a double association: The PNG is interpreted as unasocciated correctly, so it gets multiplied. The wrong EXR is intepreted wrongly as associated, so it doesn't get multiplied. If cycles is multiplying by alpha again, it would make sense to see a dark fring both in proper associated and unassociated, but not in an unassociated image treated mistakenly as associated.%%%

%%%The issue is the alpha is getting premultiplied again as part of the mix shader node, actually the BSDF should get straight RGB values for color. I've changed the code now so that the image texture node outputs this when the alpha output is used. Not sure this is ideal, but I can't really automate this to give correct behavior always because it depends on the node setup and the user needs to be aware of what they are doing, so this is a heuristic to try to get the correct results in typical setups.%%%

%%%The issue is the alpha is getting premultiplied again as part of the mix shader node, actually the BSDF should get straight RGB values for color. I've changed the code now so that the image texture node outputs this when the alpha output is used. Not sure this is ideal, but I can't really automate this to give correct behavior always because it depends on the node setup and the user needs to be aware of what they are doing, so this is a heuristic to try to get the correct results in typical setups.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

%%%I don't really like this change, because it seems really unintuitive that the color output changes based on
whether alpha is connected. I would rather have a convention for colors being presumed premult (or it could even be unpremult),
like in the compositor. I had thought that this was already the case and any pngs that i tried here seem to come out premultiplied
already in cycles. Note that the compositor Mix node has the same problem, there it is solved with an explicit
AlphaOver node.
Also note that this might just be an issue of better documentation/presets as such an AlphaOver node can be fairly easily
recreated with svm nodes. (something like this http://www.pasteall.org/pic/show.php?id=48679 )

till then, David.%%%

%%%I don't really like this change, because it seems really unintuitive that the color output changes based on whether alpha is connected. I would rather have a convention for colors being presumed premult (or it could even be unpremult), like in the compositor. I had thought that this was already the case and any pngs that i tried here seem to come out premultiplied already in cycles. Note that the compositor Mix node has the same problem, there it is solved with an explicit AlphaOver node. Also note that this might just be an issue of better documentation/presets as such an AlphaOver node can be fairly easily recreated with svm nodes. (something like this http://www.pasteall.org/pic/show.php?id=48679 ) till then, David.%%%
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
4 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#34679
No description provided.