Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

Discussion in 'Assets and Asset Store' started by Amplify_Ricardo, Sep 13, 2016.

  1. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    513
    Hi guys,


    I just uploaded a new build into the beta area with some of the reported issues already fixed.

    Here are the release notes:

    Release Notes v0.1.4 dev 001:

    • Fixed issue with order index not being correctly read/written
    • Redone Refraction Shader according to rea suggestion
    • Register Local Var node now has a title style similar to Property Nodes with the local var name always visible
    • Added Get Local Var Node. It allows the user to use already registered local vars anywhere in the graph
    • Added Custom Node Remap ("TFHC - Remap") created by user benderete
    • Fixed issue on Texture Sample UV port not correctly casting to float2 when needed
    • Fixed issue with Texture Sample node not adapting layout when reference is in normal mode
    It's really quite awesome when we add community contributions into ASE. Thank you benderete for your Remap node!

    I really wanted to say soon but it might take a while until we have some sort of documentation regarding how to extend ASE.

    Thank you for your suggestion! We will add it to the Community Suggestions area on our roadmap.
     
    benderete likes this.
  2. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,744
    Hello,

    Thank you for your interest, we really appreciate it. It's a one time purchase, you will have access to all major beta updates and the final version. The price will increase slightly with every major beta update.

    Thanks!
     
  3. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    ;) You are welcome!
    ... and the best of all... is great don't worry about backup the custom node before upgrade XD XD XD XD

    Yes, I assumed that is something to arrive after final release o close to it
     
  4. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    I am loving all of this examples... very close to UE4 and what I am used to working with. With this, I don't have to wait for shader programmers to fix problems. I do have a question, and it involves shader models and lighting...

    The first question is, will this shader editor support the GGX shading model that is currently used by Alloy? So if and when I decide to move to this editor, I won't have to do any kind of repaint work on my model, especially with the details I have.

    The next question is in regards to the subsurface scattering model (I think Pre integrated comes to mind). Will I be able to do things like have diffuse blurring of the normals to get that very soft look (think Paragon or Uncharted 4)

    And lastly, how easily will it to be to create shaders for things like hair (using Kajiya-Kay or Marschner shading models)? I am primarily a character artist, and I also use Substance Designer for stuff like dynamic textures... I hope these will be supported.
     
  5. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    This is a simple example of burn dissolve shader.
    Yep, using the Remap node.
    Really i don't know if everything is ok or not in this shader. I'm very noob in shaders creation and for learning purposes i have "translated" a youtube tutorial for ShaderForge to Amplify Shader Editor. In the tutorial they use the Remap node, and this was the reason of write it :)





    Edit:
    Uploaded the shader file and the images that i made for Dissolve Guide and Burn Ramp.
    Waiting improvements from shader pros to learn ;)
     

    Attached Files:

    Last edited: Oct 3, 2016
  6. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,997
    This is beautiful... very useful for things burning into a crisp, or for cutscenes where the character get eaten or parasites
     
    benderete likes this.
  7. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,744
    Amplify Shader Editor Tutorial 2 - Material and Shader Mode [BETA 1]


    Amplify Shader Editor - Asset Store Page
     
  8. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    1. Isn't GGX what unity currently uses internally? I think I read that somewhere. If it is, since ASE is only doing surface shaders for now that means it uses whatever unity uses.

    2. I'm pretty sure they want to support stuff like that, they currently don't for the same reason of the first question, they are only generating surface shaders, so no custom lighting for now. Thats something they already have on their roadmap and it's one of the big updates for this editor. For now tho, people can create the custom node and simulate it in the emission map, not very efficient but at least cuts some time for when the custom lighting comes.

    3. Finally, they don't have anything anisotropic yet, so no shiny kajiya-kay :\ but I don't mind creating a simple anisotropic node. I could even create those two some time later. If you have a nice free hair model laying around please PM me. I'll be working on it tonight
     
    Shodan0101, KRGraphics and hopeful like this.
  9. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    135
    Yes that is correct, currently Unity 5.3. and up has GGX shading/BRDF vs the old normalized Phong shading.
     
    kebrus likes this.
  10. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    135
    Its super later / super early in the morning here...I manged to purchase the asset so excited to start but to tired to continue, Im broke now... tight indie budget ;) I just wanted to thank Ricard and the Amplify team for creating this awesome asset!! Love you guys and the community contributing so much insane stuff, fixing bugs and adding new cool features, my brain is melting!! Love you guys!!
     
  11. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    HOLY S***! This took me much longer than I wanted.

    Here's a sneak peak:
    anisotropic.PNG
    So first of all, it's not finished yet. Don't worry, I'll release it when I'm done, I still have some things to test and others to optimize but the most basic anisotropic effect is done, I'm just too tired to continue for today.

    This took me forever to do and this is because I was hit by two weird bugs that took me a long time to figure them out. One is from the editor, the error is straight forward but hard to detect, basically if you use a node that has multiple inputs and you leave one or more of them empty it simply fails to compile for some reason. I would do stuff like using a "multiply" where the second input would be "-1" that I would type in the node property, thats a big no no. You have to create a float node and give it the value you want instead. I now believe that the error I reported a few days earlier about duplicating nodes is this one in disguise because I would duplicate nodes and leave parts of them empty and it would fail to compile for no reason and I thought the error was the duplication.

    The other error I found, and this is a weird one, is about the view direction node. I understand the vector comes from unity standard inputs but this vector breaks itself apart if you do something very specific. Just output this node directly in the emission channel (not the debug, this is important) and then add a texture sample for normals and connect it with the normal channel. Now magic happens. If you have a normal map linked the view vector simply gets all weird, if you disconnect the normal it gets okay again. Took me so long to find this bug because I never thought something this simple would produce such different results. I got the way around it by calculating the vector manually and suddenly everything worked as it should.

    I need to get some sleep now, I update this shader later.
     
    AlanMattano, KRGraphics, MS80 and 3 others like this.
  12. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    532
    Great! I just bought it.
    I don't have any knowledge about shader and i'll try to learn from this one.
     
    Shodan0101 likes this.
  13. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    I had the same problem with the Lerp Node. Writing values in node properties raises errors and i finally create float nodes attached to it.

    Welcome to the shaders noob side with me ;)
     
    Shodan0101 likes this.
  14. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    513
    Hi KRGraphics,
    Thank you so much for taking interest on ASE!
    And I apologize for the late reply.
    Like kebrus and GMax said, yes it uses GGX. Since 5.3 that Unity switched to GGX. Here's the official blog post from them.
    For this first beta we are aiming to provide a good core experience. Unfortunately like already commented, on this first beta stage you can only create standard surface shaders but one of our main goals with this plugin it to provide a good platform for the users to add their custom light models and easily expand the editors capabilities for what they need.

    Damn! benderete your new shader is Hot! Literally! :D

    I'll be bug hunting today in order to see what might by happening and upload a fixed version as soon as it is fixed. I'm quite sure this is related to benderete issue since these nodes inherits from the same parent.
    If you come across this issue please send me the buggy shader via PM. I would thank you greatly.

    It seems that the view vector is somewhat being transformed to tangent space when doing that. But I'll have to further investigate what is happening.

    Guys, if you come across any strange behavior, shader or console errors related with your ASE shaders please send them to me via PM ( with a description on what is happening ) so we can take a look and figure out what is the issue. We would really like to help you and you also would really be helping us track new possible bugs.
     
    Last edited: Oct 4, 2016
    kebrus likes this.
  15. Skyfly

    Skyfly

    Joined:
    Jan 25, 2014
    Posts:
    102
    Hey there,

    can you give a little insight on what you have planned for mobile? Will this tool allow for optimized mobile shaders without digging through code and keywords ourselves?
     
  16. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    571
    That image sold me on ASE. I have Shader Forge, but what I miss is nesting nodes and/or area commenting. For me it's not so much about exporting of a group of nodes for use in other shaders (there's an extension for that), but mostly the overview and organization within a shader.

    The Shader Forge dev doesn't know if a node nesting with its limitations is worth it: User defined nodes to encapsulate frequently used functions. Therefore node nesting won't be implemented any time soon in Shader Forge, so ASE with the Commentary node already has an advantage there.

    Collapsing/Expanding nodes is already in the Community Suggestions list. I wonder if that could also work with the Commentary node. I want to group a few nodes, collapse the group so I don't break anything within, then move it around. However, it's probably going to be a little tricky to handle expanding though with surrounding nodes.

    I would like to add the suggestion that duplicating a Commentary node also duplicates its content.
     
    Shodan0101 likes this.
  17. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    Yes, the comment node is very usefull for readibility (pherphaps it must be renamed grouping node :D), and you can create a comment containing other comments.
    Copy comment with all its content and collapse it would be greats improvements.
    Also i think that exists an user suggestion included on their roadmap about "portal nodes": a "link"/"alias" node to connect nodes without messing lines. It will be awesome too.
     
    Shodan0101 likes this.
  18. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    532
    Anyone knows where should i getting started to learn ?
    I may understand practicing for example for codes, but the shaders... i have no clue whats happening in there :confused:
     
  19. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    571
    Oh yeah, that's also an option. I've seen such an alternative to grouping with Get and Set nodes in this Shader Forge simple blur shader tutorial:



    But it would still be useful to have groups that can be collapsed. With only Get and Set you need to pan and zoom around a lot.

    It looks like ASE's Commentary node has been modeled after Unreal Engine Blueprints' Comment Box. But in UE4 they are not really intended for reuse, instead there are functions and macros.
     
  20. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    Hi, This is an update of custom Remap Node.
    I have seen that i wasn't change the 2 to 4 input ports data type to match the 0 input port.

    I think that now is correct with the lines:

    m_inputPorts[ 1 ].ChangeType( InputPorts[ 0 ].DataType, false );
    m_inputPorts[ 2 ].ChangeType( InputPorts[ 0 ].DataType, false );
    m_inputPorts[ 3 ].ChangeType( InputPorts[ 0 ].DataType, false );
    m_inputPorts[ 4 ].ChangeType( InputPorts[ 0 ].DataType, false );



    Coding "by approximation" falls in those silly errors :D

    Code (CSharp):
    1. // Amplify Shader Editor - Visual Shader Editing Tool
    2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
    3. //
    4. // Custom Node Remap by The Four Headed Cat - @fourheadedcat
    5. using UnityEngine;
    6. using System;
    7. namespace AmplifyShaderEditor
    8. {
    9.     [Serializable]
    10.     [NodeAttributes( "TFHC - Remap", "Operators", "Remap value from old min - max range to new min - max range", null, KeyCode.None )]
    11.     public sealed class TFHCRemap : DynamicTypeNode
    12.     {
    13.  
    14.         protected override void CommonInit( int uniqueId )
    15.         {
    16.             base.CommonInit( uniqueId );
    17.             m_inputPorts[ 0 ].Name = "Value";
    18.             m_inputPorts[ 1 ].Name = "Min Old";
    19.             AddInputPort( WirePortDataType.FLOAT, false, "Max Old" );
    20.             AddInputPort( WirePortDataType.FLOAT, false, "Min New" );
    21.             AddInputPort( WirePortDataType.FLOAT, false, "Max New" );
    22.             m_textLabelWidth = 100;
    23.             m_useInternalPortData = true;
    24.         }
    25.  
    26.         public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true )
    27.         {
    28.             base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode );
    29.             m_inputPorts[ 0 ].MatchPortToConnection();
    30.             m_inputPorts[ 1 ].ChangeType( InputPorts[ 0 ].DataType, false );
    31.             m_inputPorts[ 2 ].ChangeType( InputPorts[ 0 ].DataType, false );
    32.             m_inputPorts[ 3 ].ChangeType( InputPorts[ 0 ].DataType, false );
    33.             m_inputPorts[ 4 ].ChangeType( InputPorts[ 0 ].DataType, false );
    34.             m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false );
    35.         }
    36.  
    37.         public override string GenerateShaderForOutput( int outputId, WirePortDataType inputPortType, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
    38.         {
    39.             string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    40.             string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    41.             string c = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    42.             string d = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    43.             string e = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    44.             string strout = "(" + d + " + (" + a + " - " + b + ") * (" + e + " - " + d + ") / (" + c + " - " + b + "))";
    45.             //Debug.Log (strout);
    46.             return strout;
    47.  
    48.         }
    49.     }
    50. }
     
  21. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    513
    Hi Skyfly,
    Thank you so much for taking interest on ASE!
    On a more general sense we are aiming to give the user tools on later beta stages to create/specify LODs and Fallbacks from within the Editor.

    I do like this suggestion. I'll place it on our roadmap.

    You can already sort of do that with the 'Get Local Var' node. It allows you to pick a local variables created via the Register Local Var node and use it anywhere in the graph.

    I've uploaded a new build today at the Beta area with some fixes on the source code affecting nodes like 'Multiply' and
    'Lerp'.

    Also, benderete I've already included your Remap updated version. Thank you so much for sharing it!
     
    benderete likes this.
  22. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    back on track

    Quick bug? the "get local var" node only works if the register node is being used somewhere, or else it wont generate the code being the register node.
     
  23. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    513
    This is not really a bug. Only nodes connected to the master node gets analyzed and generate code.
    What I can do though is open/create an exception on these setter nodes and make them always analyzed.
     
  24. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    Edit: Changed Node Name and ports tags

    Another Custom Node: Compare With Range

    This time is a Node that receive a value and check if is in a range defined by Range Min and Range Max ports. If true, return the value attached to the true port, if not return the attached to the false port. Well, attached or wrote in properties.

    Code (CSharp):
    1. // Amplify Shader Editor - Visual Shader Editing Tool
    2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
    3. //
    4. // Custom Node Compare With Range by The Four Headed Cat - @fourheadedcat
    5.  
    6. using UnityEngine;
    7. using System;
    8.  
    9. namespace AmplifyShaderEditor
    10. {
    11.     [Serializable]
    12.     [NodeAttributes("TFHC - Compare With Range", "Operators", "Check if A is in the range between Range Min and Range Max. If true return value of True else return value of False", null, KeyCode.None)]
    13.     public sealed class TFHCCompareWithRange : DynamicTypeNode
    14.     {
    15.  
    16.         protected override void CommonInit( int uniqueId )
    17.         {
    18.             base.CommonInit( uniqueId );
    19.             m_inputPorts[ 0 ].Name = "A";
    20.             m_inputPorts[ 1 ].Name = "Range Min";
    21.             AddInputPort( WirePortDataType.FLOAT, false, "Range Max" );
    22.             AddInputPort( WirePortDataType.FLOAT, false, "True" );
    23.             AddInputPort( WirePortDataType.FLOAT, false, "False" );
    24.             m_textLabelWidth = 100;
    25.             m_useInternalPortData = true;
    26.         }
    27.  
    28.         public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true )
    29.         {
    30.             base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode );
    31.             m_inputPorts[ 0 ].MatchPortToConnection();
    32.             m_inputPorts[ 1 ].ChangeType( InputPorts[ 0 ].DataType, false );
    33.             m_inputPorts[ 2 ].ChangeType( InputPorts[ 0 ].DataType, false );
    34.             m_inputPorts[ 3 ].MatchPortToConnection();
    35.             m_inputPorts[ 4 ].MatchPortToConnection();
    36.             m_outputPorts[ 0 ].MatchPortToConnection();
    37.         }
    38.  
    39.         public override string GenerateShaderForOutput( int outputId, WirePortDataType inputPortType, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
    40.         {
    41.  
    42.             //Check if VALUE is in range between MIN and MAX. If true return VALUE IF TRUE else VALUE IF FALSE"
    43.             string a = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    44.             string b = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    45.             string c = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    46.             string d = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    47.             string e = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalvar );
    48.             string strout = " ( ( " + a + " >= " + b + " && " + a + " <= " + c + " ) ? " + d + " :  " + e  + " ) ";
    49.             //Debug.Log(strout);
    50.             return strout;
    51.  
    52.         }
    53.     }
    54. }
    55.  
    Now a simple example of use.
    In this example the value to check come from a texture node and if the value is between (0,0,0,0) and (0.6,0.6,0.6,0.6) it returns the texture value, if not return color red (1,0,0,0):



    Very funny ;D

    Of course is valid to compare floats, etc....

    Note: the node drops to the shader an immediate if (condition ? if_true_expression : if_false_expression)
     
    Last edited: Oct 5, 2016
  25. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    Maybe I explained it wrong, sorry about that. What I mean is, lets say I have some nodes connected to the register node and nowhere else, just that node. Now, lets say I have a get node that gets the previous register node and I connect this to the master node. The result should be the same as if I had connected the register node to the master node but instead the shader gets corrupted because it generates the code to the get node but not the code in the register node, so even the custom name for the get node is not recognized.
     
    Last edited: Oct 4, 2016
    benderete likes this.
  26. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    With portal / link I would like something like this:



    There is a Register Local Var accommodating the result of "Dissolve - Opacity Mask" and a GetLocalVar bringing this result to "BurnEffect - Emission".

    In this case the shader is not working and raise this error:

    Shader error in 'TFHC/DisolveBurn': undefined variable "DisolveMask" unable to find compatible overloaded function "clamp(error, float, float)" undefined variable "DisolveMask" unable to find compatible overloaded function "clamp(error, float, float)" at line 39 (on d3d9)

    In the shader surf function you can see that DisolveMask variable is being referenced before its declaration

    void surf( Input input , inout SurfaceOutputStandard output )
    {
    output.Normal = tex2D( _Normal,input.uv_Normal).xyz;
    output.Albedo = tex2D( _Albedo,input.uv_Albedo).xyz;
    output.Emission = ( ( 1.0 - clamp( (-4.0 + (DisolveMask - 0.0) * (4.0 - -4.0) / (1.0 - 0.0)) , 0.0 , 1.0 ) ) * tex2D( _BurnRamp,float2( ( 1.0 - clamp( (-4.0 + (DisolveMask - 0.0) * (4.0 - -4.0) / (1.0 - 0.0)) , 0.0 , 1.0 ) ) , 0 )) ).xyz;
    float DisolveMask = ( (-0.6 + (( 1.0 - _DisolveAmount ) - 0.0) * (0.6 - -0.6) / (1.0 - 0.0)) + tex2D( _DisolveGuide,input.uv_DisolveGuide).r );
    clip( DisolveMask - 0.5 );
    }

    With this code seen i think that you are going to have a beautiful "What came first the chicken or the egg?" trouble with this methodology. Perhaps will be better rethink that nodes like "invisible wires" instead vars.

    And would be great that you could not to attach the node Register Local Var to the master node. Instead, left the Register Local Var without out attach and use, for example a GetLocalVar attached to the "BurnEffect - Emission" and other GetLocalVar attached to the Opacity Mask of master node.

    Finally, i have seen that after defining a Register Local Var, if you close the canvas and back to open it, the names of that Register Local Var is not available when you add a new GetLocalVar.

    Recapitulation:
    Link / Portal Node --> A "Link Source" node that encapsules "invisible wires" to their associated "Link Target" nodes.
    The objetive will be maintain the graphs more clean of crossing wires for best readability.
    And will be awesome if selecting a Link Source or a Link Target the "invisible wires" attaching them will become visible. Or a canvas option to show the Links wires (perhaps with discontinuing line).

    P.S. Excuse my english, I hope you can understand all this stuff :D
     
    Last edited: Oct 4, 2016
  27. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    Request: Being able to have a property to control the mask clip value in the shader property window.
     
  28. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    I'm starting too, but i'll try give you some resources:

    Hi, I think that you can start with UE4 material docs since ASE have some similitudes. At least to start learning some concepts. I'm doing it ;)
    https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/index.html

    A light introduction to shaders:
    https://unity3d.com/es/learn/tutorials/topics/graphics/gentle-introduction-shaders

    This video and this channel is interesting (more for programming shaders)


    Other channel with good stuff (also programming)
    https://www.youtube.com/channel/UCDk9-aPr8zQzwi4ylnuoJ6w/videos?sort=dd&view=0&shelf_id=0

    Finally, i attach some totally simples ASE shaders (good stuff for the first page of the asset tutorial XD)
     

    Attached Files:

  29. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    532
    Thanks!
    how Unreal materials works is what i need to get started but the others is also nice to try.
     
    benderete likes this.
  30. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    194
    One thing Shaderforge lacks are video tutorials, it only has 6, I would really like if you guys did better.
     
    Shodan0101 likes this.
  31. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    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:
    anisotropic2.PNG
     
    Last edited: Oct 5, 2016
  32. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
  33. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    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 <operator> B) {
    <true>
    } else {
    <false>
    }

    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 <operator> B ? <true> : <false>)
     

    Attached Files:

    Last edited: Oct 5, 2016
  34. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    Here go the last comparison custom node due the 5 maximum attached files per post.
     

    Attached Files:

  35. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    513
    kebrus and benderete you guys are on fire! :D

    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.
     
    Last edited: Oct 5, 2016
  36. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    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:
    http://www.codeavarice.com/dev-blog/tutorial-burning-edges-dissolve-shader-in-unity

    Orriginal shader code is:
    Code (CSharp):
    1.     Shader "Dissolving" {
    2.     Properties {
    3.       _MainTex ("Texture (RGB)", 2D) = "white" {}
    4.       _SliceGuide ("Slice Guide (RGB)", 2D) = "white" {}
    5.       _SliceAmount ("Slice Amount", Range(0.0, 1.0)) = 0.5
    6.  
    7.  
    8. _BurnSize ("Burn Size", Range(0.0, 1.0)) = 0.15
    9. _BurnRamp ("Burn Ramp (RGB)", 2D) = "white" {}
    10.     }
    11.     SubShader {
    12.       Tags { "RenderType" = "Opaque" }
    13.       Cull Off
    14.       CGPROGRAM
    15.       //if you're not planning on using shadows, remove "addshadow" for better performance
    16.       #pragma surface surf Lambert addshadow
    17.       struct Input {
    18.           float2 uv_MainTex;
    19.           float2 uv_SliceGuide;
    20.           float _SliceAmount;
    21.       };
    22.  
    23.  
    24.       sampler2D _MainTex;
    25.       sampler2D _SliceGuide;
    26.       float _SliceAmount;
    27. sampler2D _BurnRamp;
    28. float _BurnSize;
    29.  
    30.  
    31.       void surf (Input IN, inout SurfaceOutput o) {
    32.           clip(tex2D (_SliceGuide, IN.uv_SliceGuide).rgb - _SliceAmount);
    33.           o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
    34. half test = tex2D (_SliceGuide, IN.uv_MainTex).rgb - _SliceAmount;
    35. if(test < _BurnSize && _SliceAmount > 0 && _SliceAmount < 1){
    36.     o.Emission = tex2D(_BurnRamp, float2(test *(1/_BurnSize), 0));
    37. o.Albedo *= o.Emission;
    38. }
    39.       }
    40.       ENDCG
    41.     }
    42.     Fallback "Diffuse"
    43.   }
    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.
     

    Attached Files:

    hopeful likes this.
  37. TheAlmightyPixel

    TheAlmightyPixel

    Joined:
    Jun 21, 2014
    Posts:
    263
    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.
     
  38. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    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
     
    TheAlmightyPixel likes this.
  39. TheAlmightyPixel

    TheAlmightyPixel

    Joined:
    Jun 21, 2014
    Posts:
    263
    Thanks! It works fine now.
     
  40. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,744
    Amplify Shader Editor Tutorial 3 - Connecting Nodes [BETA 1]


    Amplify Shader Editor - Asset Store Page
     
  41. jjgarcianorway

    jjgarcianorway

    Joined:
    Oct 19, 2015
    Posts:
    33
    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?
     
  42. jjgarcianorway

    jjgarcianorway

    Joined:
    Oct 19, 2015
    Posts:
    33
    In case someone experience the same... delete the whole folder from your project, save and execute the downloaded file... It will work again :)
     
  43. TheAlmightyPixel

    TheAlmightyPixel

    Joined:
    Jun 21, 2014
    Posts:
    263
    I'm really liking this tool so far!

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

     
  44. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    135
    :eek: Awesome!!!!
     
  45. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    Hey there, shaders in attachament:

    AnisotropicGroup.PNG

    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)
    https://drive.google.com/open?id=0BzxBIMuBW-4GQk5TVEt0bHpsS0U
     
    Last edited: Oct 8, 2016
  46. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    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.

     
  47. jjgarcianorway

    jjgarcianorway

    Joined:
    Oct 19, 2015
    Posts:
    33
    Wow... I hope one day I can learn from you... Impressive!
     
    ViktorCor likes this.
  48. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    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).

     

    Attached Files:

  49. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    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.
     
    kebrus likes this.
  50. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,744
    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!
     
    antoripa likes this.
unityunity