Search Unity

Big collection of free Shader Graph nodes

Discussion in 'Graphics Experimental Previews' started by Giles-Coope, Jul 5, 2018.

  1. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    Hey Unity people.

    I've been working on some shader graph node libraries in the past week or so. I'd be very happy to get some feedback on these and would love to hear if you've used any of them for any of your projects.

    https://github.com/gilescoope/shader-graph-nodes

    Complex



    Do complex arithmetic in shader graph.

    Composite



    Complete set of Porter Duff transparency operations.

    Halftone



    Halftone rendering, monochrome or color.

    Lab Color



    Manipulate colors in the perception-based color spaces.

    Pattern



    Procedural geometric patterns.

    Pixel Perfect



    Pixel-wide primitives, no matter what the surface.

    Quaternion



    Quaternion algebra for rotation calculations in the graph.

    SDF



    Signed distance functions for amazing procedural effects.

    Truchet



    Truchet tiling nodes to make beautiful irregular patterns.
     
  2. Slaktus

    Slaktus

    Joined:
    Dec 5, 2012
    Posts:
    6
    Thanks so much for these! Been playing around with them for a couple of days now, and particularly the SDF and truchet nodes offer a ton of possibilities.

    So far this pretty garden-variety alpha-blended SDF-based cartoon water is the best example I've got, but will post more graphs when I come up with something more exciting

    Edit: Wow, embedding images by link or upload is tremendously broken
     
    Last edited: Jul 26, 2018
    Shorely and Giles-Coope like this.
  3. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    That looks great, looking forward to seeing more stuff, let me know if there was something that wasn't clear or any functionality you felt should have been there but wasn't.
     
  4. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    531
    Any chance for a Blur or Distort node?
     
    Franckitou likes this.
  5. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    Shader calculations are done per pixel without accessing other pixel information (aside from DDX, DDY, fwidth) so a blur node doesn't make too much sense.

    Distortions are possible, what distortions would be interesting?
     
  6. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    531
    The best example I can give is the noise texture node from Blender but for Unity I'm not sure how the distortion would work for different types of input as a separate node. Here it's embedded in the Noise node

    No distortion
    upload_2018-8-30_16-25-52.png

    With Distortion
    upload_2018-8-30_16-26-17.png
     
  7. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    Thanks for this!
     
    Giles-Coope likes this.
  8. PeterLDavis

    PeterLDavis

    Joined:
    Feb 26, 2018
    Posts:
    3
    How would I go about installing these?
     
  9. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    Hey there, from the GitHub page here

    https://github.com/gilescoope/shader-graph-nodes

    you can just click "Clone or Download" then "Download .zip"
    If you extract your zip somewhere into your Project > Assets folder you should be able to use all the nodes from Shader Graph as you would use any other nodes.
     
  10. PeterLDavis

    PeterLDavis

    Joined:
    Feb 26, 2018
    Posts:
    3
    Thanks for getting back to me! That doesn't work, however (it was the first thing I did). Nodes simply don't appear in the graph editor.
    Could this be a version thing? I'm running 2018.2.14f1
     
  11. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    I'm not sure, do you get compilation errors? Do you have the correct packages installed?

    I just tried with 2018.3.0f2.
    - start a new project with the Lightweight RP (Preview) template
    - copy the "Nodes" folder from the repository into the project assets folder
    - create a shader graph

    Now when I right click and select "Create Node" I can see all the nodes.
     

    Attached Files:

  12. PeterLDavis

    PeterLDavis

    Joined:
    Feb 26, 2018
    Posts:
    3
    I think there was something vestigal in my current project that was stopping the nodes from compiling properly or just working at all. All newly created projects (LWRP and HDRP) seem to pick them up just fine. Thanks for your help, I really appreciate it :)
     
    Giles-Coope likes this.
  13. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    That's good to hear. I hope you can get the nodes in your project. If you get to the bottom of why it wasn't working I'd be interested to hear.
     
  14. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    525
    Unity broke nodes by making function node class internal, my project depends on those, what should i do?
     
  15. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    Ouch, thanks for letting me know about this. I'll take a look as soon as I have some time. Which version of Unity is this?
     
  16. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    525
    19a14
    sg 5.2.3
     
  17. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    Thanks, I managed to reproduce this. I guess it's someone in the Unity team setting the class to internal without thinking. It wouldn't be the first time I've seen this.

    I saw that you posted this already in the megathread so will wait to see what the response is there. I believe there's very little I can do. In the meantime I'd suggest working in the last version of shadergraph that doesn't have this restriction.
     
    pointcache likes this.
  18. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    From what I've heard, they did this intentionally. It is because they are working on redoing the API, so any custom nodes will need to be updated to work with the new API. I guess they made it private so less people will try to use it in the interim, and thus less people will need to redo their custom nodes..? My understanding is the new API is supposed to be available by the time 2019.1 is released.
     
    Giles-Coope likes this.
  19. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,554
    If you want custom nodes basically need to stick sg 4.6 (and therefore unity 18.3) until they release their new api.
     
  20. reto5messerli

    reto5messerli

    Joined:
    Oct 14, 2018
    Posts:
    6
    there is now a new way to make custom nodes in unity 2019. there is a "custom node" node in which you can copy paste the hlsl code. its pretty easy to use. you will also have to update the lwrp or hdrp to a newer version when creating a new project.
     
    syscrusher likes this.
  21. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    970
    Thanks for this info! I didn't know about this feature yet. I just installed 5.16 preview into a test project and found that the custom node feature is present. I'll need time to get my code into some of these (breaking my custom shader's unusual features into function nodes), but at least this gives me a maintainable way to merge my custom functionality into the broader SRP context.

    I'm glad this is now in the Package Manager and doesn't require me to install directly from the GitHub version. I would do that if necessary, but it's nice not to have to.
     
  22. _watcher_

    _watcher_

    Joined:
    Nov 7, 2014
    Posts:
    129
    I know it might seem simple (or additional) to do, but do you have any plans on redoing these cs classes into HLSL/customFunction nodes (or as they suggest for sharing purposes 'just wrap them into a subgraph node' approach) as its what the new api requires? I would love to compare them back and forth with what you wrote before, to learn more about the new structure and HLSL in general (im just beginning to learn shader language)
     
  23. Giles-Coope

    Giles-Coope

    Joined:
    Jan 5, 2015
    Posts:
    48
    No plans at the moment. It's very disappointing not to be able to create custom nodes like this any more to be honest. The subgraph approach is super clunky, and the custom code node is bad for sharing/readability etc.
     
    syscrusher likes this.
  24. _watcher_

    _watcher_

    Joined:
    Nov 7, 2014
    Posts:
    129
    I agree and many people in unity's post relating to the update expressed the same feeling. What came to me as to 'why was it done/changed' was that there were additional reasons, where the old approach was unable to perform in certain use-cases, where the new one would, but those were not specified in the thread, so i can't comment on it. But as you've said, shareability, github repo's copy pasta and get instant feedback in shadergraph. FeelsBadMan. Anyways thanks for replying!

    PS u can attach HLSL shader files into the custom node, dont have to paste function body code manually anymore (this was not possible initially), so at least there is some type of codesharing possible now.
     
    Last edited: Jul 30, 2019
  25. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    970
    I wanted to follow up and again thank you for letting me know this was available. I was able to use it to solve my requirement. I got my custom node working. Eventually I migrated to a full custom source file, but the Shader Graph version was valuable for prototyping the separate elements of my shader before I integrated them into one source module.