- Home /
Need help with progress bar shader
Hi. I am trying to have it so when a player touches a computer, the bar fills with red starting at the left until it has hit the right side. I understand the logic behind it but am wondering what way you would recommend I go about doing this with a shader or if anyone can recommend something. For instance. here is the texture we are using:
I have looked at a bunch of shaders and couldn't figure out how they would actually apply to my situation where I just want red to fill the bar.
Can anyone explain if this shader would help me accomplish this or if they have something else that would work?
http://wiki.unity3d.com/index.php?title=Reveal_Non-Uniform_Texture
Furthermore, would it just make sense to calculate how far out the red should go based on the time the use has held the screen (a number I already have been calculating) and then if the pixel is between the y range and the x start and the x end, make it red.
What would you recommend?
Answer by raoz · Dec 22, 2012 at 10:35 PM
I would say math is the way to go here.
Ok, sorry, I meant the the last idea you brought up would make sense in this situation. If you need further help on implementing this, feel free to comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613085807im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Transparent Shader Render Order Issue 0 Answers
How to render projector in front of walls but behind player? 1 Answer
Transparent Diffuse issues 1 Answer
Always on top mask shader? 2 Answers
Shader producing a different result in-game and in-editor 0 Answers