diff options
-rw-r--r-- | source/blender/gpu/shaders/material/gpu_shader_material_color_ramp.glsl | 9 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_valToRgb.c | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_color_ramp.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_color_ramp.glsl index 9fe45f91f45..17240da4050 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_color_ramp.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_color_ramp.glsl @@ -13,6 +13,15 @@ void valtorgb_opti_linear( outalpha = outcol.a; } +void valtorgb_opti_ease( + float fac, vec2 mulbias, vec4 color1, vec4 color2, out vec4 outcol, out float outalpha) +{ + fac = clamp(fac * mulbias.x + mulbias.y, 0.0, 1.0); + fac = fac * fac * (3.0 - 2.0 * fac); + outcol = mix(color1, color2, fac); + outalpha = outcol.a; +} + void valtorgb(float fac, sampler1DArray colormap, float layer, out vec4 outcol, out float outalpha) { outcol = texture(colormap, vec2(fac, layer)); diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index 6d2611626c2..37b2516713c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -94,6 +94,17 @@ static int gpu_shader_valtorgb(GPUMaterial *mat, GPU_uniform(&mul_bias[1]), GPU_uniform(&coba->data[0].r), GPU_uniform(&coba->data[1].r)); + case COLBAND_INTERP_EASE: + mul_bias[0] = 1.0f / (coba->data[1].pos - coba->data[0].pos); + mul_bias[1] = -mul_bias[0] * coba->data[0].pos; + return GPU_stack_link(mat, + node, + "valtorgb_opti_ease", + in, + out, + GPU_uniform(mul_bias), + GPU_uniform(&coba->data[0].r), + GPU_uniform(&coba->data[1].r)); default: break; } |