diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-07-24 02:04:54 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-07-24 02:04:54 +0300 |
commit | e4efa16b0079a4644380ae5a7dcc607bf692aafc (patch) | |
tree | 30a7b7ed96dfa50ce1b15d13fe83bddb1d8fae46 /source/blender/gpu/shaders | |
parent | 4cbefde47c68aa0306df583b160c2e3103b908a7 (diff) |
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.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 10 |
1 files changed, 3 insertions, 7 deletions
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) |