Maniphest T96269

Color picker incorrectly clamps viewport rgb values when sampling
Closed, Archived

Assigned To
None
Authored By
tempdevnova (tempdevnova)
Mar 9 2022, 7:21 PM
Tags
  • BF Blender
  • Core
  • Images & Movies
Subscribers
Brecht Van Lommel (brecht)
Philipp Oeser (lichtwerk)
Pratik Borhade (PratikPB2123)
tempdevnova (tempdevnova)

Description

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: rBf1cca3055776
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.


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!

Related Objects

Mentioned Here
rB33bff4caef5e: Fix issue reported by Sebastian Koenig on irc, Clone brush would paint trash…

Event Timeline

tempdevnova (tempdevnova) created this task.Mar 9 2022, 7:21 PM
Pratik Borhade (PratikPB2123) changed the task status from Needs Triage to Needs Information from User.Mar 10 2022, 6:02 AM
Pratik Borhade (PratikPB2123) added a subscriber: Pratik Borhade (PratikPB2123).

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?

tempdevnova (tempdevnova) added a comment.Mar 10 2022, 3:37 PM

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 (tempdevnova) renamed this task from Color picker can't handle scene referred values to Color picker incorrectly clamps viewport rgb values when sampling.Mar 10 2022, 3:38 PM
tempdevnova (tempdevnova) updated the task description.
Pratik Borhade (PratikPB2123) changed the task status from Needs Information from User to Needs Triage.Mar 23 2022, 4:57 AM
Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Information from Developers.Mar 23 2022, 1:50 PM
Philipp Oeser (lichtwerk) added projects: Core, Images & Movies.
Philipp Oeser (lichtwerk) added subscribers: Brecht Van Lommel (brecht), Philipp Oeser (lichtwerk).

Not entirely sure if this is needed, but clamping indeed takes place since rB33bff4caef5e: Fix issue reported by Sebastian Koenig on irc, Clone brush would paint trash… 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 Van Lommel (brecht)?

Brecht Van Lommel (brecht) closed this task as Archived.EditedMar 23 2022, 2:37 PM

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.

Philipp Oeser (lichtwerk) added a comment.Mar 23 2022, 3:34 PM

@Brecht Van Lommel (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 Van Lommel (brecht) reopened this task as Needs Information from Developers.Mar 23 2022, 3:41 PM

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?

Philipp Oeser (lichtwerk) closed this task as Archived.Mar 23 2022, 4:04 PM
In T96269#1328680, @Brecht Van Lommel (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.