Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/gpu/intern/gpu_material.c6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl32
-rw-r--r--source/blender/makesdna/DNA_texture_types.h1
3 files changed, 38 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 1750d3142d9..81dcd9cf450 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -944,6 +944,12 @@ static void texture_rgb_blend(GPUMaterial *mat, GPUNodeLink *tex, GPUNodeLink *o
case MTEX_BLEND_COLOR:
GPU_link(mat, "mtex_rgb_color", out, tex, fact, facg, in);
break;
+ case MTEX_SOFT_LIGHT:
+ GPU_link(mat, "mtex_rgb_soft", out, tex, fact, facg, in);
+ break;
+ case MTEX_LIN_LIGHT:
+ GPU_link(mat, "mtex_rgb_linear", out, tex, fact, facg, in);
+ break;
default:
GPU_link(mat, "set_rgb_zero", &in);
break;
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index fb364018282..fe0c7c2b715 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -1012,6 +1012,38 @@ void mtex_rgb_color(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 i
incol.rgb = col.rgb;
}
+void mtex_rgb_soft(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
+{
+ float facm;
+
+ fact *= facg;
+ facm = 1.0-fact;
+
+ vec3 one = vec3(1.0);
+ vec3 scr = one - (one - texcol)*(one - outcol);
+ incol = facm*outcol + fact*((one - texcol)*outcol*texcol + outcol*scr);
+}
+
+void mtex_rgb_linear(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
+{
+ fact *= facg;
+
+ if(texcol.r > 0.5)
+ incol.r = outcol.r + fact*(2.0*(texcol.r - 0.5));
+ else
+ incol.r = outcol.r + fact*(2.0*(texcol.r) - 1.0);
+
+ if(texcol.g > 0.5)
+ incol.g = outcol.g + fact*(2.0*(texcol.g - 0.5));
+ else
+ incol.g = outcol.g + fact*(2.0*(texcol.g) - 1.0);
+
+ if(texcol.b > 0.5)
+ incol.b = outcol.b + fact*(2.0*(texcol.b - 0.5));
+ else
+ incol.b = outcol.b + fact*(2.0*(texcol.b) - 1.0);
+}
+
void mtex_value_vars(inout float fact, float facg, out float facm)
{
fact *= abs(facg);
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 059a12bae8b..d256cfb2e85 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -501,7 +501,6 @@ typedef struct ColorMapping {
#define MTEX_BLEND_SAT 11
#define MTEX_BLEND_VAL 12
#define MTEX_BLEND_COLOR 13
-/* free for use */
#define MTEX_SOFT_LIGHT 15
#define MTEX_LIN_LIGHT 16