Page 1 of 1

Custom Post Processing Shader for Unity 2018

PostPosted: Wed Jun 13, 2018 11:38 am
by monsieur_bas
Dear Amplify,

First of all, great tool! Switched over from Shader Forge and have been loving your tool ever since.

I'm trying to create my first post processing shader with the new Post Processing Stack and a shader made through Amplify, but i've been running into some problems. I'm OK with shaders programming on a node level, but my knowledge of shader programming is close to zero.

I've used the following this wiki as a reference: https://github.com/Unity-Technologies/PostProcessing/wiki/Writing-Custom-Effects.

When using the shader provided on the wiki everything works; when using my custom made Amplify-made shader it doesn't. It shows me a nice triangle on the middle of my screen.

The wiki states the following on shaders:
First thing to note: we don't use CG blocks anymore. If future compatibility with Scriptable Render Pipelines is important to you, do not use them as they'll break the shader when switching over because CG blocks add hidden code you don't want to the shader. Instead, use HLSL blocks.

At a minimum you'll need to include StdLib.hlsl. This holds pre-configured vertex shaders and varying structs (VertDefault, VaryingsDefault) and most of the data you need to write common effects.

Texture declaration is done using macros. To get a list of available macros we recommend you look into one of the api files in /PostProcessing/Shaders/API/.


Does this mean that Amplify is not supposed to work with these Post Processing shaders, because of the CG blocks/HLSL blocks? Or am i missing a setting somewhere.

Cheers and thanks in advance.

Re: Custom Post Processing Shader for Unity 2018

PostPosted: Thu Jun 14, 2018 9:54 am
by Amplify_Borba
Hello, thank you for the kind words and for your support!

You may create Post Processing shaders with ASE, however, you'll have to make use of a specific Shader Template, which we provide within the package, together with a few samples that provide further insight on how to set up your own effect. You may also use this template as a starting point to create your own custom shaders in order to fulfill any specific requirements!

After creating an Amplify Shader, you can change its Shader Type to Post Process through the Output Node's parameters:

Image

You may also find the post processing samples in the AmplifyShaderEditor > Examples > Official > TemplateExamples > PostProcess folder, which include a FilmGrain and a Sobel effect.

Do note that this template does not work with Unity's SRP.
We provide two other templates that support the Lightweight SRP at this time, the Lightweight PBR and Lightweight Unlit, hopefully we can add additional templates in the near future.

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

Re: Custom Post Processing Shader for Unity 2018

PostPosted: Thu Feb 07, 2019 10:53 pm
by amartinez1660
Just to clarify:
As of now, it isn't possible to make Post Process effects for the Scriptable Render Pipelines with Amplify. Is that correct?
The SRP templates provided are for mesh shaders only (unlit or PBR shaders), is that right?

Re: Custom Post Processing Shader for Unity 2018

PostPosted: Fri Feb 08, 2019 2:16 pm
by Amplify_Borba
It should be possible to use any of our templates with the SRP, including the post processing one, although you'll likely need to tweak the camera script to make use of the Command Buffer rather than the Graphics.Blit to get the render texture ( in reference to our own post processing samples ).

We haven't been able to fully test this ourselves just yet so be sure to let us know if you run into any issues, we'll be happy to assist.