Color picker incorrectly clamps viewport rgb values when sampling #96269

Closed
opened 2022-03-09 19:21:17 +01:00 by tempdevnova · 16 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 431.07

Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: f1cca30557
Worked: (newest version of Blender that worked as expected)

Short description of error
When using the color picker in the viewport it doesn't pick the correct rgb values if they are greater than 1.

Exact steps for others to reproduce the error
When using the color picker in the viewport it doesn't pick the correct rgb values if they are greater than 1.
In the compositor however when the rgb values are greater than 1 the color picker doesn't have any problems at all.
In the test file below the image in the compositor is the exact scene rendered out with openexr as container, whcih natively supports HDR values.
Color_picker.blend
This means to get color samples from a brightly lit scene using standard view transform scene one has to first render it, save as Openexr, open it in the compositor before it can be sampled.
Since I'm not acquainted with the way the color picker works in Blender I canthink of two sources of the problem: Either it lies with the color picker or maybe the standard view transforms somehow clamp the values to a 0-1 range before the color picker can pick the values.
Either way I think that the fix for this problem should be rather easy.

Thank you and have a great day!

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 431.07 **Blender Version** Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: `f1cca30557` Worked: (newest version of Blender that worked as expected) **Short description of error** When using the color picker in the viewport it doesn't pick the correct rgb values if they are greater than 1. **Exact steps for others to reproduce the error** When using the color picker in the viewport it doesn't pick the correct rgb values if they are greater than 1. In the compositor however when the rgb values are greater than 1 the color picker doesn't have any problems at all. In the test file below the image in the compositor is the exact scene rendered out with openexr as container, whcih natively supports HDR values. [Color_picker.blend](https://archive.blender.org/developer/F12914536/Color_picker.blend) This means to get color samples from a brightly lit scene using standard view transform scene one has to first render it, save as Openexr, open it in the compositor before it can be sampled. Since I'm not acquainted with the way the color picker works in Blender I canthink of two sources of the problem: Either it lies with the color picker or maybe the standard view transforms somehow clamp the values to a 0-1 range before the color picker can pick the values. Either way I think that the fix for this problem should be rather easy. Thank you and have a great day!
Author

Added subscriber: @tempdevnova

Added subscriber: @tempdevnova
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Hi, thanks for the report.
I don't really see any difference in RGB values of both compositor and shader editor.
I probably have not understood the exact issue.
Do you mean color picker behaves incorrectly when RGB values of node are > 1?
What exactly are the reproducing steps?- Use color picker and get RGB values from .exr?

Hi, thanks for the report. I don't really see any difference in RGB values of both compositor and shader editor. I probably have not understood the exact issue. Do you mean color picker behaves incorrectly when RGB values of node are > 1? What exactly are the reproducing steps?- Use color picker and get RGB values from .exr?
Author

Do you mean color picker behaves incorrectly when RGB values of node are > 1? Yes exactly. When picking values in the either the viewport or the color picker clamps the egb values to a 0-1 range, so as long as the rgb values are within that range the color picker will give sample the same values in both the viewport and the compositor.
But as soon as the rgb values go above 1 the color picker samples the correct values only in the compositor while clamping the values when selected through the viewport.
What exactly are the reproducing steps?- Use color picker and get RGB values from .exr? The exr image and the viewport plane have a exactly the same 0-10 rgb gradients (normalized values). So first sample a pixel in the right half of the exr pixel this will give you values between 5-10, then try the same in the viewport on the right half of the plane. As you can then see the values will then be clamped to 1, despite them actually being higher in the scene.

`Do you mean color picker behaves incorrectly when RGB values of node are > 1?` Yes exactly. When picking values in the either the viewport or the color picker clamps the egb values to a 0-1 range, so as long as the rgb values are within that range the color picker will give sample the same values in both the viewport and the compositor. But as soon as the rgb values go above 1 the color picker samples the correct values only in the compositor while clamping the values when selected through the viewport. `What exactly are the reproducing steps?- Use color picker and get RGB values from .exr?` The exr image and the viewport plane have a exactly the same 0-10 rgb gradients (normalized values). So first sample a pixel in the right half of the exr pixel this will give you values between 5-10, then try the same in the viewport on the right half of the plane. As you can then see the values will then be clamped to 1, despite them actually being higher in the scene.
tempdevnova changed title from Color picker can't handle scene referred values to Color picker incorrectly clamps viewport rgb values when sampling 2022-03-10 15:38:46 +01:00
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Member

