Fix #111260: Resolve incorrect interface colors on macOS #111386

Closed
Jason Fielder wants to merge 2 commits from Jason-Fielder/blender:Fix_111260_UpdateDefaultWindowColorspace_MacOS_EDR into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Change default colorspace to kCGColorSpaceDisplayP3
which better represents the intended displayed color
values across all systems.

Authored by Apple: Michael Parkin-White

Change default colorspace to kCGColorSpaceDisplayP3 which better represents the intended displayed color values across all systems. Authored by Apple: Michael Parkin-White
Jason Fielder added 1 commit 2023-08-22 15:22:20 +02:00
3c5deb464a Fix #111260: Resolve incorrect interface colors on macOS
Change default colorspace to kCGColorSpaceDisplayP3
which better represents the intended displayed color
values across all systems.

Authored by Apple: Michael Parkin-White
Jason Fielder requested review from Sergey Sharybin 2023-08-22 15:22:28 +02:00
Jason Fielder added 1 commit 2023-08-22 15:23:18 +02:00

I've tested the patch and it indeed seems to solve the original problem.

Did some additional tests which includes:

  • Files from the AgX patch #106355.
  • Modifications of the red.blend from the report to see behavior of value 0.5 and 1 for red, blue, and green channels.

I could not see a visual difference between this patch and Blender 3.6. And this is making me confused. Blender outputs unclipped sRGB values, not P3. It is quite counter-intuitive to set m_metalLayer.colorspace to P3. Is there some extra compositing and conversion happens somewhere else? Or is there something completely different that I am missing?

@mano-wii Maybe you have time to test this PR on your system as well?

I've tested the patch and it indeed seems to solve the original problem. Did some additional tests which includes: * Files from the AgX patch #106355. * Modifications of the red.blend from the report to see behavior of value 0.5 and 1 for red, blue, and green channels. I could not see a visual difference between this patch and Blender 3.6. And this is making me confused. Blender outputs unclipped sRGB values, not P3. It is quite counter-intuitive to set `m_metalLayer.colorspace` to P3. Is there some extra compositing and conversion happens somewhere else? Or is there something completely different that I am missing? @mano-wii Maybe you have time to test this PR on your system as well?
First-time contributor

I've tested the patch and it indeed seems to solve the original problem.

Did some additional tests which includes:

  • Files from the AgX patch #106355.
  • Modifications of the red.blend from the report to see behavior of value 0.5 and 1 for red, blue, and green channels.

I could not see a visual difference between this patch and Blender 3.6. And this is making me confused. Blender outputs unclipped sRGB values, not P3. It is quite counter-intuitive to set m_metalLayer.colorspace to P3. Is there some extra compositing and conversion happens somewhere else? Or is there something completely different that I am missing?

@mano-wii Maybe you have time to test this PR on your system as well?

So digging into this further, 4.0.0 with the "new" patch with colorspace set to Extended SRGB appears to be displaying colours correctly as they are expected with the transform between app colour space and display color space, hence it not being pure "red".

Prior to this, no colorspace was being set, and therefore, the colorspace may be automatically determined depending on the window setup. On my M1 laptop, this appeared to be getting set to SRGB, hence why both colours appeared the same:

3.6.x: Source (255,0,0) -> Output display RGB (234, 51, 35) - No set colorspace - automatically set to kCGColorSpaceSRGB -- Output value after color transform to display.

4.0.0: Source (255,0,0) -> Output display RGB (235, 51, 36) - Set colorspace explicitly to: kCGColorSpaceExtendedSRGB -- Output value after color transform to display.

Other systems may however default to different color spaces if none is specified, in your case, the most likely would be:

3.6.x: Source (255,0,0) -> Output display RGB (255, 0, 0) - No set colorspace - automatically set to kCGColorSpaceDisplayP3 -- Output value same as no app->display transform

4.0.0: Source (255,0,0) -> Output display RGB (255, 51, 36) - Set colorspace explicitly to: kCGColorSpaceExtendedSRGB -- Output value after color transform to display.

Therefore, while it is not "correct", explicitly setting the colorspace to kCGColorSpaceDisplayP3 mirrors the old default behaviour for some systems, which may have automatically determine colorspace based on the connected display.

