1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

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!

    [​IMG]

    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
  2. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,050
    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:
    758
    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:
    198
    Just noticed this but it's been awhile, would it still work with SF?
     
  7. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    141
    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:
    6
    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:
    262
    Thanks for this useful tool!