mirror of
https://github.com/blender/blender
synced 2026-10-25 03:07:01 +03:00
The geo nodes implementations of the `mix`, `addition`, `multiplication` and `subtraction` color mix modes are both faster and have better numerical properties than the ones we use in Cycles, OSL and EEVEE. This PR ports the geo nodes implementations of those color mix modes to Cycles, OSL and EEVEE. Additionally, the SVM mix function implementation is templatized and a new function called "endvalue_preserving_mix" is added for the alternative variant of linear interpolation. Pull Request: https://projects.blender.org/blender/blender/pulls/158022
15 lines
449 B
Text
15 lines
449 B
Text
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "node_math.h"
|
|
|
|
shader node_mix_vector(int use_clamp = 0,
|
|
float Factor = 0.5,
|
|
vector A = 0.0,
|
|
vector B = 0.0,
|
|
output vector Result = 0.0)
|
|
{
|
|
float t = (use_clamp) ? clamp(Factor, 0.0, 1.0) : Factor;
|
|
Result = endvalue_preserving_mix(A, B, t);
|
|
}
|