- Home /
Colors tint at shader
Hello. I am learning to write shaders. I need to check tints of input color.
float4 frag(v2f_img i) : COLOR {
float4 c = tex2D(_MainTex, i.uv);
float cr = c.r / _Color.r;
float cg = c.g / _Color.g;
float cb = c.b / _Color.b;
if (cr > 0.9 && cg > 0.9 && cb > 0.9) {
//smth
} else {
//smth
}
}
But this code grep more then need. Apparently I do not understand something. How to grep color tint by input color with defined range?
Comment
Your answer
Follow this Question
Related Questions
Is there a way to set an alpha color? 2 Answers
Flat Shading / No Vertex Interpolation 2 Answers
Can a CG shader fail to work on hardware? 1 Answer
How to save a variable from the shader? 0 Answers
Need help with a shader. 3 Answers