The one thing that will at least be consistent with the current setting of kCGColorSpaceDisplayExtendedSRGB is that colours will look uniform across all displays and configurations, as the incoming colorspace from the app is explicit.

What may therefore make the most sense is to keep the colorspace as it is, with this being the new normal, and when the time comes for Blender to render to a different colorspace, this can be updated accordingly.

For clarification on why the final display is not "pure" red:

image

This calculator tells us that a source color of (255,0,0) in SRGB space will map to (234, 51, 35) in P3 (Studio Display).

If instead you have the other "default" case where the colorspace auto-defaulted to DisplayP3, you end up with no conversion, as you can expect:

image

> I've tested the patch and it indeed seems to solve the original problem. > > Did some additional tests which includes: > * Files from the AgX patch #106355. > * Modifications of the red.blend from the report to see behavior of value 0.5 and 1 for red, blue, and green channels. > > I could not see a visual difference between this patch and Blender 3.6. And this is making me confused. Blender outputs unclipped sRGB values, not P3. It is quite counter-intuitive to set `m_metalLayer.colorspace` to P3. Is there some extra compositing and conversion happens somewhere else? Or is there something completely different that I am missing? > > @mano-wii Maybe you have time to test this PR on your system as well? So digging into this further, 4.0.0 with the "new" patch with colorspace set to Extended SRGB appears to be displaying colours correctly as they are expected with the transform between app colour space and display color space, hence it not being pure "red". Prior to this, no colorspace was being set, and therefore, the colorspace may be automatically determined depending on the window setup. On my M1 laptop, this appeared to be getting set to SRGB, hence why both colours appeared the same: 3.6.x: Source (255,0,0) -> Output display RGB (234, 51, 35) - No set colorspace - automatically set to `kCGColorSpaceSRGB` -- Output value after color transform to display. 4.0.0: Source (255,0,0) -> Output display RGB (235, 51, 36) - Set colorspace explicitly to: `kCGColorSpaceExtendedSRGB` -- Output value after color transform to display. Other systems may however default to different color spaces if none is specified, in your case, the most likely would be: 3.6.x: Source (255,0,0) -> Output display RGB (255, 0, 0) - No set colorspace - automatically set to `kCGColorSpaceDisplayP3` -- Output value same as no app->display transform 4.0.0: Source (255,0,0) -> Output display RGB (255, 51, 36) - Set colorspace explicitly to: `kCGColorSpaceExtendedSRGB` -- Output value after color transform to display. Therefore, while it is not "correct", explicitly setting the colorspace to `kCGColorSpaceDisplayP3` mirrors the old default behaviour for some systems, which may have automatically determine colorspace based on the connected display. The one thing that will at least be consistent with the current setting of `kCGColorSpaceDisplayExtendedSRGB` is that colours will look uniform across all displays and configurations, as the incoming colorspace from the app is explicit. What may therefore make the most sense is to keep the colorspace as it is, with this being the new normal, and when the time comes for Blender to render to a different colorspace, this can be updated accordingly. For clarification on why the final display is not "pure" red: ![image](/attachments/43d6f3ac-8e38-4435-8ca2-07a7267a91b2) This calculator tells us that a source color of (255,0,0) in SRGB space will map to (234, 51, 35) in P3 (Studio Display). If instead you have the other "default" case where the colorspace auto-defaulted to DisplayP3, you end up with no conversion, as you can expect: ![image](/attachments/0e7657da-ea3b-4012-8ce0-a15a300d8626)

Intuitively, and also according to the documentation the m_metalLayer.colorspace is the color space of the content of the layer. And the content Blender provides is sRGB.

