Shader Templates - Custom Shader Types
Posted: Thu Feb 08, 2018 12:29 pm
Shader Templates allow you to finally break free from standard surface shaders. No longer will you be limited to default shader types, it’s the ideal solution for custom shader pipeline requirements that take advantage of node-based shader authoring. Templates are just as regular Unity shaders but with special ASE tags placed at key points. Be sure to check the official wiki page for additional information.
* Default Unlit
* Default UI
* Default Sprites
* Particles Alpha-Blended
With templates we are aiming to fill the gap of only being able to create surface shaders. This feature allows you to create an ASE shader from an already existing shader which will be used as base, or template ( hence the feature name ).
For you to create an ASE shader using templates you can hit the right mouse button on your project view, select Create > Amplify Shader and from that menu you'll be listed with the default ASE Surface Shader plus all the available templates.
You can, at any time, swap which template your are using on a given shader by hitting the Shader Type dropdown option on your Output Node properties window and selecting a new one. You can even switch to our original default surface shader.
Mobile Friendly Templates
Sometimes what's needed is a specific vertex/frag shader that does a very simple job, for instance, particles, sprites, UI, etc. For these cases and others ASE allows the injection of shader code into pre-existing shaders that we call "templates". These are regular vertex/frag shaders that were modified by adding some tags the editor can read to know where to inject new code and what code already exists in the template.
The reason they might be important for mobile shaders is that these templates can be extremely simple with barely any code at all. If the idea is to save performance, a generic unlit template can serve as a base to build upon since these are editable inside the editor and extra features can be added either by construction a more complex graph tree or by editing the original template. The only caveat being the user must have a bit of shader knowledge to edit or create the original template shader. Fortunately ASE already provides a few templates that any user can pick and use as any other shader.
Last but not least, we already have some examples created using templates. You can find them at AmplifyShaderEditor > Examples > Official > TemplateExamples.
Learn more: Official Wiki Page
Check out Amplify Shader Editor: Asset Store Page