- Home /
How to remove a color from texture using Shader?
Hi, I am new to shader programing. I was trying to write a shader in which when we select a _Color, that color becomes transparent. . I some how managed to write it, but its NOT perfect. How can I improve this code and add a tolerance so that colors almost identical to _Color also gets transparent. .
fixed4 fragmentFunction (v2f IN) : SV_Target{
float4 textureColor = tex2D(_MainTex, IN.uv);
if(all(textureColor==_Color)){
discard;
}
return (textureColor);
}
Comment
Your answer
Follow this Question
Related Questions
How to Fade out Custom Unity Shader ? 0 Answers
Shader: 1 Base Texture Overlaid by 1 Transparent Texture. 0 Answers
How to blend two textures? 1 Answer
How to Customize Standard Shader ( Repeating Textures in Mirror Mode ) 1 Answer
calculating 1 Answer