0
$\begingroup$
void mix_blend(float fac, vec4 col1, vec4 col2, out vec4 outcol)
{
  fac = clamp(fac, 0.0, 1.0);
  outcol = **mix**(col1, col2, fac);
  outcol.a = col1.a;
}

I want to know how the mix works in the code above. I think it's a function, but I can't find where it is. I think blender is mixing by adjusting col1, col2, and fac value, but I want to know the detailed logic.

void mix_mult(float fac, vec4 col1, vec4 col2, out vec4 outcol)
{
  fac = **clamp**(fac, 0.0, 1.0);
  outcol = mix(col1, col1 * col2, fac);
  outcol.a = col1.a;
}

I want to know how the clamp function works in the code above.

$\endgroup$
0
$\begingroup$

source code material.c ctrl+f "blend"

https://github.com/blender/blender/blob/master/source/blender/blenkernel/intern/material.c

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.