Search Unity

Shader Forge Extensions

Discussion in 'Assets and Asset Store' started by LennardF, Apr 26, 2014.

  1. LennardF

    LennardF

    Joined:
    Apr 26, 2014
    Posts:
    19
    Introduction
    I've been using Shader Forge the last few days, and while it's a really useful tool, I kind of missed the possibility of making a set of nodes into a reusable function. After some conversing with the author of Shader Forge, I came up with a pretty nice workaround for the time being, which doesn't require any hacking whatsoever, just plug and play.

    What is it?
    This dockable window (found under "Window > Shader Forge Extensions") allows you to save the currently selected nodes to a file, after which it shows up in the list below. This allows you to easily re-use parts of your shaders in other shaders with the click of a button! Not too mention it allows you to share your "clips" with other users!



    Installation
    The most simple way of installing this is just dropping the .cs file in your "ShaderForge/Editor/Code"-folder.

    I also made a "Clips" folder in there which I use to store my clips.

    Usage
    Simply select the nodes you wish to save to a file, click the "Save"-button and a window will come up asking you where to save it. As long as you place it under the assets-folder, "Shader Forge Extensions" can find it!

    The "Load"-button allows you to load a clip from a file and add it into your current shader, after which you can decide to save it to your own clip-library!

    The "Refresh"-button refreshes your clip-library.

    The "X"-button behind each clip allows you to delete it permanently. Don't worry, you'll be asked if you are sure before it actually happens.

    Download
    You can find the latest version on my GitHub: https://github.com/LennardF1989/UnityScripts/

    Direct link: https://raw.githubusercontent.com/LennardF1989/UnityScripts/master/Shader Forge/Shader Forge Extensions/ShaderForgeExtensions.cs

    License
    Due to its simple nature, I have no interest in keeping the source a secret.

    If you decide to modify this tool, please share it with me through this topic, although this is not a requirement. As long as you give credits where credits are due with a link to this topic.

    Changelog
    v1.3 (27-01-2017)
    - Updated to support Unity 5.5

    v1.2 (27-05-2014)
    - Clips are now inserted relative to the camera position (top left) or the currently selected node(s), rather than the position they were in at the time of creating.

    v1.1.1 (26-05-2014)
    - Fixed an issue where a wrongly formed search would print an error in the console

    v1.1 (26-05-2014)
    - Various bug fixes to prevent Unity from crashing
    - Added search option
    - Updated the GUI to be more appealing

    v1.0 (26-05-2014)
    - Initial version
     
    Last edited: Jan 26, 2017
    Baldinoboy likes this.
  2. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Awesome. This will help a lot. Thanks
     
  3. LennardF

    LennardF

    Joined:
    Apr 26, 2014
    Posts:
    19
    Last edited: Apr 26, 2014
  4. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    Thanks, this is really appreciated.
     
  5. LennardF

    LennardF

    Joined:
    Apr 26, 2014
    Posts:
    19
    Just pushed a new version to GitHub.

    v1.2 (27-05-2014)
    - Clips are now inserted relative to the camera position (top left) or the currently selected node(s), rather than the position they were in at the time of creating.
     
  6. adventurefan

    adventurefan

    Joined:
    Jan 17, 2014
    Posts:
    230
    Just noticed this but it's been awhile, would it still work with SF?
     
  7. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    It still does.
     
    adventurefan likes this.
  8. kakakak

    kakakak

    Joined:
    Dec 18, 2014
    Posts:
    4
    this is awesome thanks!
     
  9. LennardF

    LennardF

    Joined:
    Apr 26, 2014
    Posts:
    19
    I still use it myself constantly so if it breaks at any point, I'll try to fix it!
     
  10. hmx_manrad

    hmx_manrad

    Joined:
    Jan 10, 2014
    Posts:
    8
    Thanks for the great tool :) In Unity 5.5, it appears to be broken, but the fix was easy. It looks like stuff that was happening in the ShaderForgeExtensions constructor now needs to wait for OnEnable to run:


    Code (CSharp):
    1.       public ShaderForgeExtensions()
    2.       {
    3.          //<--- MOVED STUFF HERE TO OnEnable()
    4.       }
    5.  
    6.       public void OnEnable()
    7.       {
    8.          HOPanelUtils.SetWindowTitle(this, SF_GUI.Icon, "SF Extensions");
    9.  
    10.          minSize = new Vector2(275, 100);
    11.  
    12.          _scrollPosition = Vector2.zero;
    13.  
    14.          _previousFilter = _currentFilter = string.Empty;
    15.  
    16.          Refresh();
    17.       }
     
    LennardF and FPires like this.
  11. LennardF

    LennardF

    Joined:
    Apr 26, 2014
    Posts:
    19
    Thanks for the tip @hmx_manrad - I have since updated the Git with a v1.3 :)
     
  12. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Thanks for this useful tool!
     
  13. Joseguepardo

    Joseguepardo

    Joined:
    Mar 3, 2015
    Posts:
    8
    still working in 5.6 :O awesome tool!
     
  14. Xulain-SineSpace

    Xulain-SineSpace

    Joined:
    Oct 14, 2017
    Posts:
    26
    Not working in 2018
     
  15. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    Yeah that's unfortunate.
     
  16. pikachurocks55

    pikachurocks55

    Joined:
    Feb 11, 2020
    Posts:
    1
    Heads up, managed to get working in 2019. Opening shader forge via example shaders on 2019.4.31f1. Just seems to be an error with the window system changing, so I just click "open with shader forge" on the example shaders in unity, then "return to menu" in the opened shader forge window. Undocks itself each window change but works well enough.