[Bf-blender-cvs] [e4efa16] master: Fix T48663: The Soft Light blend type layer make the color darker in the 3D view
Kévin Dietrich
noreply at git.blender.org
Sun Jul 24 01:05:18 CEST 2016
Commit: e4efa16b0079a4644380ae5a7dcc607bf692aafc
Author: Kévin Dietrich
Date: Sun Jul 24 01:04:54 2016 +0200
Branches: master
https://developer.blender.org/rBe4efa16b0079a4644380ae5a7dcc607bf692aafc
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.
===================================================================
M source/blender/gpu/shaders/gpu_shader_material.glsl
===================================================================
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index f3bd817..845a787 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)
More information about the Bf-blender-cvs
mailing list