Page 1 of 2

Template for use with custom render textures?

PostPosted: Mon Oct 15, 2018 12:44 am
by Wadewt
Hello, I am trying to make a reaction diffusion shader using ASE. You can see an example here: https://github.com/keijiro/RDSystem

The problem is that I need to use a custom render texture which requires the shader to be set up a certain way. The Unity documentation has an example shader for use with custom render textures: https://docs.unity3d.com/Manual/CustomRenderTextures.html

I tried creating a template using the guide from the ASE documentation but I am not very familiar with shader code and was unable to get it working. There's no vertex function in the Unity example shader for instance, and I was unable to figure out what to do.

I would really appreciate any help getting this to work.

Re: Template for use with custom render textures?

PostPosted: Mon Oct 15, 2018 1:55 pm
by Amplify_Borba
Hello! You're able to author shaders in ASE that make use of custom render textures, simply drag the asset into a Texture Sample node.

If you want to create a Custom Render Texture with an ASE shader, however, you should make sure that you use our Post Process template, as it is the most adequate one to be used as a base for the shader, and you'll also need to have a script on your camera with the OnRenderImage method defined in order to write to the custom render texture.
Within this method you'll need to perform a Blit operation, in which the source texture contains the current image from the frame buffer ( which is one of the parameters of the OnRenderImage method ), and the destination texture will be your Custom Render Texture.

Please let me know if this helps, thanks!

Re: Template for use with custom render textures?

PostPosted: Wed Oct 17, 2018 12:50 am
by Wadewt
I'm not sure I've quite understood you. Just to make sure we're talking about the same thing: a Custom Render Texture is different to a Render Texture; with a Custom Render Texture you can give it a material which then updates the texture. I believe this does the same thing as you described in your post, you just don't need to do the blitting or writing yourself. And then you can create a regular shader which uses the results of the Custom Render Texture.

I'm just uncertain about how to make my own template that will create a shader that the Custom Render Texture expects.

Re: Template for use with custom render textures?

PostPosted: Wed Oct 17, 2018 8:55 am
by Amplify_Borba
Apologies for my misunderstanding, you're correct in your last reply that a template will be necessary for this matter, and we'll definitely be adding an official one to the package as soon as possible.

I'll be sure to keep you posted regarding any new developments, thank you for understanding!

Re: Template for use with custom render textures?

PostPosted: Thu Oct 18, 2018 12:32 am
by Wadewt
Oooo, excellent. I can't wait! Thank you very much. :D

Re: Template for use with custom render textures?

PostPosted: Thu Oct 18, 2018 8:48 am
by Amplify_Borba
No problem, we'll be sure to get in touch as soon as we have any updates regarding this!

Re: Template for use with custom render textures?

PostPosted: Tue Nov 06, 2018 12:05 am
by Wadewt
Hello! Just wondering if there's any updates on this. Am very excited for it.

Re: Template for use with custom render textures?

PostPosted: Tue Nov 06, 2018 8:45 am
by Amplify_Borba
Hey there, we've recently added the necessary templates for this, the Custom RT Init and Update, which are Packed inside the AmplifyShaderEditor > Plugins > EditorResources > Templates > CustomRTTemplates.unitypackage.

There's also a new sample, the Custom Render Texture Rain, which is packed inside the AmplifyShaderEditor > Examples > Custom RT Samples.unitypackage, and requires both Custom RT Init and Custom RT Update templates to be imported into project first.

Apologies for not getting back to you earlier, please let us know if you come across any issues, thanks!

Re: Template for use with custom render textures?

PostPosted: Wed Nov 07, 2018 1:44 am
by Wadewt
:D Woo, thanks heaps! I'm messing about with it now, shall let you know if I have any questions.

Re: Template for use with custom render textures?

PostPosted: Wed Nov 07, 2018 11:16 am
by Wadewt
Yay, it works wonderfully. I managed to recreate Conway's Game of Life in a shader. I'm not sure I got the rules exactly right, but it proves the concept! Thanks for the template! :D
Image