Added subscribers: @brecht, @lichtwerk

Added subscribers: @brecht, @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

Not entirely sure if this is needed, but clamping indeed takes place since 33bff4caef here https://developer.blender.org/diffusion/B/browse/master/source/blender/imbuf/intern/imageprocess.c$197

If I remove the clamping, values above 1.0 end up in the color picker as well (they do get converted to srgb in the process), painting with those values also works.
I am on shaky ground here, but I think these higher values could be permitted @brecht?

Not entirely sure if this is needed, but clamping indeed takes place since 33bff4caef here https://developer.blender.org/diffusion/B/browse/master/source/blender/imbuf/intern/imageprocess.c$197 If I remove the clamping, values above 1.0 end up in the color picker as well (they do get converted to srgb in the process), painting with those values also works. I am on shaky ground here, but I think these higher values could be permitted @brecht?

Changed status from 'Needs Developer To Reproduce' to: 'Archived'

Changed status from 'Needs Developer To Reproduce' to: 'Archived'

That's a known limitation. This is a general color picker that reads from the display buffer which has a view transform applied and is in the 0..1 range. There is currently just not support for picking raw scene linear values outside of specific sampling tools in paint mode, or images displayed in the image editor.

That's a known limitation. This is a general color picker that reads from the display buffer which has a view transform applied and is in the 0..1 range. There is currently just not support for picking raw scene linear values outside of specific sampling tools in paint mode, or images displayed in the image editor.
Member

@brecht: maybe I am misunderstanding, but note that the color picker can pick from float images if it finds them, see https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/sculpt_paint/paint_utils.c$477

@brecht: maybe I am misunderstanding, but note that the color picker can pick from float images if it finds them, see https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/sculpt_paint/paint_utils.c$477

Changed status from 'Archived' to: 'Needs Developer To Reproduce'

Changed status from 'Archived' to: 'Needs Developer To Reproduce'

The example .blend here has a 3D viewport open, no image in an image editor or paint mode enabled.

If the image editor case is unnecessarily clamping, that could be fixed, but seems like a different issue than what is reported?

The example .blend here has a 3D viewport open, no image in an image editor or paint mode enabled. If the image editor case is unnecessarily clamping, that could be fixed, but seems like a different issue than what is reported?
Member

Changed status from 'Needs Developer To Reproduce' to: 'Archived'

Changed status from 'Needs Developer To Reproduce' to: 'Archived'
Member

In #96269#1328680, @brecht wrote:
The example .blend here has a 3D viewport open, no image in an image editor or paint mode enabled.

Ah, sorry, I was misreading the report and the following discussion and though it was about the color sampling in texture paint (and not the color picker associated with the RGB node).
Sorry for the noise. Of course the general color picker could probably use code from paint_sample_color but that would be more of a feature request I guess.
And if I understand correctly, the color picking in texture paint is indeed unnecessarily clamping [it does have access to the float Images and not only the display buffer], but that should be reported separately.

If the image editor case is unnecessarily clamping, that could be fixed

Dont think so, sampling from the Image Editor seems fine?

but seems like a different issue than what is reported?

Yes, probably, so will close again.

> In #96269#1328680, @brecht wrote: > The example .blend here has a 3D viewport open, no image in an image editor or paint mode enabled. Ah, sorry, I was misreading the report and the following discussion and though it was about the color sampling in texture paint (and not the color picker associated with the RGB node). Sorry for the noise. Of course the general color picker could probably use code from `paint_sample_color` but that would be more of a feature request I guess. And if I understand correctly, the color picking in texture paint is indeed unnecessarily clamping [it does have access to the float Images and not only the display buffer], but that should be reported separately. > If the image editor case is unnecessarily clamping, that could be fixed Dont think so, sampling from the Image Editor seems fine? > but seems like a different issue than what is reported? Yes, probably, so will close again.
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#96269
No description provided.