VIEWER: Offer premultiplied image viewing options. #28782

Closed
opened 2011-10-01 03:14:02 +02:00 by Troy Sobotka · 8 comments

%%%This patch solves a bug posted back in 2006 (http://projects.blender.org/tracker/?func=detail&group_id=9&aid=4734&atid=264) which has persisted to this day in Blender.

Premultiplied images are displayed incorrectly.

Sadly, there appears to be a disconnect between the CompBuf and rendering outputs that doesn't retain the alpha mode of the images passed. As a result, the images are always displayed as though they contain straight alpha.

This patch simply corrects this behavior by providing an artist driven toggle when preview with alpha is selected. Once selected, it changes the glBlendFunc to GL_ONE, which is correct for premultiplied images. It also includes an icon that corresponds with existing visual language within Blender.

The viewport rendering was discussed with Lukas Tonne.

%%%

%%%This patch solves a bug posted back in 2006 (http://projects.blender.org/tracker/?func=detail&group_id=9&aid=4734&atid=264) which has persisted to this day in Blender. Premultiplied images are displayed incorrectly. Sadly, there appears to be a disconnect between the CompBuf and rendering outputs that doesn't retain the alpha mode of the images passed. As a result, the images are always displayed as though they contain straight alpha. This patch simply corrects this behavior by providing an artist driven toggle when preview with alpha is selected. Once selected, it changes the glBlendFunc to GL_ONE, which is correct for premultiplied images. It also includes an icon that corresponds with existing visual language within Blender. The viewport rendering was discussed with Lukas Tonne. %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%Hmmm, my own feeling is that this state should be tracked(thus making an option redundant since it -could- be determined at runtime), but I am no node expert so leaving it up to others. I understand that this change will be a lot more intrusive, on the other hand I think it's patching things up(no pun intended :) ) since operations in the compositor/renderer will inevitably need to take premultiplied flags into account(For instance the "mix" and "add" nodes). For loaded images, your patch could be modified to check their premultiplied flag as to your previous, premultiply-predivide image patch. %%%

%%%Hmmm, my own feeling is that this state should be tracked(thus making an option redundant since it -could- be determined at runtime), but I am no node expert so leaving it up to others. I understand that this change will be a lot more intrusive, on the other hand I think it's patching things up(no pun intended :) ) since operations in the compositor/renderer will inevitably need to take premultiplied flags into account(For instance the "mix" and "add" nodes). For loaded images, your patch could be modified to check their premultiplied flag as to your previous, premultiply-predivide image patch. %%%
Author

%%%I originally thought that as well but I completely disagree now.

The scenario is that it is entirely likely an artist is hand crafting their own alpha and performing their own over operations using math nodes.

In this scenario, much like predivide, the artist would require the granularity to set the viewing option based on their crafted image.

The same would go for log transforms or any other custom image crafting.

It is impossible for the compositor to know these things, and would require some nasty manual flag setting in the nodes.

In all cases, it would be manual.%%%

%%%I originally thought that as well but I completely disagree now. The scenario is that it is entirely likely an artist is hand crafting their own alpha and performing their own over operations using math nodes. In this scenario, much like predivide, the artist would require the granularity to set the viewing option based on their crafted image. The same would go for log transforms or any other custom image crafting. It is impossible for the compositor to know these things, and would require some nasty manual flag setting in the nodes. In all cases, it would be manual.%%%

%%%I don't think this is option is implemented in the right place. In my opinion images and render / compositing output buffers should have information about the buffer using premultiplied or key alpha, and based on that draw the right way. It's true that in compositing it is possible to create an image with either format, but then a scene option should be made to say that the render result image is premul or key. The reason being that not only image drawing should take this into account, but also color management transform and file saving. Specifying this once (and in most cases determining it automatic even from the file, or from the scene setting to render premul/key) would be a better solution.

The color management predivide option I can understand for backwards compatibility reasons, but this option is really working around a deeper problem.%%%

%%%I don't think this is option is implemented in the right place. In my opinion images and render / compositing output buffers should have information about the buffer using premultiplied or key alpha, and based on that draw the right way. It's true that in compositing it is possible to create an image with either format, but then a scene option should be made to say that the render result image is premul or key. The reason being that not only image drawing should take this into account, but also color management transform and file saving. Specifying this once (and in most cases determining it automatic even from the file, or from the scene setting to render premul/key) would be a better solution. The color management predivide option I can understand for backwards compatibility reasons, but this option is really working around a deeper problem.%%%
Author

%%%The only issue I can see with flags is when a comp or series fails to be set and the result it out.

I will look into CompBuf but there are countless areas where manual overrides make sense. For example, what is the result of a comp using straight and premul for whatever reason? It is difficult to read the mind of the artist using the software, and more often than not, giving them control is rarely a bad thing.%%%

%%%The only issue I can see with flags is when a comp or series fails to be set and the result it out. I will look into CompBuf but there are countless areas where manual overrides make sense. For example, what is the result of a comp using straight and premul for whatever reason? It is difficult to read the mind of the artist using the software, and more often than not, giving them control is rarely a bad thing.%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sergey Sharybin self-assigned this 2015-03-25 16:49:27 +01:00

Think this one does not make much sense now.

First of all, compo is expected to output premultiplied alpha. Second of all, there's now option to ignore alpha in the viewer.

The only reason why it might be handy is to investigate intermediate buffers which could be straight alpha (i.e. buffers after keying nodes) but this shouldn't be done as a viewer node option and instead alpha type should be passed via noodles, so we always know for fact which alpha we're looking at.

Thanks for the patch anyway.

Think this one does not make much sense now. First of all, compo is expected to output premultiplied alpha. Second of all, there's now option to ignore alpha in the viewer. The only reason why it might be handy is to investigate intermediate buffers which could be straight alpha (i.e. buffers after keying nodes) but this shouldn't be done as a viewer node option and instead alpha type should be passed via noodles, so we always know for fact which alpha we're looking at. Thanks for the patch anyway.
Author

2018 and the viewer is still broken peeps. Can we fix it please?

2018 and the viewer is still broken peeps. Can we fix it please?
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#28782
No description provided.