Search Unity

  1. Unity 2019.2 is now released.
    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. eduroam

    eduroam

    Joined:
    Jul 2, 2015
    Posts:
    12
    In the new version of HDRP 4.0 is possible. Cool.
     
    wyatttt likes this.
  2. Viggy1996

    Viggy1996

    Joined:
    May 11, 2017
    Posts:
    39
    Hey Is Shader Graph Compatible with normal normal Unity Render Pipeline? You know the one that says "3D" instead of LWRP or HDRP when creating a new project.
     
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    163
    With "Legacy" pipeline. No and not planned.
     
  4. SkywatchGames

    SkywatchGames

    Joined:
    Mar 28, 2017
    Posts:
    4
    Hey all,

    I've noticed there is a new "Scene Depth" node in shader graph 4.0. Seems like this node returns the Linear01Depth of _CameraDepthTexture. (https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/1673/files

    From testing it appears that the float value returned from Linear01Depth is assigned to all 3 axes of the Vector3 returned from the Scene Depth node.

    Beyond that I'm having trouble getting the node to work. Simply tying the node into the albedo or alpha of an unlit shader returns odd results. Anyone have any luck getting it to work?

    Thanks!
     
  5. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    99
    Hi there. I'm trying to use the reflection probe node with sahdergraph 3.0.0 and the node itself seems broken. Here is a screenshot of the problem. Am I doing anything wrong ?
     

    Attached Files:

  6. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    146
    Are there plans to introduce a 'simple lighting' template to go along with the unlit and PBR templates for the LWRP?
     
  7. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    671
    Does anyone have an example on how to use 2f texture arrays?
     
  8. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    271
    Hey! This is possibly a bug. Might be related to a similar issue with the Sample Cubemap node. Will look into it. Thanks!
     
  9. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    271
    What kind of odd results are you seeing?
     
  10. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    271
    No problem! A note for everyone that this isn't the intended behavior and we have a bug report for it
     
  11. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    671
    Anyone have a good example how to use 2D texture array node
     
  12. SkywatchGames

    SkywatchGames

    Joined:
    Mar 28, 2017
    Posts:
    4
    I'll admit I'm quite new to shader work, so this may be intended behavior and I'm simply not doing it correctly.

    Attached are two images, my graph, and my view in unity.

    depth node graph.PNG depth node unity.PNG
     
    larex39 likes this.
  13. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,309
    Is there a way to make a custom node that can add a #pragma to the shader?
    I want a node that sets up the shader for instanced indirect support and need a way to include the setup function
     
    P_Jong likes this.
  14. SirNW

    SirNW

    Joined:
    May 29, 2018
    Posts:
    12
    I'm having issues trying to send shader graph materials via export package. Is this just not possible because it is still in "preview"?
     
  15. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    483
    I did have some strange behaviour at some points, but not too bad.

    The shader graph is 'the same' as the shader, so if you have a shader graph and a material, the graph should com along as a shader file.

    On import however, is where it can be funny, especially if you have subgraphs. The trick is to open and save the shader (and possibly subgraphs too, maybe do them first) in the new project / whatever you're importing into.
     
    SirNW likes this.
  16. SkywatchGames

    SkywatchGames

    Joined:
    Mar 28, 2017
    Posts:
    4
    Hey. I think my example was pretty poor on my previous post about the scene depth node.

    Attached is a better example. The first image is a windowed view and the second image is a fullscreen view.

    The graph is just directly inputting the scene depth node into the base color of the material. I have 1 camera in my scene. The material is applied to a flat plane (testing depth for water) depth windowed.PNG depth fullscreen.PNG
     
  17. SirNW

    SirNW

    Joined:
    May 29, 2018
    Posts:
    12
    Thanks, That's good to know. I was able to get a test scene to work but for my actual project (quite a bit larger one), it is crashing immediately every time I put the lightweight pipeline asset into the graphics settings. Frustrating stuff.
     
  18. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    163
    How shader graph will handle camera relative rendering in hdrp?
     
  19. azeroon

    azeroon

    Joined:
    Oct 4, 2018
    Posts:
    2
    Hey don't worry, im having the same problem, scene depth node is currently broken, plus i'm getting some weird crossbleeding between scene window and game window.

    I think we just grabbed it too early.
     
  20. poa123

    poa123

    Joined:
    Jul 13, 2018
    Posts:
    22
    @wyatttt Please i need help.

    There is some posts (no answer) in this thread reporting an issue on Shader Graph when the "Script Runtime Version" is set to ".NET 4.x equivalent", which is the default for Unity 2018.3.

    In this case, the Unity Editor appears to be importing the OS config for decimal separator (in my case and many others i see, comma instead of dot). We can digit a dot, but Unity consider it always a comma.

    This cause a huge problem in Shader Graph, whenever a variable is set to a decimal value using comma (the graph does not compile and all nodes become pink).

    Someone already report a bug:
    https://issuetracker.unity3d.com/is...nspector-fields-with-experimental-net-4-dot-6

    Please, there is any chance that you can look for any info regarding this issue?
     
    Last edited: Oct 10, 2018
  21. SirNW

    SirNW

    Joined:
    May 29, 2018
    Posts:
    12
    "Feedback wanted" Hey guys, here is my input on the shader graph and what I think could use some work.

    The Blackboard.
    1. When deleting the property node off the tree, it should also delete off the blackboard (or at least make the green dot go red).

    2. When you select/highlight a property node on the blackboard, the node it is referring to in the tree should also be highlighted and vice-versa if you select it from the tree.

    3. I'm not sure why you can only edit property nodes on the blackboard, maybe it was an attempt to force organization but instead, it feels disconnected and that's because it literally is.

    4. It could help to use some form of a visual indication that properties (especially for Subgraphs {not to mention a right click option to "select in project" would be nice}) are different from standard nodes. Maybe a lighter grey or blue tint for starters, though having different icons would be ideal.

    Maybe this part is still a work in progress, and my comments only sound like polish work but I believe this would save many, new users, artist, and visual learners a ton of headaches. Thanks for reading.
     
  22. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    Something that would be "nice to have" is what Allegorithmic's Substance Designer calls "dockable nodes". It basically allows you to collapse/shrink a node and make it attach to/follow another node it is an input for. Anyone who has used Substance Designer knows how useful this is in keeping things organized and tidy.

    There doesn't seem to be any documentation of this specific feature (that I can find), other than the fact that it uses the D key as its shortcut key, but I did find this little gif that kinda illustrates it:


    But of course that is more of a convenience thing and not a deal breaker. But, would be cool to have someday maybe. :)
     
    hippocoder, sewy and SirNW like this.
  23. Zipe92

    Zipe92

    Joined:
    Mar 5, 2015
    Posts:
    26
    Hello, I'm having a big problem with shader graph.

    A lot of times it gives me the error "Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)", it seems to be related to the properties, the error usually appears when I declare a new property, and If I remove all the properties it disappears. In this situation is quite difficult use shader graph, I can't use properties.
    Does anyone else have this problem and know how to solve it?

    I have already submitted a bug report (Case 1032011).
     
    Last edited: Oct 10, 2018
  24. poa123

    poa123

    Joined:
    Jul 13, 2018
    Posts:
    22
    I believe this is related to the situation described on my post (third above yours)... a comma in a property node cause that error.
    EDIT: if it is the case, you can try change the "Script Runtime Version" (Settings / Player) to the old default (.NET 3.5).
     
    Last edited: Oct 10, 2018
  25. azeroon

    azeroon

    Joined:
    Oct 4, 2018
    Posts:
    2
    So I had time to do some more testing:

    I am using both 2.6 on my main branch and 4.1.0 on experimental branch with the same project.

    (v2.6) Unity stable , i presume some have been fixed, but i will write them anyways

    1, When you copy a graph from subgraph, you can paste it into .shadergraph file - it gets pasted with subgraph output node which you cannot delete afterwards, only workaround is to right click it, convert this subgraph output node to subgraph (ironic)) and delete this new entity.

    2, When you output from cam to rendertexture, it doesn't render scene depth no matter what i do.

    3, i get "cannot cast float4 to float3" error randomly even though there are no float4s in the graph, restarting unity usually fixes this.

    4, Drag line > Drop > start searching > try to click your desired node and smile while appreciating the convenient uxd > nah brah. : focus often fails and the node lookup container flips me and disappears.

    (v4.1.0) Unity latest beta

    ,, I wanted to use scene depth and create intersection shader for water edge blending... yes, I failed. '' - my last 4 days of vacation. Me.

    1, when using Scene Depth node there is a crossbleed between scene window and game window in the result. The depth data in Scene Depth node becomes a weird chaotic split/overlay of the two windows. Additionally any manipulation with depth, either from texture or scene depth node results in strange artifact, as if a scaled down depth map was subtracted from all camera rgb outputs, resulting in a strange flickering scene-wide shading issues - note that this artifact leaks out from the material object space and actually affects entire video output.

    2, the performance is noticeably worse than v2.6, i dont know if thats caused by srp or shader graph. (about 40% drop in fps with identical settings and scene, occasional freezes and lags) - I know its experimental preview alpha beta testing purposes only work in progress thing.. just wanted to let you know. In case someone forgets to fix it, you know..

    (feature request [sob])

    1, please allow us to pass fixed size float(1/2/3/4) arrays in.

    2, Can you please implement a simple range/if nodes? possibly with step >invert >subtract flow, allowing only values greater/lesser/in range to pass through, else {value, default 0} .. i know i could make that one myself but i hate reflection and the way these custom nodes are implemented, somehow that reflection approach looks like a very desperate workaround a junior programmer found on google two days before go-live. (with a grain of salt please, im just kidding :) )

    3,Please consider implementing node grouping into one node with the corresponding outputs/inputs. I know I ask a lot, but it would be really nice to have the option to hide a giant chunk of nodes that clutter the view. Also I know I can use subgraphs, but I cannot use subgraphs within subgraphs and thats exactly the place where this gets depressive. I have a very large objectspace based minmax height blend-in-blend-out terrain layer subgraph with various layered textures inside, slope based textures for rocks, etc etc and it really looks like a plot diagram for game of thrones with all the twists and jon snows.. a Line Rider level on its own.

    4, It would be really useful to have an option to turn off the long and disruptive preview generation on every change. Currently when I need to do changes in my large subshaders i just cut the last line off, but a small checkbox someplace convenient would really help.

    5, please fix scene depth :D or tell me any other way I could create intersection / depth shader in shadergraph, my water is uglyy.

    And now a few questions..

    1, Does anybody have a working intersection shader in SG? :D

    2, Do you plan to support tesselation?

    3, Is there a roadmap somewhere?

    4, Will we have SSS and translucency ?

    Thanks for your great work, I really love working with SG and my project is revolving around it at the moment. No, seriously, even if some of the things I wrote may sound ignorant or wrong, I dont mean them that way, it's a really great tool and I admire your work.
     
    P_Jong and Elecman like this.
  26. Zipe92

    Zipe92

    Joined:
    Mar 5, 2015
    Posts:
    26
    Yes, probably it is the same bug. I cannot change my runtime version, but I changed the OS language.
    I have not deeply tested it yet, but with English as language it seems to work without problems.

    Thank you for the help.
     
    poa123 likes this.
  27. Roukira

    Roukira

    Joined:
    Oct 12, 2018
    Posts:
    1
    Hello, I have a question regarding this.
    My custom node takes a Vector3 x in argument, and I need to apply to x a function from a class I created. The issue is I didn't understand how that can be done. Any idea?

    Thanks!
     
  28. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    122
    Any chance we could make the alpha layer for premultiply more like a multiply? It would PRACTICALLY make Premul more like the ultimate blend mode... Or make a multiply equivalent of Premultiply.
     
  29. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    217
    Bump that - could someone from the Shader Graph team perhaps tell us if Pixel Depth Offset (like in UE4) is coming? I also need it for vegetation...
     
    awesomedata and SirNW like this.
  30. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    57
    I can't seem to get rid of the sphere in the preview (using Unity 2018.3.0b5 and Shadergraph 3.3.0-preview)
    The sphere is there no matter what other type of object I select, along with it. IE, both are displayed.


     
  31. SirNW

    SirNW

    Joined:
    May 29, 2018
    Posts:
    12
    Same here, that is actually the reason why I am now learning Unreal. Many people say Unreal is harder, but that's not true for artist, it is much more friendly to visual learners.
     
  32. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    83
  33. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    271
    Heya, this a known bug. Preview buffers aren't being cleared properly or something like that. If you zoom in and out on the preview, you should be able to see your mesh.
     
    Clyde_Coulter likes this.
  34. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    271
  35. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    83
    Doesn't work on 2019.1.0.a5 with HDRP 5.0.0. Just tested on 2018.3.0.b3 with HDRP 4.1.0 and it works fine.
     
    Last edited: Oct 17, 2018
  36. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    271
    Ok, thanks! I'll check it out
     
  37. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    I’d like to second this request! Thank you.
     
    adslitw likes this.
  38. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,580
    Hey all, in an FPS game the weapon is often a different FOV to the camera. We would like to construct a vertex shader to change the FOV slightly of a given rendered mesh as using multiple cameras is not really a good idea. I think this possible as it's really only a camera relative tapering effect isn't it?

    Any suggestions or examples how to do this would be very appreciated!
     
  39. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    483
    First, get a reference or baseline FOV.

    Second, since you're mimicking the effect of a camera change, you can work entirely in screen space. Or local space maybe? might want to get familiar with the different spaces and the transform node.

    Third, get a reference point from local camera space (0.5 right, 0.2 down, 0.3 forward of the camera = the bottom right corner of the screen). You can probably forget the forward axis really, since the near and far planes don't change distance. And since the goal is to ignore FOV anyway if I've got this right.

    Use trigonometry. You should have access to camera FOV in the shader under the camera node (I think?). Work out a way to tie the camera FOV to position (either in screen space or local space). Don't forget to work in Radians or Degrees, or use both like the dirty animal I am.

    Make the function that takes camera FOV and outputs to the position part of the node.

    Check to see that it hasn't borked the normals too badly and they're no longer facing the right direction. Maybe try with a cube as a gun; it's easy to see if the reflections are going nuts where they should be solid and unchanging?

    What might help is a script on the game camera that executes in edit mode and smooth ping-pongs / lerps between 2 FOVs every second so you can watch in your game window to see if it's working.

    Then, once you've got that working, you unplug the Camera FOV node and put in a float value, maybe make it global and set it in a script somewhere so you don't have to mess around with it defaulting to something else in the materials.
     
    wyatttt and hippocoder like this.
  40. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,580
    Thanks will give this a try. It's fiddly isn't it!
     
  41. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,374
    Did you find the DepthBias Rendering solution (FPS Rendering) for HDRP?
     
  42. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,580
    I wasn't able to progress with the above proposed solution, nope :/
     
  43. eejitb

    eejitb

    Joined:
    Apr 7, 2014
    Posts:
    5
    hi, sorry if this has already been answered, there's a lot to trawl through ...

    what do we need to do to in a LWRP shader graph using 'PBR Master' to fix specular reflections warping across edges?

    lightweight standard shader (top of cylinder primitive ) :
    Untitled-1.jpg

    basic PBR Master graph :
    Untitled-2.jpg

    thanks
     
  44. skilfuldriver

    skilfuldriver

    Joined:
    May 20, 2015
    Posts:
    19
    I managed to get depth fading in HDRP (sort of) working @SkywatchGames @azeroon and anyone else who was trying.

    upload_2018-10-18_18-42-45.png

    To sample the depth you have to modify the screen position going in to the Scene Depth node. The actual values vary so I use a material property. It depends on the size of the game window. But once you've set by eye it works (although it's possible to break it again if you resize the window in particular ways).

    upload_2018-10-18_18-40-45.png

    To get the depth fade value you need to convert the Linear01Depth you get to LinearEyeDepth which is as easy as multiplying by the far clip. Then subtract the Screen position W but set the mode to Raw.

    upload_2018-10-18_19-0-8.png

    I hope this helps (and becomes redundant immediately). It's useful for testing anyway! If anyone has insight into the Scene Depth UV issue let us know. We can at least now get something close to a water shader.

    upload_2018-10-18_19-9-59.png

    Matt
     
    larex39, irenya, Rowlan and 8 others like this.
  45. wyatttt

    wyatttt

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    271
    Could you open a bug report for this, please?
     
  46. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    Another request... Grid snapping!

    My OCD is going crazy trying to line up nodes next to each other. :p

    I guess it should be an optional feature as you may still want free-form placing (what it is now) in some cases. Maybe a global toggle for either grid snapping or free-form placing..? Or maybe even just a keybind, or similar, that you hold down to make the current node you're dragging snap to the nearest spot on the grid? Not sure what would be the best implementation...

    Another "nice to have" request to add along with my other one. Not a "my game is ruined if I don't have it!" feature, but would be nice to have eventually. :)
     
    sand_lantern likes this.
  47. ScTar

    ScTar

    Joined:
    Oct 7, 2012
    Posts:
    14
    I made a blur node using a texture and sampler, but this is quite limited. It can only be applied to textures. I need a way to sample neighboring pixels in an RGBA array. To do this would it require a node that creates an additional pass or render texture? Is there a solution or one on the way?

    It would be convenient to have access to HLSL functions. Maybe cg includes could be added to the blackboard, or maybe from within node scripts.
     
  48. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    483
    I'm getting some small error messages when making custom nodes; "does not have meta file". Using 2018.2 and getting SGE from the package manager (which puts it outside the project Assets folder, which I assume is the problem). Is there an official import process that will handle this? Trying to keep a clean error bar.
     
  49. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    51
    Any idea, if it's possible (if so, how) to declare CGPROGRAM variable in shadergraph? (For creating the array of floats for example)
     
  50. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    542
    Hi,

    I am a long time user of Amplify Shader Editor, trying out Shader Graph for the first time.

    It seems the Shader Graph source file isn't designed to be open directly, may I ask how should users inspect the shader source code generated? So that they can modify them beyond what's currently supported?

    For example, adding GPU instancing properties?

    Thx!
     
Thread Status:
Not open for further replies.