GS_INPUT VSMAIN(in VS_INPUT input) { GS_INPUT output; float4 color_mid; output.position.xyz = particles[input.vertexid].position; output.position.w = 1.0; float speed = length(particles[input.vertexid].velocity); float lerpValue1 = clamp((speed / _colorSwitch)/_LowMidThresh, 0, 1); //output.color = lerp(_LowColor, _MidColor, lerpValue); color_mid = lerp(_LowColor, _MidColor, lerpValue1); float lerpValue2 = clamp((speed / _colorSwitch) / _MidHighThresh, 0, 1); output.color = lerp(color_mid, _HighColor, lerpValue2); return output; }