Search Unity

Lerp with a float3 for the weight

Discussion in 'Editor & General Support' started by HonoraryBob, Aug 12, 2020.

  1. HonoraryBob

    HonoraryBob

    Joined:
    May 26, 2011
    Posts:
    1,214
    Cg has a variation of lerp that uses a vector for the weight, but I can't find any explanation of how that works. Since the weight vector always has to equal the output, I'm assuming that it uses each component of the weight vector for the corresponding component of the two vectors being lerped together; but I've seen it used for blending textures in triplanar shaders, in which case the colors would be munged if it changed each of the RGB components according to a different weight. NVidia's documentation doesn't describe how it works in this case.