Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Feedback Wanted: Shader Graph

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

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

    bsp_space

    Joined:
    Nov 28, 2014
    Posts:
    1
    Does not work in Unity 2018.2.0b4 and 2018.2.0b5 (Windows 10)
    ------
    .../AppData/Local/Unity/cache/packages/staging-packages.unity.com/com.unity.shadergraph@0.1.9/Editor/Util/GraphTypeMapper.cs(7,36): error CS0246: The type or namespace name `BaseTypeFactory' could not be found. Are you missing an assembly reference?

    .../AppData/Local/Unity/cache/packages/staging-packages.unity.com/com.unity.shadergraph@0.1.9/Editor/Drawing/MaterialGraphEditWindow.cs(451,27): error CS0246: The type or namespace name `PostLayoutEvent' could not be found. Are you missing an assembly reference?

    .../AppData/Local/Unity/cache/packages/staging-packages.unity.com/com.unity.shadergraph@0.1.9/Editor/Drawing/Views/GraphEditorView.cs(263,36): error CS0246: The type or namespace name `PostLayoutEvent' could not be found. Are you missing an assembly reference?

    .../AppData/Local/Unity/cache/packages/staging-packages.unity.com/com.unity.shadergraph@0.1.9/Editor/Util/GraphTypeMapper.cs(13,41): error CS0115: `UnityEditor.Graphing.Util.GraphTypeMapper.InternalCreate(System.Type)' is marked as an override but no suitable method found to override
     
  2. izym

    izym

    Unity Technologies

    Joined:
    Jul 27, 2013
    Posts:
    24
    Yes, please do :) Although this looks like an issue with a render pipeline more than a Shader Graph issue.

    You appear to be using a very old version of Shader Graph. Please get the latest from Package Manager instead. (Version 1.1.9-preview)
     
    LouisHong likes this.
  3. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    876
    Please support Shader Graph in default Unity renderer and HDRP.
     
  4. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    Well it already is filed as an issue ¯\_(ツ)_/¯
     
  5. brunocpf

    brunocpf

    Joined:
    Mar 9, 2017
    Posts:
    1
    Using the package through the master branch of the SRP repo, I noticed that it won't allow me to connect a Sample Texture anywhere on the path to the Position input in the master node. Is this intentional? I was trying to make a distortion shader using a texture.
     
  6. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    I have a graph were the metalic and emission is a generated map. It looks fine in the editor, but when I run my graph on iOS, the material is black.

    This is how it looks like in the Editor (windows 10)
    upload_2018-5-28_18-6-34.png

    This is how it looks on iOS (latest version, iPhone 6S)
    upload_2018-5-28_18-7-14.png

    This graph renders black on iOS, fine in the editor.
    upload_2018-5-28_18-8-28.png

    When I set emission and metallic to some simple color, it also renders fine on iOS.
    upload_2018-5-28_18-8-50.png
     
    Last edited: May 29, 2018
    konsic likes this.
  7. FreeGameDev

    FreeGameDev

    Joined:
    Dec 1, 2015
    Posts:
    65
    I've been using a lot of different shader node editors lately. You guys are doing a great job, keep up the good work.

    Requested features:

    (some in the lightweight pipeline could be faked if needed)
    Texture Arrays <- this would be powerful as I do not see it in other node editors.
    Tessellation
    Vertex manipulation
    Geometry shader
    Translucency / sub surface scattering
    Parallax occlusion

    Other ideas are you could have separate nodes for each program. Like vertex, fragment, geometry, etc. also passes, and pass settings (might help with optimization? Just a thought and throwing it out there.)

    Also, it would be nice, if it was a little simpler and better documented about adding your own nodes. Right now it is a little cumbersome and hard to figure out how to do anything more than simple things.

    Shadows need some work. Especially for partially transparent objects. Sometimes they work, and sometimes they don't.

    All in all though guys, I am loving it. Keep going, this could be super powerful!
    Any news on when the hd pipeline will be supported?
     
    Edmario_, konsic and MR-Heavy like this.
  8. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    575
    This is coming soon, remember seeing it on Github
    upload_2018-5-28_23-17-35.png

    Full post here
     
  9. FreeGameDev

    FreeGameDev

    Joined:
    Dec 1, 2015
    Posts:
    65
    Thanks Grimreaper358
    I try to keep up on this thread. But somehow missed that post.
     
  10. daffrendo

    daffrendo

    Joined:
    May 29, 2018
    Posts:
    3
    2018.1
    Texture always shows in graph as Purple, however I have installed, per the Unity GDC tutorial seminar, all the 'parts'...
    I know, a noob question, but the UI tutorials omit the basic intro of how to set up so you don't get a defaulted purple texture :(
    The shader graph operates fine, in that it appears to be structurally there with its connections active, but the shown resulting preview texture is *always* purple :eek:
    Do you need to activate, or switch a setting, do something in Unity, etc, beyond installing the 'parts' ?
    THX!
     
  11. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    @daffrendo

    Purple Shader
    : Make sure the lightweight render pipeline is selected. I needed to re-select it to make the pruple go away.

    purple-shader.gif
     
  12. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    575
    Actually, the Texture Array node is in already along with Texture 3D, didn't check when I got the latest from GitHub until now. So these will be coming in the next package release

    upload_2018-5-29_4-36-48.png
     
  13. izym

    izym

    Unity Technologies

    Joined:
    Jul 27, 2013
    Posts:
    24
    Support for the built-in render pipeline will not be implemented. HDRP support is in GitHub master and will be release in a package for 2018.2 soon. (That package will also go into the 2018.2 Editor.)

    Could I get you to make an issue with a repro project on the Unity Issue Tracker? :)

    Thanks! :D HDRP support, texture arrays and vertex manipulation is in master and will be arriving in a package for 2018.2 soon. Regarding the rest, we're working towards a solution that allows us to add support for this without tying the graph to a specific render pipeline.

    Custom nodes are still a bit of a WIP :/ What's documented on GitHub for Custom Nodes is the most stable thing we're currently exposing. If you need more than that, you unfortunately need to go adventuring a bit in the code base, but keep in mind that this is still in preview, and things might break in the future.

    Totally agree on the shadows.
     
    Corvwyn likes this.
  14. Japa

    Japa

    Joined:
    May 4, 2013
    Posts:
    33
    Few things that I find missing in shader graph, at the moment:

    * TexelSize variable support. (this one I was able to easily add on my own, and have made a pr for it)

    * Clip functionality, for cutting off the rendering at arbitrary places unrelated to the alpha map.

    * comments. Either comment blocks, or adding comments to nodes. Sometimes large graphs can be difficult to navigate.

    Also, when using vertex colors, I found a bug where the input struct would get float4 vetexColor, instead of float4 VetexColor, which I'm looking to reproduce.
     
  15. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,409
    Looks like they have fixed this on github. I'm not sure exactly when this happened and the following is just a correction to the changelog, but it indicates this has been done anyway.

    https://github.com/Unity-Technologi...mmit/77d8a866d1c1b747662246adc95af6a28e2e9f38
     
  16. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Technologies

    Joined:
    May 5, 2014
    Posts:
    1,009
    Have you tried using the AlphaClipThreshold output in the Master Node?
     
  17. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    I know you guys are yourself back-to-back to smooth out quality. But I run behind deadline on a project myself. The screenshots should be enough to replicate the issue. Just generate emission & metalic from something like a smooth step edge.

    PS: Unity should hire in general a few interns who's job it is to create issues from forum posts and stackoverflow issues. For an enduser, even if there is a lot of passion for unity, it takes on minimum 30min-60min to write something up + checking existing issues. And its hard to crowd source quality on top of beta testing rigorously from an independent professional with limited time.
     
  18. Japa

    Japa

    Joined:
    May 4, 2013
    Posts:
    33
    I couldn't get it to do anything. I assumed it worked the same way as the alpha threshold in the standard shader.

    Ill try treating it like the clip function, and see how it works.
     
  19. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Technologies

    Joined:
    May 5, 2014
    Posts:
    1,009
    Try setting the Alpha value to 0.5 then use the Clip Threshold. :)
     
  20. daffrendo

    daffrendo

    Joined:
    May 29, 2018
    Posts:
    3
    Thank you very much for this! What is amazing is that it took your video 6 seconds to show what to do. But the Unity tutorials leave this part out :p

    Your help was excellent, I appreciate it!
     
    scheidtventureestate likes this.
  21. Japa

    Japa

    Joined:
    May 4, 2013
    Posts:
    33
    On further testing, it seems like simply setting the input value of the clip threshold directly doesn't work. It needs to actually be attached to something.
     
  22. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    Anyone know how to graph a billboard shader?
     
  23. daffrendo

    daffrendo

    Joined:
    May 29, 2018
    Posts:
    3
    FEEDBACK

    A couple of Issues:
    1) Every time I save scene, close out, and come back in, I get the dreaded "Purple Mats of Death", where the mesh is purple. I have to go into each Shader graph for that mesh (all materials) and 'Save Asset', then it loads in each mat to the mesh
    2) I deleted a shader graph by accident, then when I hit Undo, it couldn't restore it

    Also Question -
    In Unreal, blending a mat is accomplished by Linear Interpolate Node, which allows you to assign Texture;/value A, and then Texture./Value B. And, this Linear Interpolate Node then has a bias knob, if you will, that lets you slide the value from A to B, to blend it.

    in Unity's I have to type in 4 Values (X, Y, Z, and W) when entering the blend-value part, to formulate the same. Admittedly it gives a higher precision of control, but just curious, would there be a more simpler way to blend the 2 without, say by entering a value once, as opposed to needing to enter the 'same' value 4x.
    THX!
     
    konsic likes this.
  24. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    805
    Just connect all 4 Inputs to the same scalar value.
     
  25. izym

    izym

    Unity Technologies

    Joined:
    Jul 27, 2013
    Posts:
    24
    The TexelSize is a good point, we're looking into it. Thanks for the PR :) Clip functionality is already in, but it has to be connected to something right now. We'll fix that. And totally agree that we need comments in the graph.

    Yeah, this should be fixed now :) But just to be sure, which nodes were you seeing it happen with? (I guess that's more of a question for AurelWu)

    Totally understandable, we'll take a look at it :)

    Hm, that's not good :/ What do you mean by close out? And could you open an issue for this? :)
    Unity doesn't support undo of asset deletion. There's a prompt when you delete assets which says that the action is not undoable.

    Which node are you using for this currently?
     
    scheidtventureestate likes this.
  26. Laurens-Paladin-Studios

    Laurens-Paladin-Studios

    Joined:
    Apr 25, 2015
    Posts:
    49
    Hi there Unity,

    Thank you for making the Shadergraph, for working in lightweight render pipeline it's already becoming our tool of choice, we are working with version 1.1.9. There is a small interface feature that I feel is missing;
    • Separated outputs for example a vector 4 or vertex colors. (just like a sample 2D texture sampler has). At this moment there is a lot of extra clutter by having to use the split node.
    My two cents.

    Keep it up!
    Laurens
     
    Last edited: May 30, 2018
  27. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    Same here... Unity's Shader Graph's a GREAT tool for someone who doesn't know a lick of openGL.... Like myself... What I would say's the next step forward would be image effects, shadows, and refraction.
     
  28. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    ALSO! I could've said this before, but I want to billboard a sprite... How would I do that? I know this involves matrix nodes and plugging them into our sample sprite UV... but what specifically?
     
  29. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    upload_2018-5-30_11-17-29.png And how to make these decals while we're at it.
     
  30. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    Not sure if its a feature request or general question for help (@MythrilMan51). If that what you want to do is already implemented, you probably find some general implementation examples in the Shader Graph Example Library on Github. Though it is "a little older" compared to what is now possible.

    upload_2018-5-30_21-59-40.png
     
  31. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    hwaet, sqallpl and Grimreaper358 like this.
  32. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    I've seen them... Hadn't seen a billboard sprite... But I'll have to check again.
     
  33. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    ..... Which it doesn't...
     
  34. izym

    izym

    Unity Technologies

    Joined:
    Jul 27, 2013
    Posts:
    24
    Thanks :D I agree that we need to find a good solution for this, as the split node is a bit clunky.

    Image effects would have to go through the Post-Processing stack. We've done some experiments with using Shader Graph to create new image effects though, but we're focusing our efforts on the LW and HD support for now. Can you clarify what you mean by shadows being the next step forward? Refraction will eventually be possible with HDRP, but our HDRP support is fairly basic at this stage.

    This is something that could potentially make sense to do a node for. Note that you'd need the new Vertex Position support in the upcoming package. Alternatively, you could modify the rotation matrix for the object in C#. To do it in Shader Graph you could do something like this, but do note that the tangent frame is not affected by this, so the shading might look a bit weird: https://i.imgur.com/MWQpfIw.png
    For an explanation of the technique, see here: http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/
    There's some info on how to do it in C# here: http://wiki.unity3d.com/index.php?title=CameraFacingBillboard
     
  35. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    71
  36. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    Well.... If I mean by that... I would mean lighting... to edit it to say, make negative light, Blend it, OR to aim for a different lighting style...

    Like for example.
    As another example, I wrote this shader for deferred before I upgraded to Unity's LWRP... Where there isn't much of a slot to slap it into, BUT I practically hard lit your light's attenuation with its color, multiplied it with its color, AND multiplied it with its attenuation. THIS results to what I think would be more interesting lighting, and THESE PNG's that I whipped up in Photoshop could give you some rough comparisons:
    what we have 2.png Unity's default Azure
    What I want 2.png Upon hijacking Unity's default deferred.
    what we have.png Unity's Default orange
    What I want.png My Frankenstein Shader
     
    scheidtventureestate likes this.
  37. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    And take your time on refraction... It sounds like hard work programming a shader graph, but SO FAR, this's good progress. Keep up the good work.
     
  38. Uteki

    Uteki

    Joined:
    Apr 17, 2017
    Posts:
    5
    Hello
    Have we any designated way to request a feature? There should be some sort of collection tool but I can't seem to find anything about it.

    Cheers
     
  39. ChristmasGT

    ChristmasGT

    Joined:
    Sep 21, 2011
    Posts:
    7
    Hey there! Just wanted to check in and see if there was any movement at all on the additional of getting access to the cameras depth buffer.

    What I'm hoping to do is replicate this shader: http://mehm.net/blog/?p=1218 via the Shader Graph.

    Thanks!
     
    Last edited: Jun 1, 2018
  40. matheusfaria

    matheusfaria

    Joined:
    Mar 11, 2016
    Posts:
    2
    Hi, using the CodeFunctionNode for building my own node, I found that it is not possible to use the SamplerState Slot. I am just trying to recreate the Texture 2D Sample node using the CodeFunction Node.

    Code (CSharp):
    1.     static string Tex2D2Function(
    2.         [Slot(0, Binding.None)] Texture2D Texture,
    3.         [Slot(1, Binding.MeshUV0)] DynamicDimensionVector UV,
    4.         [Slot(2, Binding.None)] SamplerState Sampler,
    5.  
    6.         [Slot(3, Binding.None)] out ColorRGBA Out)
    7.     {
    8.         return
    9.             @"
    10. {
    11.    Out = SAMPLE_TEXTURE2D(Texture, Sampler, UV);
    12. }
    13. ";
    14.     }
    The error:

    Code (CSharp):
    1. Preview shader for graph has 2 errors:
    2. Shader compilation error in graph at line 64 (on d3d11):
    3. undeclared identifier '_ConvolutionNode_1B0FBC37_Sampler'
    4. Shader compilation error in graph at line 64 (on d3d11):
    5. undeclared identifier '_ConvolutionNode_20D75873_Sampler'
    6.  
    7. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    8.  
     
  41. davidcox70

    davidcox70

    Joined:
    Oct 19, 2016
    Posts:
    19
    Is there a way of accessing the diffuse value to be used as a math input in the Shader Graph? I want to create a shader where the emission value is reduced in parts that are lit by a light. For example, think of the night lights on planet Earth - they are not illuminated on the side of the Earth lit by the Sun. I have previously achieved this by subtracting 2*DIFF from EMISSION within a shader. Can it be done in the Shader Graph? I couldn't find an obvious property for it.

    Thanks :)
    DC
     
    MR-Heavy likes this.
  42. BN2111

    BN2111

    Joined:
    Aug 11, 2017
    Posts:
    3
    Hello,
    I have tried to set up an emissive material using the Shader Graph, however there's no glow around the mesh and it doesn't light the surfaces around either. Instead, the lightweight standard shader in the same level works fine. Am I missing something in my shadergraph? or is this a feature that isn't available at the moment?
    Thanks!

     
  43. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    ... Are you looking for Bloom? Because you would need to add a Post processing volume AND a post processing layer.... I USUALLY put this on my camera and BANG! slap in bloom and work from there... Allow me to whip up an example.
     
    BN2111 likes this.
  44. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    upload_2018-6-2_16-10-9.png
    And you ULTIMATELY get this...
     
  45. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    upload_2018-6-2_16-13-1.png Even though I would need to, ultimately, deal with the amount of bloom, like what you see here.
    And DON'T screw with primaries or secondary... At least desaturate them if you do so.
     
  46. febucci

    febucci

    Joined:
    Sep 3, 2015
    Posts:
    18
    Feature request: Spriterenderers
    Hello! I know I'm not the first to say that, but I'd love to use the shadergraph with the spriterenderer component.

    As you already know: "_MainTex" property needed.
    Even with the 3.0.0-preview (found on github) when I click Property Exposed it says "Redefinition of _MainTex", without working

    It also doesn't work with the FlipX of the spriterenderer

    Would be awesome if it will be possible to achieve the "Sprites-Diffuse" with the shader graph in the future, it would be a game changer for a lot of 2D developers!

    Thank you in advance, have a nice day!

    Edit: grammar
     
    Last edited: Jun 3, 2018
  47. SniperEvan

    SniperEvan

    Joined:
    Mar 3, 2013
    Posts:
    161
    Since we can't get any depth information with the build in nodes I'm trying to find a workaround.

    I've tried two approaches but ran into dead ends on both. If anyone has advice for working through this let me know.

    First approach: enable camera depth in the SRP Render Pipeline and then try to read _CameraDepthTexture into a texture property in the node graph. Theoretically, we should have the power to save the depth information to an image, and use that image. The SRP pipeline has a checkbox for rendering depth texture, and the documentation says that gets saved to a _CameraDepthTexture global. However I can't seem to access that in any way. If I could save it to an actual image, or just assign it directly to a node graph texture property that would be great. I just can't figure out how to do that.

    Second approach: My other approach was to enable Camera Depth in the SRP and then write a custom node to read that value. Here's the code I attempted. I don't know the CORRECT way to read the _CameraDepthTexture value (from either C#, or the shader language).

    Here's the custom node I attempted but it fails to compile since I'm not grabbing _CameraDepthTexture correctly:
    Code (CSharp):
    1.  
    2. using UnityEditor.ShaderGraph;
    3. using System.Reflection;
    4. using System;
    5.  
    6. [Title("Custom", "Depth Node")]
    7. public class DepthNode : CodeFunctionNode
    8. {
    9.     public DepthNode()
    10.     {
    11.         name = "Depth Node";
    12.     }
    13.  
    14.     protected override MethodInfo GetFunctionToConvert()
    15.     {
    16.         return GetType().GetMethod("CameraDepthFunction",
    17.             BindingFlags.Static | BindingFlags.NonPublic);
    18.     }
    19.  
    20.     static string CameraDepthFunction(
    21.         [Slot(2, Binding.None)] out Texture2D Out)
    22.     {
    23.         return
    24.             @"
    25. {
    26.    Out = _CameraDepthTexture;
    27. }
    28. ";
    29.     }
    30. }
    31.  
    32.  
    Thoughts?
     
  48. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    439
    Hi,

    I have spent almost 3 hours trying to get Shader graph up and running without success. I have installed everything through Package manager. I'm using Unity 2018.2.b6 and these packages:

    upload_2018-6-4_12-6-6.png

    When I try to set Edit -> Project Settings -> Graphics -> Scriptable Render pipeline Stats I get nothing to select:
    upload_2018-6-4_12-13-28.png

    Do anybody know what could be happening?
    Thanks in advance.
     
  49. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    327
    You need to create this settings first: project/create/rendering/etc...
     
    hexdump likes this.
  50. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    483
    one problem I'm having is with reflections and reflection probes, it seems that if you scale up a plane, apply a graph-based material, and then use a reflection probe it doesn't sample it correctly, I think it's the box projection that breaks? As well as what looks like vertex lighting style distortions for highly smooth / metallic settings.

    Is any of this a known issue or being worked on?

    EDIT:

    well that explains that.
     
    Last edited: Jun 5, 2018
Thread Status:
Not open for further replies.