[Bf-committers] regarding color correction and images

Ρυακιωτάκης Αντώνης kalast at gmail.com
Thu May 26 23:44:13 CEST 2011


Hi everyone, as part of my GSOC I started working on a certain bug that has
to do with color correction and image/projection painting, In particular,
strange colors/fringes appear when painting in image/texture projection
mode. After testing it seems that the correct behavior occurs by first
converting brush color from srgb to linear rgb, doing the painting and then
converting back to srgb for display. Converting brush colors to linear rgb
is fairly easy, however there are complications when it comes to images.

Currently there is no color correction applied to texture images before they
are sent for display, with one exception: Float textures, when doing
projection painting are sent for display color-corrected. What this means is
that Imbuf->rect is filled with color corrected values.

This is all fine and well but it implies that Imbuf's used for rendering
must be linearized before rendered or used in calculations by GLSL shaders.
Is this already happening (based on Imbuf->profile flag?) or am I risking
breaking something by storing sRGB values in Imbuf->rect?

A search for IB_PROFILE_SRGB shows a result in pipeline.c that indicates
that, at least for rendering purposes this is accounted for. Is this also
true for GLSL?

Another consideration is performance: If Imbuf->rect stores sRGB values then
these will have to be converted again to linear rgb when texture painting,
lowering performance.
Another option is to store linear values in Imbuf->rect but upload sRGB
values to OpenGL. This is better performance-wise and feasible but again,
values must be converted back to linear in GLSL.

Any suggestions observations and thoughts are really welcome, since I
haven't got too much experience with all the different parts of the code and
time is precious.


More information about the Bf-committers mailing list