filters/color-grading: Replace log10 command for GLSL (#510)

Fixes #510
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-04-12 15:43:51 +02:00
parent 2a48036e7d
commit fd3d514a20
2 changed files with 10 additions and 2 deletions

View File

@ -86,13 +86,13 @@ float3 grade_tint(float3 v) {
if (pTintMode == TINT_MODE_LINEAR) { // Linear if (pTintMode == TINT_MODE_LINEAR) { // Linear
} else if (pTintMode == TINT_MODE_EXP) { // Exp } else if (pTintMode == TINT_MODE_EXP) { // Exp
value = 1.0 - exp2(value * pTintExponent * -C_log2_e); value = 1.0 - exp2(value * pTintExponent * -C_log2_e);
} else if (pTintMode == TINT_MODE_EXP2) { // Exp2 } else if (pTintMode == TINT_MODE_EXP2) { // Exp2
value = 1.0 - exp2(value * value * pTintExponent * pTintExponent * -C_log2_e); value = 1.0 - exp2(value * value * pTintExponent * pTintExponent * -C_log2_e);
} else if (pTintMode == TINT_MODE_LOG) { // Log } else if (pTintMode == TINT_MODE_LOG) { // Log
value = (log2(value) + 2.) / 2.333333; value = (log2(value) + 2.) / 2.333333;
} else if (pTintMode == TINT_MODE_LOG10) { // Log10 } else if (pTintMode == TINT_MODE_LOG10) { // Log10
value = (log10(value) + 1.) / 2.; value = (m_log10(value) + 1.) / 2.;
} }
float3 tint = float3(0,0,0); float3 tint = float3(0,0,0);

View File

@ -1,3 +1,11 @@
//------------------------------------------------------------------------------
// HLSL/GLSL Support
//------------------------------------------------------------------------------
// OBS Studio does not correctly translate all HLSL functionality to GLSL.
// log10(x) is HLSL-exclusive and not translated by OBS Shader Parser.
#define m_log10(x) (log(x) / log(10))
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Uniforms // Uniforms
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------