forked from bartvdbraak/blender
Fix #37333: Bad default value in Color Balance. Use independent offset/power/slope variables for the CDL mode in color balance node. This avoids stupid default values in particular for offset, which would be 1 when just using the lift value for it.
This commit is contained in:
parent
b9aa637b83
commit
b91e841f8f
@ -57,9 +57,9 @@ void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorCon
|
||||
}
|
||||
else {
|
||||
ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation();
|
||||
operationCDL->setGain(n->gain);
|
||||
operationCDL->setLift(n->lift);
|
||||
operationCDL->setGamma(n->gamma);
|
||||
operationCDL->setOffset(n->offset);
|
||||
operationCDL->setPower(n->power);
|
||||
operationCDL->setSlope(n->slope);
|
||||
operation = operationCDL;
|
||||
}
|
||||
|
||||
|
@ -61,9 +61,9 @@ void ColorBalanceASCCDLOperation::executePixel(float output[4], float x, float y
|
||||
fac = min(1.0f, fac);
|
||||
const float mfac = 1.0f - fac;
|
||||
|
||||
output[0] = mfac * inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->m_lift[0], this->m_gamma[0], this->m_gain[0]);
|
||||
output[1] = mfac * inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->m_lift[1], this->m_gamma[1], this->m_gain[1]);
|
||||
output[2] = mfac * inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->m_lift[2], this->m_gamma[2], this->m_gain[2]);
|
||||
output[0] = mfac * inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->m_offset[0], this->m_power[0], this->m_slope[0]);
|
||||
output[1] = mfac * inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->m_offset[1], this->m_power[1], this->m_slope[1]);
|
||||
output[2] = mfac * inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->m_offset[2], this->m_power[2], this->m_slope[2]);
|
||||
output[3] = inputColor[3];
|
||||
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ protected:
|
||||
SocketReader *m_inputValueOperation;
|
||||
SocketReader *m_inputColorOperation;
|
||||
|
||||
float m_gain[3];
|
||||
float m_lift[3];
|
||||
float m_gamma[3];
|
||||
float m_offset[3];
|
||||
float m_power[3];
|
||||
float m_slope[3];
|
||||
|
||||
public:
|
||||
/**
|
||||
@ -61,8 +61,8 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void setGain(float gain[3]) { copy_v3_v3(this->m_gain, gain); }
|
||||
void setLift(float lift[3]) { copy_v3_v3(this->m_lift, lift); }
|
||||
void setGamma(float gamma[3]) { copy_v3_v3(this->m_gamma, gamma); }
|
||||
void setOffset(float offset[3]) { copy_v3_v3(this->m_offset, offset); }
|
||||
void setPower(float power[3]) { copy_v3_v3(this->m_power, power); }
|
||||
void setSlope(float slope[3]) { copy_v3_v3(this->m_slope, slope); }
|
||||
};
|
||||
#endif
|
||||
|
@ -677,12 +677,12 @@ typedef struct NodeLensDist {
|
||||
} NodeLensDist;
|
||||
|
||||
typedef struct NodeColorBalance {
|
||||
/* for processing */
|
||||
/* ASC CDL parameters */
|
||||
float slope[3];
|
||||
float offset[3];
|
||||
float power[3];
|
||||
|
||||
/* for ui representation */
|
||||
/* LGG parameters */
|
||||
float lift[3];
|
||||
float gamma[3];
|
||||
float gain[3];
|
||||
|
@ -5256,14 +5256,14 @@ static void def_cmp_colorbalance(StructRNA *srna)
|
||||
|
||||
|
||||
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "lift");
|
||||
RNA_def_property_float_sdna(prop, NULL, "offset");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Offset", "Correction for Shadows");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "gamma");
|
||||
RNA_def_property_float_sdna(prop, NULL, "power");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_float_array_default(prop, default_1);
|
||||
RNA_def_property_range(prop, 0.f, FLT_MAX);
|
||||
@ -5272,7 +5272,7 @@ static void def_cmp_colorbalance(StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "gain");
|
||||
RNA_def_property_float_sdna(prop, NULL, "slope");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_float_array_default(prop, default_1);
|
||||
RNA_def_property_range(prop, 0.f, FLT_MAX);
|
||||
|
@ -53,6 +53,10 @@ static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *nod
|
||||
n->lift[0] = n->lift[1] = n->lift[2] = 1.0f;
|
||||
n->gamma[0] = n->gamma[1] = n->gamma[2] = 1.0f;
|
||||
n->gain[0] = n->gain[1] = n->gain[2] = 1.0f;
|
||||
|
||||
n->slope[0] = n->slope[1] = n->slope[2] = 1.0f;
|
||||
n->offset[0] = n->offset[1] = n->offset[2] = 0.0f;
|
||||
n->power[0] = n->power[1] = n->power[2] = 1.0f;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_colorbalance(void)
|
||||
|
Loading…
Reference in New Issue
Block a user