Page 1 of 1

Animate Shader Materials

PostPosted: Wed May 02, 2018 6:20 am
by Yoshinjo
Hello,

I'm still learning quite a bit of Amplify Shader, so this might be a mundane/dumb question. I've been searching the internet and came up with very little and thus I thought I would cut to the chase and ask other users or devs of Amplify Shader.

Question: Is there a way to animate the shader's material properties through the animator and not through coding? I know obviously for programmers, this would be the easiest solution however I am an artist and want to keyframe other elements to sync with the shader setting changes.

Your help is greatly appreciated! Thanks in advance.

Re: Animate Shader Materials

PostPosted: Wed May 02, 2018 4:06 pm
by Amplify_Borba
Hey there, there's no such thing as mundane questions, we're always happy to help!

It's possible to animate values through the animator, but you need to have them set to property first, so that the value becomes available in the properties of the material that uses the shader and can be changed in the material inspector or by script, and then you may add them to your animation through Add Property.

PropertyAnimate.jpg
PropertyAnimate.jpg (147.73 KiB) Viewed 3103 times


Please let me know if this helps, thanks!

Re: Animate Shader Materials

PostPosted: Wed May 02, 2018 7:42 pm
by Yoshinjo
Hey Borba,
I appreciate the fast response! I probably should have been more explicit about what I'm trying to do.. Basically I want to have a UI image with a material shader attached to the image and be able to animate the properties through the animation editor. As far as I know (from my internet research and tinkering in Unity) I have been unable to access the material properties in animation, unless I use the process you proposed. For 3D objects this works fine, you can access the material properties through the mesh renderer in the animation editor, but for UI I can't figure out how to accomplish this because you can't access the properties through the animation editor.

Re: Animate Shader Materials

PostPosted: Thu May 03, 2018 10:31 am
by Ricardo Teixeira
Yoshinjo wrote:Hey Borba,
I appreciate the fast response! I probably should have been more explicit about what I'm trying to do.. Basically I want to have a UI image with a material shader attached to the image and be able to animate the properties through the animation editor. As far as I know (from my internet research and tinkering in Unity) I have been unable to access the material properties in animation, unless I use the process you proposed. For 3D objects this works fine, you can access the material properties through the mesh renderer in the animation editor, but for UI I can't figure out how to accomplish this because you can't access the properties through the animation editor.


Hello,

Unfortunately, you can't animate UI material properties; this is the case with all shaders, not just with content created with ASE. However, you can create a simple script that feeds values directly into your shader and animate that.

I recommend checking the smear sample, it's a great starting point!

Thanks!

Re: Animate Shader Materials

PostPosted: Thu May 03, 2018 6:25 pm
by Yoshinjo
@Ricardo Teixeira,

Thank you for the reply! I figured this was the case. I need to learn how to code :D I was thinking of an alternative... Basically make the material shader have a input for transition time and animate the game object active/inactive state. I'm playing around with this now (just for expanding my knowledge of shaders, probably not the most efficient, as you said a script would probably be the way to go). Thanks again!

Re: Animate Shader Materials

PostPosted: Fri May 04, 2018 11:22 am
by Ricardo Teixeira
Yoshinjo wrote:@Ricardo Teixeira,

Thank you for the reply! I figured this was the case. I need to learn how to code :D I was thinking of an alternative... Basically make the material shader have a input for transition time and animate the game object active/inactive state. I'm playing around with this now (just for expanding my knowledge of shaders, probably not the most efficient, as you said a script would probably be the way to go). Thanks again!


No problem, happy to help!

I hope you find a viable solution, in the meantime feel free to use the attached sample as a starting point.

Don't forget to review and rate ASE, your feedback is extremely important to us.

Thanks!