Files
test/source
Sergey Sharybin cc6a6fe893 Fix #143474: Color Space inconsistent between 2D and 3D texture paint
The short description of the root of the problem is that 2D texture
paint properly handled non-color paint while 3D painting did not (for
both painting and color sampling).

This change makes it so 3D texture paint avoids color space conversion
of brush color (which is assumed to be in display space) to scene linear
when painting on images set to Non-Color.

On the design level this change moves code closer to the following
design:
- Brush color is specified in display space.
- Float buffers are in scene linear space (or a non-color).
- When painting on color float buffers brush color gets linearized
- When painting on non-color float buffers brush color is used as-is.

For painting on non-color images it means: values from brush color
are used as-is, without any color space conversion.

The change makes 3D painting behave the same as 2D painting.

There are a couple of tricky parts remaining. Relatively small thing
is that the color displayed on the brush color swatch is not what it
will be after making a stroke. This is because brush colors are used
as-is, image is not color managed (and is drawn as-is on a surface
which is assumed to be in scene linear), and the brush color swatch
is color managed. Generally it means the swatch color is darker than
what the stroke on non-color image would look like.

The bigger topic is color sampling that read pixel value from frame
buffer. This change makes it so sampling color in such cases (by either
using eyedropper from the color swatch popup, or by using Shift-X
sampling operator outside of painting object/texture) will set brush
color in a way that making stroke will result in the same color as it
was on the screen. When painting on non-color images it means the
brush color will be sampled darker than when painting on a color
textures.

This introduces some context dependency to the way how sampling works
which might be undesirable.

Pull Request: https://projects.blender.org/blender/blender/pulls/143642
2025-08-08 17:58:44 +02:00
..