From e4efa16b0079a4644380ae5a7dcc607bf692aafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Sun, 24 Jul 2016 01:04:54 +0200 Subject: Fix T48663: The Soft Light blend type layer make the color darker in the 3D view There was a misusage of the `outcol` and `texcol` params. The actual formula should have been: incol = facm * outcol + fact * ((one - outcol) * texcol * outcol + outcol * scr); To make sure the result is consistent with material mode, reuse the material blend function (mix_soft), similarly to what most other texture blend modes do. --- source/blender/gpu/shaders/gpu_shader_material.glsl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index f3bd817a7cc..845a78720ba 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1142,14 +1142,10 @@ void mtex_rgb_color(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 i void mtex_rgb_soft(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol) { - float facm; - - fact *= facg; - facm = 1.0 - fact; + vec4 col; - vec3 one = vec3(1.0); - vec3 scr = one - (one - texcol) * (one - outcol); - incol = facm * outcol + fact * ((one - texcol) * outcol * texcol + outcol * scr); + mix_soft(fact * facg, vec4(outcol, 1.0), vec4(texcol, 1.0), col); + incol.rgb = col.rgb; } void mtex_rgb_linear(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol) -- cgit v1.2.3