- Home /
How to create a clock down visual
Hiya folks,
I was wondering how can I get texture coordinates and distinguish where it is. If I can tell which quadrant a texture is then I can shade the texture entirely then as time progresses I can lighten it up as it rotates around.
An example is included below. Looking at the key area #5 is most visible.
Again, my only issue is I don't know how to map the pixel coordinates accordingly so I can figure it out.
Assuming a 1 second cooldown. 0.5 seconds later half of the texture should be normal texture (right side) and the other half (left side) should be darker.
*Edit:
Another important thing to note. I want to be able to control when this should be happening. Do shaders provide that kind of flexibility?
Answer by BMayne · Dec 28, 2014 at 02:51 AM
Hey there,
That is exactly what shaders are for. Shaders can work hand in hand with a script that sends it data. In this case you would send it the percent and it would use math to figure out the angle and shade the rest.
Texture coordinates or UVs are fed into the shader automatically.
Answer by tanoshimi · Dec 28, 2014 at 09:08 AM
Unity already provides a surface shader with the screen space coordinates of the fragment being rendered - look at the screenPos example here: http://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html
Your answer

Follow this Question
Related Questions
Cooldown effect in GUI 0 Answers
How to force the compilation of a shader in Unity? 5 Answers
Can i force a renderer with standard shader material to crossfade? 0 Answers
Illuminate specific parts of a texture? 1 Answer
for loop in shader 2 Answers