From f3eb5f02629673bca3a42f4d0fce4698d51d3e63 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 12 Apr 2021 15:43:51 +0200 Subject: [PATCH] filters/color-grading: Replace log10 command for GLSL (#510) --- data/effects/color-grade.effect | 4 ++-- data/effects/shared.effect | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/data/effects/color-grade.effect b/data/effects/color-grade.effect index 34ba761685..5f375e9f6d 100644 --- a/data/effects/color-grade.effect +++ b/data/effects/color-grade.effect @@ -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); diff --git a/data/effects/shared.effect b/data/effects/shared.effect index 56d4c216fe..f98e2c3257 100644 --- a/data/effects/shared.effect +++ b/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 //------------------------------------------------------------------------------