Cyclic Animation Shader

Node-based Shader Editor
Post Reply
aroig_gsn
Posts: 6
Joined: Mon Mar 05, 2018 11:19 am

Cyclic Animation Shader

Post by aroig_gsn »

Hello there! I'm new to Amplify Shader Editor. I'm trying to animate a "shine" texture to pan over my metal sprites (like swords, crowns, etc...) every now and then. And that's were I'm having problems. I got exactly what I wanted, but I think my solution is super-over-convoluted. I generated an alternating sawtooth function using time, fract and a couple of remaps to make the "shine" pan over the sprite, then wait for a few seconds before repeating.

My question is: is there an easy way to have a cyclic animation in a shader and be able to control how fast the animation plays (in this case, the shine going from side to side) and how long does the gap between cycles last?

I'm sure there's something I'm missing here :)

Thanks in advanced!
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Cyclic Animation Shader

Post by Ricardo Teixeira »

aroig_gsn wrote:Hello there! I'm new to Amplify Shader Editor. I'm trying to animate a "shine" texture to pan over my metal sprites (like swords, crowns, etc...) every now and then. And that's were I'm having problems. I got exactly what I wanted, but I think my solution is super-over-convoluted. I generated an alternating sawtooth function using time, fract and a couple of remaps to make the "shine" pan over the sprite, then wait for a few seconds before repeating.

My question is: is there an easy way to have a cyclic animation in a shader and be able to control how fast the animation plays (in this case, the shine going from side to side) and how long does the gap between cycles last?

I'm sure there's something I'm missing here :)

Thanks in advanced!
Hello,

Thank you for getting in touch, we would be happy to help.

It really depends on the actual effect that you intend to build(2D, 3d? Actual specular or overlay?), it seems that you are on the right track as the Time node is the basis for most of these types of effects.

I could recommend looking into flipbooks but I'll need more information or a sample of the intended result in order to proceed.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
aroig_gsn
Posts: 6
Joined: Mon Mar 05, 2018 11:19 am

Re: Cyclic Animation Shader

Post by aroig_gsn »

Ricardo Teixeira wrote:
aroig_gsn wrote:Hello there! I'm new to Amplify Shader Editor. I'm trying to animate a "shine" texture to pan over my metal sprites (like swords, crowns, etc...) every now and then. And that's were I'm having problems. I got exactly what I wanted, but I think my solution is super-over-convoluted. I generated an alternating sawtooth function using time, fract and a couple of remaps to make the "shine" pan over the sprite, then wait for a few seconds before repeating.

My question is: is there an easy way to have a cyclic animation in a shader and be able to control how fast the animation plays (in this case, the shine going from side to side) and how long does the gap between cycles last?

I'm sure there's something I'm missing here :)

Thanks in advanced!
Hello,

Thank you for getting in touch, we would be happy to help.

It really depends on the actual effect that you intend to build(2D, 3d? Actual specular or overlay?), it seems that you are on the right track as the Time node is the basis for most of these types of effects.

I could recommend looking into flipbooks but I'll need more information or a sample of the intended result in order to proceed.

Thanks!
Hello again! thanks for replying!

So I found a gif online that perfectly portrays what I'm after: Image . Its just that simple "light sweep" on UI sprites. Nothing more.
As I said, I've already achieved it, but my solution to trying to control the intervals duration and the "sweep" speed is super complicated.

So yeah, my problem is mostly about time, specifically intervals.

Thanks in advanced!

Adox
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Cyclic Animation Shader

Post by Amplify_Borba »

Hello, could you provide a sample so that we can provide further insight on what could be changed in order for the effect to suit your needs?

You can also check out the BurnEffect shader we provide within the ASE package, in which we make use of the Sin node with additional calculations in order to control both intensity and frequency of the effect.

On a final note, wave manipulation is a common way of achieving this type of animation in shaders, in the following video that is part of our Youtube series of tutorials we show this type of calculation in effect: https://youtu.be/zK7hqx2kdJg?t=2m3s

Please let me know if this helps, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply