Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-07-31 03:32:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-31 03:32:49 +0400
commita53a928773cfe15375febacaf49832aab47d9de1 (patch)
tree1a761e35392d2a20f026038c54bb5db1b1f7c6ea /source
parent11b140fb3af47dca237442d42b39a198136cc379 (diff)
Change compositor color balance to match the sequencer exactly, for this to work linear/srgb conversions need to be done which that nice since it has to convert from/to the color spaces each time, after quite a lot of testing I think its the best way to go.
The problem was that typical lift values (0.5 - 1.5, in our case ) would over saturate shadows so that even minor adjustments would give unusable results. tweaking the input lift to compensate for this helped with the shadows but would loose the color adjustments for the mid-tones.
Diffstat (limited to 'source')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
index efd49172f95..843daa49a5b 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
@@ -56,13 +56,17 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop
/* note: lift_lgg is just 2-lift */
DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma, float gain)
-{
- float x= (((in - 1.0f) * lift_lgg) + 1.0f) * gain;
+{
+ /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty
+ * but best keep it this way, sice testing for durian shows a similar calculation
+ * without lin/srgb conversions gives bad results (over-saturated shadows) with colors
+ * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */
+ float x= (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
/* prevent NaN */
if (x < 0.f) x = 0.f;
-
- return powf(x, (1.f/gamma));
+
+ return powf(srgb_to_linearrgb(x), gamma);
}
static void do_colorbalance_cdl(bNode *node, float* out, float *in)
@@ -125,15 +129,8 @@ static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack
NodeColorBalance *n= (NodeColorBalance *)node->storage;
int c;
- copy_v3_v3(n->lift_lgg, n->lift);
-
for (c = 0; c < 3; c++) {
- /* tweak to give more subtle results
- * values above 1.0 are scaled */
- if(n->lift_lgg[c] > 1.0f)
- n->lift_lgg[c] = pow(n->lift_lgg[c] - 1.0f, 2.0f) + 1.0f;
-
- n->lift_lgg[c] = 2.0f - n->lift_lgg[c];
+ n->lift_lgg[c] = 2.0f - n->lift[c];
}
}