- Home /
How would I add an alpha mask to this shader?
Hi,
So I got this shader that changes colors of the maintex by using a colormask. All works well and good, but I want to exclude some bits of the maintex, so the color on an alpha masked area does not change to whatever color I set.
To show you what I mean, I've attached the shader, as well as an example texture. If you put the shader on a default cube and add the texture to both maintex and color mask slots, you can see that changing the colors in the shader changes everything in the texture. This is good, but I'd like to mask out the two lines and circles in the texture, so that they stay the same color no matter what.
To do this I added an alpha channel to the texture, with the circles and lines blacked out. Now I just need to make sure that these areas are actually masked, and not used when changing the colors. Could anybody help me do this?
Thanks in advance,
Nick
Answer by SomeRandomGuy · Oct 30, 2014 at 07:15 PM
Okay I managed to make it work using this:
col = lerp(col2, col, col2.a);
just below the other 3 lerps. pretty straightforward after all..I'm still not entirely happy with the way it works now, as it allows for some strange edges around the lines/circles. But maybe I can fix that in the alpha mask..
Your answer
Follow this Question
Related Questions
Alpha-based Color Mask 2 Answers
Is there a way to set an alpha color? 2 Answers
shader problem 0 Answers
Shader that does per Vert alpha with co 0 Answers
Strange artifacts on Vertex Color Shader 0 Answers