Intuitively, and also according to the [documentation](https://developer.apple.com/documentation/quartzcore/cametallayer/1478170-colorspace?language=objc) the `m_metalLayer.colorspace` is the color space of the content of the layer. And the content Blender provides is sRGB.

@Michael-Parkin-White-Apple Thanks for all the information and investigation you did! it really helped a lot getting fuller understanding what's going on.

The bad news are: seems we both spent some time digging something that is not a bug, but rather proper behavior after HDR patch provided correct configuration for the Metal layer.

The good news are: now we know whats going on, and can put this topic to rest!

I've written down my findings in the bug report: #111260 (comment)

@Michael-Parkin-White-Apple Thanks for all the information and investigation you did! it really helped a lot getting fuller understanding what's going on. The bad news are: seems we both spent some time digging something that is not a bug, but rather proper behavior after HDR patch provided correct configuration for the Metal layer. The good news are: now we know whats going on, and can put this topic to rest! I've written down my findings in the bug report: https://projects.blender.org/blender/blender/issues/111260#issuecomment-1004604
Sergey Sharybin closed this pull request 2023-08-23 14:58:10 +02:00
First-time contributor

The hard coded approach of m_metalLayer.colorspace breaks all of management on macOS via OpenColorIO.

The hard coded approach of `m_metalLayer.colorspace` breaks all of management on macOS via OpenColorIO.

It is not so much of hardcoded nature of the colorspace which breaks things. If anything, now it is actually correct because the color space of the netal layer is properly configured, which allows OS to do proper conversion.

What is confusing is that there are display devices like P3/Rec.2020 which are mainly meant for the file IO at this stage, but are also shown in the scene color management settings. I was trying to hide them from scene settings, but, unfortunately, OCIO is not flexible enough to separate display devices which are intended for interop from the ones which you'd like to see in a drop-down. It is still in my list to tackle though.

It is not so much of hardcoded nature of the colorspace which breaks things. If anything, now it is actually correct because the color space of the netal layer is properly configured, which allows OS to do proper conversion. What is confusing is that there are display devices like P3/Rec.2020 which are mainly meant for the file IO at this stage, but are also shown in the scene color management settings. I was trying to hide them from scene settings, but, unfortunately, OCIO is not flexible enough to separate display devices which are intended for interop from the ones which you'd like to see in a drop-down. It is still in my list to tackle though.
First-time contributor

What is confusing is that there are display devices like P3/Rec.2020 which are mainly meant for the file IO at this stage, but are also shown in the scene color management settings.

No. They were always designed for the author to set the display medium to the display type. This is why we had that argument a decade ago with the original Xat patch; multi-head configurations require a unique display medium setting per head, for example. This was originally a part of the Xat patch, but we removed due to the manner of which the Blender side wasn’t separated enough.

It is not so much of hardcoded nature of the colorspace which breaks things. If anything, now it is actually correct because the color space of the netal layer is properly configured, which allows OS to do proper conversion.

This can’t work in a fixed authorial pipeline. It’s the wrong approach because the picture formation and presentation transforms are baked into the encoding prior to being shipped to the display medium.

Permitting the OS level management doesn’t work here, and the macOS management of this sort doesn’t work. The outputs need to be fixed and anchored, otherwise the “management” ends up leaning on the OS vendor’s ideas of what that is, and that’s rarely correct.

If anything, now it is actually correct

Nope! It’s broken with the macOS patches.

TL;DR: OpenColorIO “displays” are not for file encoding, and this breaks standard operation procedure under this lens. Further, the macOS “management” is the wrong way to go about this in my estimation, and breaks management altogether.

> What is confusing is that there are display devices like P3/Rec.2020 which are mainly meant for the file IO at this stage, but are also shown in the scene color management settings. No. They were always designed for the author to set the display medium to the display type. This is why we had that argument a decade ago with the original Xat patch; multi-head configurations require a unique display medium setting per head, for example. This was originally a part of the Xat patch, but we removed due to the manner of which the Blender side wasn’t separated enough. > It is not so much of hardcoded nature of the colorspace which breaks things. If anything, now it is actually correct because the color space of the netal layer is properly configured, which allows OS to do proper conversion. This can’t work in a fixed authorial pipeline. It’s the wrong approach because the picture formation and presentation transforms are baked into the encoding prior to being shipped to the display medium. Permitting the OS level management doesn’t work here, and the macOS management of this sort doesn’t work. The outputs need to be fixed and anchored, otherwise the “management” ends up leaning on the OS vendor’s ideas of what that is, and that’s rarely correct. > If anything, now it is actually correct Nope! It’s broken with the macOS patches. TL;DR: OpenColorIO “displays” are ***not*** for file encoding, and this breaks standard operation procedure under this lens. Further, the macOS “management” is the wrong way to go about this in my estimation, and breaks management altogether.

Pull request closed

Sign in to join this conversation.
No reviewers
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#111386
No description provided.