PNG 8bit and 16bit loads differently in compositor #102484
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#102484
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Linux-5.15.0-52-generic-x86_64-with-glibc2.35 64 Bits
Graphics card: NVIDIA GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.141.03
Blender Version
Broken: version: 3.3.0, branch: master, commit date: 2022-09-06 15:39, hash:
0759f671ce
version: 3.5.0 Alpha, branch: master, commit date: 2022-11-13 20:19, hash:
dc513a0af8c0
Since 2.92
Short description of error
I've saved one render in EXR PNG and PNG16.
EXR is good for image compositing, so that we know that it has pre-multiplied alpha. If we load it into compositor, it shows correct results, and we can note that alpha setting in image node is premultiplied by default.
But we can say what image is straight, so that Blender multiply RGB channels by alpha:
PNG16 we know has straight alpha. Blender indicates that and set alpha setting to straight by default. So that we lost glowing effect, as expected.
We can force image to be pre-multiplied by switching the setting. And in this case we can see the white border around cubes as an artifact of, shall we say, "de-premultiplication" as expected:
Now load PNG8. It loads as premultiplied even alpha setting is straight by default:
So we know that PNG8 has straight alpha. And Blender shows it as straight alpha correctly. But what is incorrect, the image itself. In fact, Blender makes "de-premultiplication" under the hood and PNG8 with alpha set to straight displays as pre-multiplied. And we can be convinced of that by changing alpha to premultiplied revealing double "de-premultiplication" (One from loading image and one because of PNG specification) or double dividing original pixels by alpha:
So in order to get correct representation of PNG8 we need to add additional alpha convert step:
So looks like this hidden "de-premultiplication" process is made for image texturing (see: https://developer.blender.org/T99701). I don't know that's happening under the hood, but it looks like that in texturing PNG's functions as straight, even then the whole "pipeline" uses pre-multiplied. So somewhere in the past someone decided to make PNG8 for texturing and PNG16 for compositing by doing this weird thing under the hood, and making this headache for future us, so that we struggle with different PNG's in one application.
Exact steps for others to reproduce the error
Images for testing:
Added subscriber: @crantisz
Added subscriber: @EAW
I can confirm. It appears that 8bit png images have been displayed in the compositor backdrop without the straight to premultiplied conversion since 2.92.
2.91.2 displayed correctly in the compositor backdrop, but then displayed incorrectly in the image editor when viewed through the viewer node.
2.90.1
2.91.2
2.92.0
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @Jeroen-Bakker
I think there are multiple level of color mess going on here. Seems like the compositor input image node doesn't apply the correct alpha association here. IMO when input image is straight the alpha should be used as a mask and the glow should be masked out.
The viewer and results seems to be correct in that case as the input colors have not been mask and are therefore part of the working color space of the compositor. In 2.92 the backdrop is able to show the pure emissive colors and therefore and wasn't able to show them at all in 2.91 and older versions. In 2.90 the pure emissive colors were introduced in the image editor.
Perhaps the introduction of pure emissive colors shows an error that already existed in blender before, but wasn't able to show it to the user.
Tagging the Compositing module as I believe the error is there.
Added subscriber: @Sergey
There is also seems to be missing conversion of alpha association in the PNG reader for the 16bit code path. The internal floating point buffer is expected to be premultiplied. A deeper look is needed.
poke…
The PNG reader seems to be correct now.
So the remaining aspect is that the Image operation only performs color space conversion, but not alpha association conversion.