Search Unity

Feedback Wanted: Shader Graph

Discussion in 'Graphics Experimental Previews' started by Kink3d, Jan 10, 2018.

Thread Status:
Not open for further replies.
  1. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    544
    Another question for Shader Graph team, if I don't care about future migration to 2019.x and SG 5.x/6.x, what can I do to workaround the limit on FunctionRegistry and ShaderStringBuilder?

    In 4.9.0, both ShaderStringBuilder.currentNode and FunctionRegistry.builder are marked as internal, I believe this is intentional but it's also preventing me from using them due to SG assembly definition. They are required if we want to build a custom graph function generator.

    I know you have grand plan for Unity 2019, such that FunctionRegistry class is marked as private in 6.x branch, but future is too far for me. I am *this* close to forking SG package, please let me know if you got an alternative for poor people on Unity 2018.

    (You might wonder why I need to build a custom shader function generator instead of using GraphUtil, the answer is simple: GraphUtil is too opinionated when generating source, especially on description struct field naming...)

    EDIT: ok there is one way, reflection, not pretty, but seem to be working...
     
    Last edited: Feb 21, 2019
  2. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    830
    Dont get me wrong -- this is easy to remember API, but -- does anyone else see humor in this particular naming convention?

    If not, it could simply be that, with my shader, I may require a vertex color...
     
    hippocoder likes this.
  3. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    483
    What if you need more than one? Typically I use 2 in my stuff :(

    Does the syntax change?


    Yes, that was a joke. Even I'm not that crazy.
     
    awesomedata likes this.
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    2,000
    Sorry for the lack of proper terminology, but does ShaderGraph support sampling other TexCoords than just TEXCOORD0? I was looking at making a shader that worked with the Unity Vector Graphics package, but found that I could get UV offset to work in SVG images. This post (https://forum.unity.com/threads/vector-graphics-preview-package.529845/page-5#post-3607289) seems to imply that if I was using TexCoord2 it would work, but I don't see any way to do that in ShaderGraph.
     
  5. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    560
    You can use the UV node or the Tiling and Offset node and switch the UV channel to what you want.
    upload_2019-2-22_14-1-21.png
     
    dgoyette likes this.
  6. cr4y

    cr4y

    Joined:
    Jul 12, 2012
    Posts:
    37
    I'm not sure if it is known issue or not, but:
    mesh preview barely works - sometimes it does rotate, sometimes not, but always it is displayed with default preview (sphere) over it. Similiar issues are happening with other previews.
     
    soleron and sand_lantern like this.
  7. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    544
    A known bug, reported months ago, not fixed in 4.x, not sure about later version :(
     
  8. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    197
    I have a few feedback notes off the bat, if it counts for anything! This is my feedback from using the first iteration of the Shader Graph (when it was first announced) and using the latest version. (4.10.0 Preview)
    -------------------------------------------------------------------------------------------

    The Good

    1) The focus on procedural content is GREAT
    Many shader graph tools don't really focus on this aspect, but I love how out-of-the-box the Shader Graph has a bunch of procedural nodes (noise, voronoi, shapes, etc) that just take a lot of the busy work out of shader creation. It's great. I'd love to see more of this!

    2) The GUI
    The GUI is super clean, it doesn't look cluttered or busy. This might seem like a shallow observation, but it's a HUGE win for people who work with these tools regularly. Makes it very stress-free to work with.

    3) Visibility and Readability
    This is somewhat related to the GUI, but I LOVE the approach you're taking to showing values and connections. Default values are super visible too, without having to make any connections. Shader Forge doesn't have default values as far as I can tell, you always need to plug another node into something. And with Amplify Shader Editor, the default values are buried in the node, requiring you to focus the node to see the values associated with it. The way Shader Graph deals with this is so good in comparison.



    Honestly, it's getting there. It's awesome tool, and I'm excited about the direction it's heading.
    -----------------------------------------------------------


    The Bad

    1) It can't be used with Unity out-of-the-box
    From what I can tell, the Shader Graph preview doesn't work with Unity unless you are using a scriptable rendering pipeline. The fact that you can't just import it into any project and use it seems like a major limiting factor.

    To be honest, the way the SRP is being handled right now seems so unnecessarily complex, but that's a different issue. The fact that the Shader Graph needs to sit on top of an already complicated system makes is really hard to use. The barrier for entry seems way too high.

    2) Control-wise, it seems too simple
    Compared to Amplify Shader Editor or Shader Forge, the Shader Graph doesn't seem to offer the same amount of control and granularity. This is going to make it unusable (or at least, make if FEEL unusable) for so many people. With tools like this, users want to know that they're going to have as much control as if they were programming shader code.

    For example, here is some of what Amplify Shader Editor offers for control:



    But with the Shader Graph (as far as I can tell) you can't even change the Shader's name, that's dependent on the filename. It just seems like a huge oversight that may end up making this tool unusable for most users.


    3) Limited shader types
    I do a lot of 2D work, mainly. Unity's Sprite Renderer system has been great for all the games I've worked on. Something Amplify Shader Editor offers is the ability to make Sprite shaders, easily. With Shader Graph though, I can't find any way to make anything besides a Standard shader, or an Unlit shader. It seems so limiting, and this completely disqualifies it from my tool rotation.

    I'd love to see something similar to Amplify Shader Editor's template system, with different "shader templates" offering wrapped functionality for creating shaders for UI, Sprite Renderer, etc.

    -------------------------------------------

    Conclusion

    I think the Shader Graph has a lot of potential. It's doing some cool things that other similar tools don't. It's clean, and easy to read. I'd love to see this becoming a main Unity tool, like the Animator/Timeline/etc. It'd be amazing to have a first-party solution to this gap in Unity's tool offerings up until now.

    The unfortunate part is, in it's current state, it's basically unusable for me. It doesn't offer me enough control, all while being too complex to use comfortably out-of-the-box.

    I hope this feedback was helpful! I'd love to be able to use the Shader Graph more in the future, so hopefully some of this is taken into consideration.
     
    Sycoforge, id0, roccobruno78 and 3 others like this.
  9. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    273
    This required a change to Editor source and isn't an issue with ShaderGraph. Which Editor version are you using?
     
  10. cr4y

    cr4y

    Joined:
    Jul 12, 2012
    Posts:
    37
    2018.3.4f1
     
  11. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    125
    [Feature request] The ability to create and paint masks and flow maps directly from the graph would be a big time saver.

    For painting flow maps this is awesome http://teckartist.com/?page_id=107 but it doesn't work for macOS and hasn't been updated in years.
     
    wyatttt and hippocoder like this.
  12. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    544
    On the subject of future changes:

    - I would prefer nodes to not have hardcode shader output like "IN.{0}", which assume vertex description input is called "IN".

    - I would prefer nodes to not have hardcode shader output like "{0}Space{1}", which assume vertex description output is named like "ObjectSpaceNormal".

    - I would prefer nodes to not have hardcode shader output like "{0}4 {1} = IN.{2};", which assume node output is "float4 or half4", when all you want is to pass a UV in float2.

    There are a lot of assumptions built-in to Shader Graph, and you don't realize it until you dig into codebase. I am at a point that I know exactly which class/hlsl I should check when I need something. That's all good to me, but it also means everyone will have to go through this trouble.
     
  13. Demkeys

    Demkeys

    Joined:
    Nov 14, 2014
    Posts:
    30
    Hey I'm wondering if this is expected behavior. I tried multiplying a 4x1 matrix (vector 4) with a 4x4 matrix, in that order, using the Multiply node. It returned a vector 4. I don't know a whole lot about matrix multiplication so I could be missing some info, but from what little I know, multiplying a 4x1 and 4x4 matrix, in that order isn't possible. Yet the Multiply node returns a vector 4. I'm wondering if this is expected behavior or something that needs to be improved.
    screencap9.png screencap10.png
     
  14. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    173
    Any news on nested subgraphs?
     
  15. DigitalSalmon

    DigitalSalmon

    Joined:
    Jul 29, 2013
    Posts:
    42
    To settle an office debate - Is there a fundamental reason that the shader needs to compile every time you make any change? It really does feel like a massive step back in workflow since SF/Amplify. I'd love to have some ammo as I try to defend Unity from the onslaught of artists who aren't enjoying the slow pace of shader creation!
     
    laeusnb likes this.
  16. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    560
    This is already been worked on. Shader graph will support Async Compile so no compiling until you hit save, I tested it yesterday and that was my experience so far.

    upload_2019-2-26_11-51-34.png

    Sometime soon it should be merged into the master branch for shader graph.
     
    hippocoder likes this.
  17. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    560
  18. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,623
    Yeah and eventually should be able to just use a new kind of DOTS-friendly material type going forward which will dramatically cut down on how many permutations a shader requires, should speed things up a tad compile wise if it doesn't need to do all the "just in case" variants.
     
  19. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    560
    Yea, the DOTS instancing on the SG Lit shader mater node in 6.4.0-preview package. Not sure how to make it take effect though so didn't mess with it too much. Probably needs the Hybrid Renderer package and some other things ECS.

    upload_2019-2-26_13-4-15.png
     
    hippocoder likes this.
  20. KYL3R

    KYL3R

    Joined:
    Nov 16, 2012
    Posts:
    41

    I have the same problem. https://imgur.com/IcAu99p
    I updated to the newest Shader Graph package (4.10) and the newest stable Release 2018.3.6f1
    It works in preview, but won't in scene. All pink because "incorrect number of argument to numeric-type constructor"

    -----
    More general feedback:
    * desperately need a way to create toon shading. Custom Master node or maybe just lighting / shadow information.
    * I need to have instanced properties as exposed properties. So that I can set them using MaterialPropertyBlocks. Instancing works if I check the box on the material, setting kind of works, as all my grass bends in the same direction. So no setting blocks for individuals. In my custom (plain-old) shader I needed to do :

    // in setup:
    UNITY_INSTANCING_BUFFER_START(Props)
    UNITY_DEFINE_INSTANCED_PROP(fixed4, _CollisionBending)
    UNITY_INSTANCING_BUFFER_END(Props)
    .... in vertex shader:
    UNITY_SETUP_INSTANCE_ID(input); // prepare
    UNITY_ACCESS_INSTANCED_PROP(Props, _CollisionBending); // access property


    I don't really see how I could do this in a custom node. I can't even put:
    #include "UnityCG.cginc"
    into the shader-code-string in my CodeFunctionNode (.cs file.) because it's a string already, and ' instead of " will cause error. I couldn't escape it using \" either.

    So to sum up my Feedback: I like where this is going, and I understand that it's still in developement (especially for HDRP).
    However I'd like to see some things added / changed to actually use ShaderGraph.
     
    darkydoodle and LaurieAnnis like this.
  21. SpaceShaman

    SpaceShaman

    Joined:
    Sep 29, 2016
    Posts:
    5
    I'd like to +1 all the requests for Stencil Buffer read/write support.
    It's make-or-break functionality for some of the stuff I'm trying to use this for.
     
    DaveL99 and EricLowry like this.
  22. ph_

    ph_

    Joined:
    Sep 5, 2013
    Posts:
    128
    Does anyone from Unity can give an ETA about the new node API ? And if it will be as powerful as the previous one ?
    It was indeed a bit complicated but we had access to a lot of example and we could achieve pretty much anything.
    I spent the last two weeks coding helpful nodes in the latest official Unity 2018.3, only to discover now that it just can't work in Unity 2019.1.

    I don't mind working again to convert my nodes to the new API ! I'd just like to have a broad ETA for the new API (1 week ? 1 month ? 3 months ?); and know if it'll be as powerful (writing custom UI for nodes, custom master nodes...etc) as the previous one, so I don't work for nothing.

    Thanks for your time; here's a screenshot that showcase the kind of nodes I've been doing.
    In the noise one, the Input slots change according to the parameter (noise type, combine ...etc).
    noises_node.png

    This one is a simple lit master node I needed for a mobile project.
    simple_lit_master.PNG

    EDIT: this question has been answered on the Unity Community Discord (#shaders room). TLDR: some of theses features will be do-able with the new API, not all.
     
    Last edited: Mar 5, 2019
    soleron and noio like this.
  23. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    483
    +3 to that, Stencil Buffers open up a lot of functionality!

    @ph_ those are some sick nodes; the all-in-one noise node is a really good idea Does it come with Voronoi? The simple lit node is like the Simple Lit shader that comes with LWRP?
     
    EricLowry likes this.
  24. ph_

    ph_

    Joined:
    Sep 5, 2013
    Posts:
    128
    I haven't added Voronoi yet but that's a good idea, I'm doing it at the moment thanks !
    Initially I did about 20+ noise nodes with all the combinaison, but I was often trying to switch between nodes and it was cumbersome because you have to create a new one, drag all the input / outputs ..etc. Here you can change in one clic and see the difference !
    I plan to add more noise parameters too (4D perlin noise, Ridge multifractal ...etc).

    Yes the Simple Lit master node is the same that's in LWRP; I did a second variant for my projet's specific needs. As a programmer, I find it very handy to code the master node and let artists use it to build other graphs.
     
  25. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,374
    @wyatttt In shadergraph we have input slot for vertex position, how come we don't have an input slot for vertex normal? Modifying vertex position without adjusting the normal to the new position resulting a weird shading
     
    iamarugin likes this.
  26. 3d_Artist1987

    3d_Artist1987

    Joined:
    Jul 9, 2012
    Posts:
    716
    Hi,
    How to make VR eye shader in shader graph?
    Thanks.
     
  27. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    869
    Hi Everyone,

    How can i use shader graph to create a shader, which takes a texture as input and replaces each pixel with another texture. For example a square texture will show "star" textures replacing every pixel.

    Thanks
     

    Attached Files:

  28. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    119
    I am not particularly happy with the discontinuation of custom nodes.

    There are things that the shader graph does not offer and custom nodes helped with that. Sadly not allowing for custom nodes locks us in the limited scope of each RP and depending on when Unity will plan to add feature A or B.

    i.e no anisotropy in LWRP or lack of a skin shader provided by Unity in LWRP and quite a few other things that are used by many artists on a daily basis. It seems like the features and functionality are not designed based on artist needs, but based on what a programmer thought an artist would need.

    The existing SRP templates especially LWRP lack flexibility and that also translates to SG functions. The inability to use custom nodes is an unfortunate restriction that unlike the previous rendering system limits users to the choices of Unity's programmers without giving the opportunity to the community to add value and much needed features with custom nodes that it will undoubtedly be lacking. Unity can't possibly predict all the needs artists have on so many different projects. And that is why SRP should be an open system, not more closed than the previous one.
     
    darkydoodle likes this.
  29. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    560
    They didn't take away the ability to use custom nodes they just remade it and disabled the current one. The new version that will be released sometime soon allows you to directly add HSL from a file.

    upload_2019-3-6_12-37-25.png
    upload_2019-3-6_12-37-40.png
     
  30. darkydoodle

    darkydoodle

    Joined:
    Oct 27, 2018
    Posts:
    45
    Yes !! Where did you find this information (screen pictures and all) ???
     
  31. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,623
    As stated many times, be patient, it will drop some point when Unity has no merge issues for it in 2019.1.
     
    wyatttt and Grimreaper358 like this.
  32. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    560
    Should be in the main package sometime soon™ we just gotta wait. Actually, a lot of cool stuff coming for Shader Graph
     
    hippocoder likes this.
  33. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    929
    Is it possible to use a smaller image and position it on the u/v with a node?

    For example; say I have 2k texture for my character. Let say I have another texture of a tattoo (512 x 512). Instead of having a 2k texture with the tattoo positioned exactly where it supposed to be, can I add that 512 texture, and then used a node to drive the positioning of when it should be? I didn't see anything like that.

    Also I rather not have a 2k texture for every eyebrow the player can choose from, I rather have 20 256px textures so it loads faster and saves from using larger file sizes, etc.

    It would also be nice in addition to positioning, allow a scale and rotation relative to the image.
     
  34. Gabadaba08

    Gabadaba08

    Joined:
    Mar 7, 2019
    Posts:
    2
    Thank you so much, I placed the PBR Shader asset in the graphic-settings tab and it didn't work but this did! Thx so much :)
     
  35. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,623
    Use mipmap streaming and it likely won't be something you need to worry about.
     
  36. JotaRata

    JotaRata

    Joined:
    Dec 8, 2014
    Posts:
    21
    I think i may have found an issue in SG 5.6.1
    whenever you try to put a Sample Gradient node and save the shader, the console will throw an error saying: "Incorrect number of arguments to numeric-type constructor"

    You can try to reproduce this error by:
    - Creating a new scene with HDRP in Unity 2019.1b
    - Creating a new Lit Graph
    - Adding some nodes (Sample Texture, Fresnel, Noise..)
    - Adding a Sample Gradient node connected to the latter
    - Connecting the Sample Gradient node to an output (BaseColor, Smoothness..)
    - Saving and Voila
    I think this is a bad issue because I use Sample Gradient a lot (I used to play in Blender with the Coloramp node everytime)

    ** Also I have tested if the same error occurs with other nodes/setup by insulating or removing the Sample Gradient node and my conclusion is that node is the culprit.
     
  37. 4t0m1cw07f

    4t0m1cw07f

    Joined:
    Nov 2, 2015
    Posts:
    3
    I'm pretty sure this is a bug but I cannot get an animated (flipbook) texture to animate on the Unlit Master node whether in the alpha or colour input. It animates just fine in the preview before the master node but doesn't translate through. It seems that the master node only manages to show the first frame of the spritesheet.

     
  38. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    694
    How to get irridescence node in shader graph?
     
  39. abelitskaja

    abelitskaja

    Joined:
    Jun 18, 2017
    Posts:
    2
    Any idea how to create a boolean substraction shader? thanks! upload_2019-3-11_13-12-55.png
     
  40. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    560
    There's no iridescent node in shader graph, it's just a shading model switch/toggle on the master nodes for the Lit and StackLit shaders in HDRP.

    upload_2019-3-11_10-16-48.png
     
    wyatttt and konsic like this.
  41. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    217
    In the StackLit Master Node is IridescenceMask node - in StakLit Master node, there's no Material Type option and Iridescence appear as node (mask)
     
    konsic likes this.
  42. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,357
    Hi
    I have a working Shader Graph that gives me a blur effect.
    Is there any way to modify this Shader Graph to use the following Stencil Pass code?
    Code (csharp):
    1.  
    2. SubShader    
    3. {      
    4.   ColorMask 0      
    5.   ZWrite off      
    6.    Cull off
    7.              
    8. Stencil {        
    9.   Ref 1      
    10.   Pass replace      
    11.  }  
    12.          
    13. Pass         {                    
    14. }
    15.    
    16. }
    17.  
     
  43. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,357
    Disappointing that this thread is so quiet considering the importance of ShaderGraph!
    Ok...just a few suggestions

    1- More NOISE!
    Really, really need more noise options for creating organic textures, perlin, alligator, turbulent, etc. Additionally the ability to animate these noise textures beyond simply animating the offset via UV coordinates!

    2- UI needs layout options
    - perhaps simple snap to grid on drag?
    - global align or align selected, etc

    3- Option to have only ONE ShaderGraph window open at a time
    This would greatly save time for people with single monitors and have already configured their layout with a single ShaderGraph window. Clicking an existing ShaderGraph in the project would then open into an existing window instead of a brand new floating window.
     
    Last edited: Mar 14, 2019
    noio likes this.
  44. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    694
    SG needs smaller nodes like SF
     
    soleron and noio like this.
  45. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    694
    I've found a bug in SG.

    When I use color node HDR and set full saturation of color blue, material gets invisible.
     
  46. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    2,000
    Are there any plans to allow the Time node to use scaled time instead of only unscaled time? Or is it already possible to do this (other than needing to SetFloat on the material to send in scaled time)? It's annoying that all of my animated shaders keep animating when the game is paused.
     
  47. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    67
    Hi, guys
    Is there a way to change mipmap level of a texture in SG?
     
  48. cr4y

    cr4y

    Joined:
    Jul 12, 2012
    Posts:
    37
    As far as I know, Flip node description here in the docs does not have any sense and should be replaced with "Flips the individual channels of input. Positive values become negative values and vice versa.".
    Currently, it is:


    Update: now I see that correct description for Flip is under Swizzle on the same page. Also Split has the wrong description. I suppose it is a series of copy-paste errors.
     
    Last edited: Mar 17, 2019
  49. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    694
    How to fix this?

     
  50. darkydoodle

    darkydoodle

    Joined:
    Oct 27, 2018
    Posts:
    45
    Btw, custom nodes are working with the 5.8.2 package. AND ! Accessing property blocks via instancing is also working since you put a function in a external HLSL file, you can put the accessing macros outside of the function in the file.
    Just need post processing extending and refraction for older gfx cards and I'm good to go :)
     
Thread Status:
Not open for further replies.