Page 1 of 1

Using sample effects (eg. Animated Fire) with SpriteRenderer

PostPosted: Fri Sep 28, 2018 9:48 am
by Unibreaker
Hi!

I recently bought Amplify Shader Editor after much deliberation and the tool just looks so powerful. I am building a top down RPG with 2D sprites in 3D space, so I can leverage on real 3D shadows and dynamic lighting. It's similar to Dungeon of the Endless in terms of how the sprites are set up.

I was looking at all the sample effects in the asset, like burn and animated fire. I really want to use these effects when using a sprite renderer as this has been my workflow thus far. I don't really want to use Mesh Renderer's as I'm not as familiar with them.

When I try to apply the sample shader to the sprite renderer I get a warning saying "Material does not have a _MainTex texture property. It is required for sprite renderer". How do I use the sample effects with sprite renderers? What do I have to do?

Thank you!

Re: Using sample effects (eg. Animated Fire) with SpriteRend

PostPosted: Fri Sep 28, 2018 10:19 am
by Amplify_Borba
Hello, thank you for your support!

You'll need to make use of our Shader Templates system in order to author shaders for use with Unity's sprite system. It should be possible to adapt and convert most effects, but some might require some additional work, depending on how you want to create them.

We already provide a template that you can use as a base for your sprite shaders, which you can access through the 'Shader Type' drop-down list:

Image

There are also two sprite specific samples provided within the ASE package, which you can find in the AmplifyShaderEditor \ Examples \ Official \ TemplateExamples \ Sprites folder.

Furthermore, the '_MainTex' property can be accessed through the 'Template Parameter' node, which is specific for shader templates, and allows access to shader properties and global variables declared over the Template shader.

Please let me know if this helps, and feel free to let us know if you have any further questions, thanks!

Re: Using sample effects (eg. Animated Fire) with SpriteRend

PostPosted: Sun Sep 30, 2018 7:28 am
by Unibreaker
Hi!

Thanks for the quick reply. I'm glad to know it is possible, but I've search the documentation and online and I've been struggling to make any progress on converting the sample assets like Dissolve Burn to work with a sprite renderer.

Are there any resources of someone converting a sample asset into a sprite shader? Seeing one example would be all I need to understand the concepts of how to do so and right now it seems quite overwhelming. For instance, how do I let my sprite renderer be affected by dynamic lighting? I've used the Unity Standard Shader so far and it worked well but since using the Default Sprite Template for Amplify I don't seem to know how to make it work. Maybe I could find a way to make the Amplify Surface Shader work with Sprite Renderers instead of using the Default Sprite Template?

Do you have any idea what documentation I should read first? What knowledge base should I definitely know before attempting this?

Re: Using sample effects (eg. Animated Fire) with SpriteRend

PostPosted: Mon Oct 01, 2018 10:39 am
by Ricardo Teixeira
Unibreaker wrote:Hi!
Thanks for the quick reply. I'm glad to know it is possible, but I've search the documentation and online and I've been struggling to make any progress on converting the sample assets like Dissolve Burn to work with a sprite renderer.
Are there any resources of someone converting a sample asset into a sprite shader? Seeing one example would be all I need to understand the concepts of how to do so and right now it seems quite overwhelming. For instance, how do I let my sprite renderer be affected by dynamic lighting? I've used the Unity Standard Shader so far and it worked well but since using the Default Sprite Template for Amplify I don't seem to know how to make it work. Maybe I could find a way to make the Amplify Surface Shader work with Sprite Renderers instead of using the Default Sprite Template?
Do you have any idea what documentation I should read first? What knowledge base should I definitely know before attempting this?


Hello,

I'm afraid creating those types of shaders goes a bit beyond a node setup, for different results you require unique Shader Templates. If you want to dive deep into shader development the best place to start would be the Template documentation.

Do consider that making your own custom template or do the light calculations yourself can be a bit overwhelming if you're a beginner to shader development. However, you can always use a Standard Surface shader since it gives you access to all of Unity's Light Models through a few clicks.

As the screenshot shared below, be sure to adde a Texture Sample with its property name set to _MainTex, connected it to the Albedo port.

Image