Skip to content

Commit

Permalink
filters/color-grading: Replace log10 command for GLSL (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaymar committed Apr 12, 2021
1 parent 9e6ed9a commit f3eb5f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/effects/color-grade.effect
Expand Up @@ -86,13 +86,13 @@ float3 grade_tint(float3 v) {

if (pTintMode == TINT_MODE_LINEAR) { // Linear
} 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
value = 1.0 - exp2(value * value * pTintExponent * pTintExponent * -C_log2_e);
} else if (pTintMode == TINT_MODE_LOG) { // Log
value = (log2(value) + 2.) / 2.333333;
} else if (pTintMode == TINT_MODE_LOG10) { // Log10
value = (log10(value) + 1.) / 2.;
value = (m_log10(value) + 1.) / 2.;
}

float3 tint = float3(0,0,0);
Expand Down
8 changes: 8 additions & 0 deletions data/effects/shared.effect
@@ -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
//------------------------------------------------------------------------------
Expand Down

0 comments on commit f3eb5f0

Please sign in to comment.