diff options
author | Matt Ebb <matt@mke3.net> | 2009-12-02 10:56:34 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-12-02 10:56:34 +0300 |
commit | b89138564eee9b576263518df0ed5dc045668f75 (patch) | |
tree | 234313b65a3715b5589f50d34aa6c6534a406d30 /source/blender/blenlib/BLI_math_color.h | |
parent | c758f6589e5d91e9fa2086a7db744282f2ea1e55 (diff) |
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
Diffstat (limited to 'source/blender/blenlib/BLI_math_color.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_color.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index b2d14f3ecbd..7444e01c3a6 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -32,10 +32,16 @@ extern "C" { #endif -#define BLI_CS_SMPTE 0 -#define BLI_CS_REC709 1 -#define BLI_CS_CIE 2 +/* primaries */ +#define BLI_XYZ_SMPTE 0 +#define BLI_XYZ_REC709_SRGB 1 +#define BLI_XYZ_CIE 2 +/* built-in profiles */ +#define BLI_PR_NONE 0 +#define BLI_PR_SRGB 1 +#define BLI_PR_REC709 2 + /******************* Conversion to RGB ********************/ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b); @@ -53,6 +59,16 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv); unsigned int rgb_to_cpack(float r, float g, float b); unsigned int hsv_to_cpack(float h, float s, float v); +/***************** Profile Transformations ********************/ + +void gamma_correct(float *c, float gamma); +float rec709_to_linearrgb(float c); +float linearrgb_to_rec709(float c); +float srgb_to_linearrgb(float c); +float linearrgb_to_srgb(float c); +void srgb_to_linearrgb_v3_v3(float *col_to, float *col_from); +void linearrgb_to_srgb_v3_v3(float *col_to, float *col_from); + /************************** Other *************************/ int constrain_rgb(float *r, float *g, float *b); |