[Best Tool Asset Store Award] Amplify Shader Editor - Node-based Shader Creation Tool

Another bug: There’s something wrong with the register node. When I use the normalize node before the register node it works fine and the register node saves a float3 type, but if I then close the editor and open it again and save the shader it will save it as a float instead so I’m guessing the register node isn’t properly saving the type

[edit]
So I was able to correct the bug myself and continue working, unfortunately it’s still not ready, mainly because I took too much time understanding how to properly work with tangents and binormals (I’m using the editor to actually learn more about shaders as well). Anyway, the good news is that I have everything figure it out now and it shouldn’t take much now but I’m just too sleepy now, I’ll finish tomorrow, gonna hit the bed.

here’s what you can expect:

5 Likes

Wow! It’s look very cool!

Hi, here go a collection of comparison custom nodes.

On port A attach (or write) the data to compare, on port B the data to compare with, in port True the data to output if the comparison result is true and in port False the data to output if the result is false. Very easy.

Each node use the comparison operator indicated on it name:

A == B → A equal to B
A != B → A not equal to B
A > B → A greater than B
A < B → A lower than B
A >= B → A greater than or equal to B
A <= B → A lower than or equal to B

With this you have a collection of
if (A B) {

} else {

}

Some nodes could be overrides by interchanging the True - False inputs (like A == B and A != B), but i think that having one node for each operator is better to improve the readability of the shader graph.

The nodes go attached

Note: the result in the shader will be (A B ? : )

2811447–204342–TFHCCompareEqual.cs (2.02 KB)
2811447–204343–TFHCCompareNotEqual.cs (2.03 KB)
2811447–204344–TFHCCompareGreater.cs (2.02 KB)
2811447–204345–TFHCCompareLower.cs (2.02 KB)
2811447–204346–TFHCCompareGreaterEqual.cs (2.04 KB)

Here go the last comparison custom node due the 5 maximum attached files per post.

2811450–204348–TFHCCompareLowerEqual.cs (2.04 KB)

kebrus and benderete you guys are on fire! :smile:

Yes that’s a bug, local variable generation on the shader is tightly connected to when it is analysed and its really easy to break the Register Local Var / Get Local Var now that I think of.

I will have to go back to the drawing board with those nodes, take your feedback into consideration and really make them more bullet proof.

I made a second version of the burning dissolve shader. In this case using the custom nodes of comparison and translating a simple shader from code to ASE, for learning purposes

The original shader was found here:

Orriginal shader code is:

    Shader "Dissolving" {
    Properties {
      _MainTex ("Texture (RGB)", 2D) = "white" {}
      _SliceGuide ("Slice Guide (RGB)", 2D) = "white" {}
      _SliceAmount ("Slice Amount", Range(0.0, 1.0)) = 0.5


_BurnSize ("Burn Size", Range(0.0, 1.0)) = 0.15
_BurnRamp ("Burn Ramp (RGB)", 2D) = "white" {}
    }
    SubShader {
      Tags { "RenderType" = "Opaque" }
      Cull Off
      CGPROGRAM
      //if you're not planning on using shadows, remove "addshadow" for better performance
      #pragma surface surf Lambert addshadow
      struct Input {
          float2 uv_MainTex;
          float2 uv_SliceGuide;
          float _SliceAmount;
      };


      sampler2D _MainTex;
      sampler2D _SliceGuide;
      float _SliceAmount;
sampler2D _BurnRamp;
float _BurnSize;


      void surf (Input IN, inout SurfaceOutput o) {
          clip(tex2D (_SliceGuide, IN.uv_SliceGuide).rgb - _SliceAmount);
          o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
half test = tex2D (_SliceGuide, IN.uv_MainTex).rgb - _SliceAmount;
if(test < _BurnSize && _SliceAmount > 0 && _SliceAmount < 1){
    o.Emission = tex2D(_BurnRamp, float2(test *(1/_BurnSize), 0));
o.Albedo *= o.Emission;
}
      }
      ENDCG
    }
    Fallback "Diffuse"
  }

And attached is my ASE version of it.

