Using the same inage in Image Editor and Compositor makes image dark #27997

Closed
opened 2011-07-17 10:26:37 +02:00 by Sergey Sharybin · 10 comments

%%%Hi,

First of all you'll need to display both of Nodes Editor and Image editor in the same layout. Then you should open image in image editor and add Image node to compositor and attach Viewer to this Image Node. Enable Backdrop.

Everything is fine.

But if you'll make brush stroke in image editor, the whole image would become darker in image editor.

Briefly, this happens due to sequent usage of float_from_rect and rect_from_float called for the same image. Compositor works with float images, so it uses float_from_rect to produce float data. Then, when you make stroke, image editor makes changes to float image. But this image editor doesn't use float buffer for display -- it creates rect from float.

Some ideas: color profile is incorrect in ImBuf, or color correction happens twice for such sequent calculation rect from float and float from rect.

Attaching sample .blend file and original image.%%%

%%%Hi, First of all you'll need to display both of Nodes Editor and Image editor in the same layout. Then you should open image in image editor and add Image node to compositor and attach Viewer to this Image Node. Enable Backdrop. Everything is fine. But if you'll make brush stroke in image editor, the whole image would become darker in image editor. Briefly, this happens due to sequent usage of float_from_rect and rect_from_float called for the same image. Compositor works with float images, so it uses float_from_rect to produce float data. Then, when you make stroke, image editor makes changes to float image. But this image editor doesn't use float buffer for display -- it creates rect from float. Some ideas: color profile is incorrect in ImBuf, or color correction happens twice for such sequent calculation rect from float and float from rect. Attaching sample .blend file and original image.%%%
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'

%%%Hmm. I noticed that the image suddenly flips to darkness on some motion picture files and filed a bug report. I wonder if it is strictly to do with painting then?

I can't find the damn bug report. Grr.%%%

%%%Hmm. I noticed that the image suddenly flips to darkness on some motion picture files and filed a bug report. I wonder if it is strictly to do with painting then? I can't find the damn bug report. Grr.%%%

%%%attached possible fix.
this changes it so 'IB_PROFILE_SRGB' are not assumed to be 'IB_PROFILE_LINEAR_RGB'%%%

%%%attached possible fix. this changes it so 'IB_PROFILE_SRGB' are not assumed to be 'IB_PROFILE_LINEAR_RGB'%%%

%%%I should have said that I think the fix is correct, but since this changes the logic in IMB_float_from_rect(). perhaps it should be done differently.

Another way to fix would be to have the JPEG image initialize its profile as IB_PROFILE_NONE rather then IB_PROFILE_SRGB,
but JPEG/PNG/BMP/TARGA/IRIS all do this so think its best not to change that.%%%

%%%I should have said that I think the fix is correct, but since this changes the logic in IMB_float_from_rect(). perhaps it should be done differently. Another way to fix would be to have the JPEG image initialize its profile as IB_PROFILE_NONE rather then IB_PROFILE_SRGB, but JPEG/PNG/BMP/TARGA/IRIS all do this so think its best not to change that.%%%

%%%To explain whats going wrong:
byte buffer is always non linear, so initializing as IB_PROFILE_SRGB is fine.

But IMB_float_from_rect checks (ibuf->profile != IB_PROFILE_NONE) and adds a linear float buffer.

Now the image is left with a linear buffer but IB_PROFILE_SRGB which is incorrect, it should probably set the profile to linear.%%%

%%%To explain whats going wrong: byte buffer is _always_ non linear, so initializing as IB_PROFILE_SRGB is fine. But IMB_float_from_rect checks (ibuf->profile != IB_PROFILE_NONE) and adds a linear float buffer. Now the image is left with a linear buffer but IB_PROFILE_SRGB which is incorrect, it should probably set the profile to linear.%%%

%%%attached a patch which only sets the buffer to linear. this also fixes the reported bug.%%%

%%%attached a patch which only sets the buffer to linear. this also fixes the reported bug.%%%
Member

%%%Campbell: the profile flag is only to denote the format of the byte buffer. By definition the float buffer is "work space" or actually linear for us.

It should never be needed to correct float buffers either, not flag float buffers into a type.

More over; I'm unsure if when "color management" is set, the profiles should be used even... asked matt about it in another report.%%%

%%%Campbell: the profile flag is only to denote the format of the byte buffer. By definition the float buffer is "work space" or actually linear for us. It should never be needed to correct float buffers either, not flag float buffers into a type. More over; I'm unsure if when "color management" is set, the profiles should be used even... asked matt about it in another report.%%%

%%%I'll chime in here thanks to Sergey's notification in IRC.

It would seem that according to Matt's code that he opened up the potential for various color spaces to be indicated in the ImBuf.

This should be irrespective of the byte or float buffer, and this appears to be Matt's intention. A good example of this would be the VSE using a float buffer with sRGB.

While the profile connection space within Blender is assumed to be the linear space (which is a rather arbitrary one currently and should probably be more well defined), it doesn't appear that Matt's original intention is as Ton states above.%%%

%%%I'll chime in here thanks to Sergey's notification in IRC. It would seem that according to Matt's code that he opened up the potential for various color spaces to be indicated in the ImBuf. This should be irrespective of the byte or float buffer, and this appears to be Matt's intention. A good example of this would be the VSE using a float buffer with sRGB. While the profile connection space within Blender is assumed to be the linear space (which is a rather arbitrary one currently and should probably be more well defined), it doesn't appear that Matt's original intention is as Ton states above.%%%
Author
Owner

%%%This issue was resolved in tomato branch which is currently being preparing for merge into trunk. Marking the issue as resolved now. %%%

%%%This issue was resolved in tomato branch which is currently being preparing for merge into trunk. Marking the issue as resolved now. %%%
Author
Owner

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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#27997
No description provided.