I understand what you mean. Using Saturate\Clamp only when using 'a' (not when setting its value) is what works. Saturate is a quick way to write Clamp( value, 0.0, 1.0 ). It clamps a value to the range [0, 1]. Saturate is part of the "intrinsic functions" of the shading language. You can find the documentation (the…
I'm trying to understand something. In Cg or HLSL the Lerp function does not clamp the parameter value used to interpolate, so when the alpha value is 0.0 the result will be surprising. When alpha is zero: a = 0.0 * 2 x = lerp( B, G, a ) // x = B a -= 1 // a = -1 x = lerp( x, R, a ) // This is x*(1-a) + R*a // x is now 2*B…