The other version graph is more clean, but this have and additional property of Burn Size.
Mainly to test the comparison nodes to making the if-then of the emission part.



2811613–204362–DisolveBurn1.shader (5.11 KB)

1 Like

I’ve read through the thread but I feel like I’ve missed it somewhere… how can I install the custom nodes? Right now @benderete 's scripts give namespace errors.

Be sure that you have installed the last ASE update beta. You can download it from their web Page.
Then find in the assets directory in unity a folder called operators that Will be inside of one folder called nodes. Drop de scripts in the operators folder

1 Like

Thanks! It works fine now.

Amplify Shader Editor Tutorial 3 - Connecting Nodes [BETA 1]

Amplify Shader Editor - Asset Store Page

Hello!

I downloaded the beta from the website and updated my project but now it seems to crash with the following error:

AmplifyShaderEditorWindow.OnGUI () (at Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:2366)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

As I’m not expert in Unity I do not have any idea what is causing it. Anyone does?

In case someone experience the same… delete the whole folder from your project, save and execute the downloaded file… It will work again :slight_smile:

I’m really liking this tool so far!

Here’s what I got after about an hour or so:

7 Likes

:hushed: Awesome!!!

Hey there, shaders in attachament:

Notes
I’m giving you a package with two shaders and two custom nodes. I also put the materials you see in the image above and their respective textures.

The two shaders
I did the Ward anisotropic version first, only because it was the only one I have done before and funny enough it’s also the one that took me longer to do, has more dependencies and has the worst result imho xD. The other one is a circular anisotropic that I found the information online and that I thought I needed to do before attempting to do kajiya-kay which is more complex. I’m not sure if it has a specific name, I didn’t find it.

Problems
Well, again the fact that this is a surface shader is a problem in itself. I hit the maximum interpolator again so I refrained for adding extra maps, for example, both use just one normal map to distort everything so you can’t do the brushed effect with this. It should be simple to edit them and add a new normal into the anisotropic normal but doing it now fails to compile the shader correctly. The ward shader needs both a tangent and a binormal. Neither are provided by ASE so I had to create two nodes that provide the vertex version of both into the pixel shader and then do some math in the editor itself to properly calculate their pixel counterpart. Also because there’s no multiple passes yet it’s only using alpha test. With one more pass I could smooth the edges but for now it is what it is.

The textures
In my tests I noticed that good textures make a world of difference, in the beginning I was using textures provided by ASE and at some point I went looking for them on the web and the results were always poor. What you see in the image (specially the leftmost one) is the result of a few minutes in photoshop doing noise and stretching that noise with motion blur. It gives a cartoony look but I’m sure you could do better with some time in photoshop. I created the normal from the albedo texture. If you want triple A quality I would advise you to create them by using a 3D software to generate hair.

The bug
The editor has a bug that could render these shaders useless once you open them in the editor. They still work normally and you can open it and closing without saving with no problems, but at the time of writing this if you save it will break the shader. Just wait for amplify to fix it and it should be fine.

(updated link)

9 Likes

On this shader I have made a shaped texture transition with burn effect. Also the shape transition is animated with Sin Time. Some things to fix on it yet.

Wow… I hope one day I can learn from you… Impressive!

1 Like

Here go another comparison custom node:

TFHC - If

Is similar to the If node of UE4 material editor, but not the same. Let’s me know if you like how this works or if will be better an implementation equal to the UE4 one.

This node compares A with B.
If A is greater than B output the value of A > B port.
If A is equal to B output the value of A == B port.
If A is lower than B output the value of A < B port.
Equal Threshold parameter will be used to check A == B adding and subtracting this value to A (0 by default).

2812691–204476–TFHCIF.cs (3.01 KB)

Just a note for people new to shaders, don’t overdo it with conditional statements inside your shaders!
The performance of conditional statements inside shaders is a bit complicated topic, if you want to learn more about it you can start by this answer on stackoverflow.

1 Like

Hello everyone,

We updated our download system, use your Unity invoice numbers to access any of your Amplify Packages. Due to Asset Store review and submission times, the version in our own site is always the most recent.

Amplify Products - Download Page

Thanks!

1 Like