Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    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. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    Oh, dang. I implemented it in C# code so I could Gizmos.DrawRay of the normal in the scene view (I did that so that I could find the height anyway, in code) and the rays go round like a clock.
    Edit: But, they are in time with the waveshape, but up in the valleys and down in the peaks.
    Edit2: Of course it is....Pt marches on and the other variables don't offset it in the opposite direction.
     
    Last edited: Aug 22, 2018
  2. MrJayLim

    MrJayLim

    Joined:
    Aug 5, 2017
    Posts:
    1
    Hello.
    I am testing Shader graph and noticed that transparent PBR shader casts shadows same as non-transparent. Search on this thread has not yieled results. Can you tell me: it is bug in Shader graph or am I doing something wrong?
     
    grenappels and konsic like this.
  3. Desoxi

    Desoxi

    Joined:
    Apr 12, 2015
    Posts:
    195
    Hey,
    how am i supposed to use the method "GenerateNodeFunction" when creating a custom node?
    Im using 2018.2.0f2 and the method signature is as follows:

    Code (CSharp):
    1. public override void GenerateNodeFunction(FunctionRegistry registry, GraphContext graphContext, GenerationMode generationMode)
    Even some nonesense method like this doesnt work:

    Code (CSharp):
    1. public override void GenerateNodeFunction(FunctionRegistry registry, GraphContext graphContext, GenerationMode generationMode)
    2.     {
    3.         registry.ProvideFunction("mod289", s => s.Append(@"
    4. inline vec3 mod289(vec3 x)
    5. {
    6.    return x;
    7. }
    8. "));
    9. base.GenerateNodeFunction(registry, graphContext, generationMode);
    10. }
    And this is how the node looks in shadergraph when dont uncomment the GenerateNodeFunction:
    ShaderGraphScreen.PNG

    I noticed that the signature has changed because all examples i could find dont have the "GraphContext" parameter in the method.

    EDIT: I just found out the reason it did not work! Its because of the "vec3" type which is a HLSL type but we need the GLSL "float3" type.
     
    Last edited: Aug 22, 2018
  4. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    How to access time node via script ?
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    You don't. If you want to manually control the shader's animation you'll need to use a property. If you just want to be able to match the same value that the shader is using, it's Time.timeSinceLevelLoad.
     
    konsic likes this.
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Two bugs I found recently.

    First is the Triplanar node when set to Normal mode only works properly if the input position and normal are in world space alignment. Anything else the normal will be wrong. This is because in Normal mode it applies a world space to tangent space transform regardless of what space the input position and normal vector values are in.

    Here's a SubGraph version of the Triplanar node (one that does both normal and albedo, or really any generic texture) that does everything in Object Space.


    The triplanar node should expose an option for selecting the space, or passing the tangent and bitangent in.


    This also exposed the fact that the Normal, Tangent, and Bitangent vectors are wrong in any space but world space if the object is scaled and have to be manually normalized.


    Oh, and the normal map issue on scaled meshes is back in LWRP 3.0.0, it was fixed in 2.0.8
     
    Last edited: Aug 22, 2018
    URocks, Korindian and konsic like this.
  7. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    If property is a slider, how can I access it in script and set it to animate from 0 to 1 ?
     
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    A slider is just a float value with UI to clamp its value (you can set it to anything via script). So you set it like any other float, or "Vector 1" (uhg) value. Make it a property, then change it's reference value to something useful instead of the default "Vector1_randomcharacterstring" like "_Anim". Then you can set the value on the material using SetFloat("_Anim", value)

    https://docs.unity3d.com/ScriptReference/Material.SetFloat.html
     
    Last edited: Aug 22, 2018
    konsic likes this.
  9. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Vector Displacement - in Shader Graph




    I apologize for not digging into this myself yet, but what nodes would one use to go about creating Zbrush-style Vector Displacement map (shaders) in Shader Graph? -- I know they can probably be done manually (with tesselation), but are these available or supported officially yet?

    Here's an example:

     
    VirtualPierogi and konsic like this.
  10. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    For now, tesselation isn't in (I think). So, every vert has to come from somewhere. Go to your preferred 3d modelling program, and make a 1m*1m flat 2d plane with lots of verts. Think 100x100 grid or something. Export that into unity as a replacement for tesselation now.

    Then you work on the shader that actually moves all those verts. First step is figuring out which way is which; in that example, blue looks like it's out, red is right and green is up. Then you figure out which way your normal, binormal and tangent directions are. For a plane, normal will be out (away from the plane), and the other two could be left/right or up/down.

    Then you multiply the channels by their direction and combine (node) them. So map.red * tangent, map.green * binormal, map.blue * normal. Then that goes into position.

    Just remember that the position doesn't change lighting, so you need to feed the master output node a normal map as well.

    In other news, a look behind the scenes before I release the demo scene!

    On the left; what the ocean's reflection probe sees - a 2d plane for the clouds, and a single potato-level dual-colour-dissolve quad instead of fireworks particles + trails!
    On the right, the payoff; despite the cloud particles overlapping horrendously at 2x supersampling resolution, the load is balanced and light!
    lwrp_cheap_tricks.png
     
    awesomedata likes this.
  11. Andrey_Graphics

    Andrey_Graphics

    Joined:
    Oct 29, 2015
    Posts:
    140
    Nodes for shader graph
    http://u3d.as/1gkf
     
  12. FGPArthurVII

    FGPArthurVII

    Joined:
    Jan 5, 2015
    Posts:
    106
    Pretty Great Tool, but I still miss Refraction (Visual Distortion), Normal Direction, Light Direction nodes and a customizable Master.
     
  13. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    Pretty great work! Крутой!
     
    Andrey_Graphics likes this.
  14. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    Issue: I updated to the latest unity version & packages (from 1.9-preview to 3.0-preview). When I hit play, I get spammed in the Console the following, but still runs seemingly the same:

    Metal: Fragment shader missing buffer binding at index 4 (_LightIndexBuffer / LightweightPipeline/Standard (Physically Based))

    and i.e.
    Metal: Vertex shader missing buffer binding at index 4 (_LightIndexBuffer / can-outside-reveal-in-out_simple_texture)


    upload_2018-8-24_11-48-22.png

    I googled and found this Issue:
    Any ETA for 3.2.0?
     
  15. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Think I found a bug - exporting a bunch of shaders and materials by Unitypackage into a fresh project with LWRP SGE and PP packages pre-installed, the shader graphs that use a sub-graph seem to behave badly; reverting to default albedo//lighting. Opening it in the SGE and re-saving it fixes the issue.

    Seems to only affect graphs with a subgraph in it.

    Unity 2018.2.0, all packages on current release from the package manager (3.0)

    LWRP_Challenge_readme_pic.png
     
    Last edited: Aug 28, 2018
  16. CyberFox01

    CyberFox01

    Joined:
    Oct 5, 2012
    Posts:
    23
    Hello all! And thank you for making this awesome feature. I hope i can make a meaningful contribution. Here goes:

    • Meta Data
    Add data fields to the shader, either inside or outside the editor. Fields like: Author - Date - Comment.

    • Shader Path
    Shader path input field is not clearly visible, in fact i found it by accident. perhaps making it clearer that this is an input field? (In fact i though it was a button meant to collapse the panel)
    upload_2018-8-28_11-25-23.png

    • Position?
    Wth is the Position port on master nodes? All that happens when i connect it, my model disappears. The documentation doesn't have any information on this port. It's not even listed.
    upload_2018-8-28_11-31-40.png

    • "Parameters"
    some "Parameters" in general needs to work as Ports. Workflow Parameter is OK since it changes the layout of the node. But not the others.
    upload_2018-8-28_11-33-59.png

    • CustomEditor
    There's no way to change it. It needs to be, i have a workaround that looks like this (Basically custom panel):
    Code (CSharp):
    1. using System.Collections.ObjectModel;
    2. using System.Linq;
    3. using System.Reflection;
    4. using UnityEditor;
    5. using UnityEngine;
    6.  
    7. [CustomEditor(typeof(Material))]
    8. public class MyShaderMaterialEditor : MaterialEditor {
    9.  
    10.     private static readonly string[] ShaderNames = {
    11.         "Custom/MyShader"
    12.     };
    13.  
    14.     public override void OnInspectorGUI() {
    15.         var material = (Material)target;
    16.         if(material != null && ShaderNames.Contains(material.shader.name))
    17.             ShaderPropertiesGUI(material);
    18.         else
    19.             base.OnInspectorGUI();
    20.     }
    21.  
    22.     public void ShaderPropertiesGUI(Material material) {
    23.         GUILayout.Label("Hello world!", EditorStyles.boldLabel);
    24.     }
    25. }
    Next: nodes nodes nodes
    we need more nodes, for now I'd like to see you take in community generated nodes to fill in the library.

    • More noise!
    Simplex 4D Please. The community will possibly want a bunch of other noises.

    • Triplanar doesn't return UVs
    despite it being in the UV category. So it's useless in conjunction with procedurals.
    My Triplanar that does return the UV's but doesn't blend because I'm not smart enough to blend them.
    Code (CSharp):
    1. using System.Reflection;
    2. using UnityEditor.ShaderGraph;
    3. using UnityEngine;
    4.  
    5. [Title("UV", "TriplanarUV")]
    6. public class TriplanarUV : CodeFunctionNode {
    7.     public override bool hasPreview { get { return true; } }
    8.  
    9.     public TriplanarUV() {
    10.         name = "TriplanarUV";
    11.     }
    12.  
    13.     public override string documentationURL {
    14.         get { return "https://github.com/PushyPixels/BreakfastWithUnity/blob/master/Assets/50WorldSpaceTextureShader/Normal-Diffuse-Worldspace.shader"; }
    15.     }
    16.  
    17.     protected override MethodInfo GetFunctionToConvert() {
    18.         return GetType().GetMethod("TriplanarUVFunc", BindingFlags.Static | BindingFlags.NonPublic);
    19.     }
    20.  
    21.     private static string TriplanarUVFunc(
    22.         [Slot(0, Binding.WorldSpaceNormal)] Vector3 Normal,
    23.         [Slot(1, Binding.WorldSpacePosition)] Vector3 Position,
    24.         [Slot(2, Binding.None, 1, 1, 0, 0)] Vector2 Tiling,
    25.         [Slot(3, Binding.None)] out Vector2 Out
    26. ) {
    27.         Out = Vector2.zero;
    28.         return @"{
    29.    if(abs(Normal.x)>0.5){
    30.        float2 newUV = Position.yz;
    31.        Out = newUV * Tiling;
    32.    }
    33.    else if(abs(Normal.z)>0.5){
    34.        float2 newUV = Position.xy;
    35.        Out = newUV * Tiling;
    36.    }
    37.    else{
    38.        float2 newUV = Position.xz;
    39.        Out = newUV * Tiling;
    40.    }
    41. }";
    42.     }
    43. }
    • Teleport node, In and Out
    Basically a connection without and "edge". One input, many outputs.
    Type in an identifier, or pick from a drop down, or anything.

    • Code node
    Much like the code node from ShaderForge. You pick inputs count and types, and outputs and output types. Finally you write code.
    It would really simplify doing math in ShaderGraph. (Try to do a+(b-a)*d in nodes. That's a lot of nodes)

    • Comment node
    Comments, i love commenting, thats why I'm here!

    • Group node
    Some way of organizing your nodes inside a collapsible movable block. Let the node have inputs and outputs that you'll see both inside and outside node.

    • Region node
    A block that you can color, resize and move around and finally lock.

    Perhaps tie the latter 2 together with compiling directives.



    Other points

    • Search Engine Optimization.
    Dunno, seems evertime i search for something i get this poor guy: "ShaderGraph always results in pink (broken) shader". 80% of the time. The other 20% i get no answers.

    • Docking
    Dock "Create Node" menu.
    Dock Parameter list.
    Dock preview.

    • Dark on light theme
    weird mix between dark theme and light theme, perhaps it's time to abandon light theme altogether?



    C#
    The code needed to make a custom node is "wtf" to say the least.
    I am talking specifically about the function getter. I think i know what you tried to solve. You want the code to be able to use different functions based off certain criteria. We could have used the nameof() but it seems C# 6 is not entirely ready to use. Meanwhile there are other solutions.

    • make a function that basically does the reflection for you.
    Code (CSharp):
    1. public static MethodInfo GetMethodInfo(string methodName) {
    2.     return GetType().GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic);
    3. }
    But i THINK you left it in this poor state because it's temporary. (Or at least i hope so)

    I tinkered with delegates, expression trees and reflection, nothing works with "method groups" in a way that's better. I'm gonna post my findings anyway.

    - Wrap delegate constructor
    Code (CSharp):
    1. public static MethodInfo GetMethodInfo(Delegate f) {
    2.     return f.Method;
    3. }
    4.  
    5. protected override MethodInfo GetFunctionToConvert() {
    6.     return GetMethodInfo(new Func<Vector2, string>(MyNodeFunc));
    7. }
    - Call Expression Tree
    Code (CSharp):
    1. public static MethodInfo GetMethodInfo(Expression<Func<object>> f) {
    2.    var body = f.Body as MethodCallExpression;
    3.    if (body == null)
    4.        throw new ArgumentException("'expression' should be a call expression");
    5.    return body.Method;
    6. }
    7.  
    8. protected override MethodInfo GetFunctionToConvert() {
    9.    return GetMethodInfo(()=>NodeFunc(default(Vector2)));
    10. }

    • Full blown CIL Expression Tree to ShaderLang conversion.
    C# > [BlackMagic] > ShaderLang

    Kinda like how LINQ2SQL works. I think we'd benefit very little from this considering how hard it is. Strings are fine.


    And lastly a simpler solution:
    • Simple Data
    Let the entire setup be, data. class, or struct instances.This would be my preferred approach. No reflection, no attributes, just lean and clean data.
    Code (CSharp):
    1. protected override ShaderGraphMethodInfo GetFunctionToConvert() {
    2.     return new ShaderGraphMethodInfo {
    3.         Parameters = {
    4.             new ShaderGrapParam {
    5.                 Index = 0,
    6.                 DefaultBinding = Binding.None,
    7.                 Name = "BlaBla",
    8.                 Type = typeof(Vector2),
    9.                 Hidden = false
    10.             }
    11.         },
    12.         Out = typeof(Vector2),
    13.         Body = @"{}"
    14.     };
    15. }



    Too much?
     
    Last edited: Aug 28, 2018
  17. TobiasB

    TobiasB

    Joined:
    Jul 4, 2013
    Posts:
    4
    Could you please add a node that creates an actual shader branch? The branch node you have now is just a lerp so both inputs are still calculated. I was very disappointed when I realized this as the the branch name suggests that it's not calculating both sides, so you could use it for toggling features in the shader on and off.
     
  18. sand_lantern

    sand_lantern

    Joined:
    Sep 15, 2017
    Posts:
    210
    As far as this node, goes, I believe it is vertex position, so likely whatever you attached to it moved the vertexes so far from the original object that it was either unable to be seen or unable to be rendered.

    Some interesting and valid criticisms in there.
     
  19. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Wow, it's not even an inline boolean operator (i.e.: ret = val ? a : b) which would still do both sides, but at least be a guaranteed fast conditional. This feels very much like a placeholder node. Branch has a very specific meaning that most people either aren't going to know, or those who do will have specific expectations about. Even the official documentation for the node makes reference to it being a "dynamic branch", which again has very a specific meaning for shaders, and a lerp is not that.

    Worse is it takes a boolean for the "predicate". This mean it has to come from a boolean node, a boolean property, or another node that outputs a boolean. Using a boolean node is fine, the shader compiler will generally optimize the whole thing away. Using a boolean property mean the shader won't take advantage of it being a static branch, which on older mobile devices doesn't mean much, but on most modern GPUs is essentially free. Lastly, many of the nodes that output a boolean value already use an inline boolean operator, so it's not like there's a reason to avoid it.

    However, to be fair, most of the time an if statement in a shader still computes both sides, and even if it is a real dynamic branch (ie: isn't doing the conditional purely on a material properties and constant values) they have s a non-zero cost that a lerp (or inline boolean) can often be faster at.

    Holy sh... yeah, never noticed that, and I would never have expected that's something that can be clicked on. Worse, it needs a double click so it's even more hidden. I would have expected some default value there at least to make it more obvious, and always default to showing a forward slash at the end to call out what it is. Maybe show it like all other text input fields:
    upload_2018-8-28_13-6-52.png

    This also exposes another bug, which is if you do set the value to something, the show generated code option fails as the generated shader code file tries to save to and read from a file with a the directory name as a directory.

    System.IO.DirectoryNotFoundException: Could not find a part of the path "--folderpath to project--\Temp\GeneratedFromGraph-TEST\NewShaderGraph-UnlitMaster-515291d3-fa3b-46b8-a9de-4b424ccb81e5.shader".

    Notice there's a backslash in the filename!

    Maybe it shouldn't be in the UV category then, since the output isn't a UV, but the final blended product of the texture on three triplanar UVs blended together. I wouldn't call your code a triplanar UV, but rather a "major axis UV".

    Interesting idea, but one that seems easy to cause problems. Might be interesting if when selecting either end it shows the lines to connect to the attached In/Out node(s). Would also likely need some kind of logic in the UI such that when you delete the In or last Out it reconnects the lines between. Really just having a dummy node that just acts as a line route would be enough for me, and wouldn't have the added confusion that a teleport node adds.

    These have been mentioned before (though I don't remember if people have suggested a lock), but I agree to all of this. Being able to add comments is huge not only for sharing shaders within a team, but just remember what I was doing two months ago.
     
  20. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
  21. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    for the sake of sanity, you shold rename the properties in the shader graph editor. On the blackboard side you can rename it in two ways, right click > rename and if you expand if you'll have something like FLOAT_ABCDEF12345 which you should replace with something you can remember. (I don't know why these things are separated/different but there you go).

    Then you can use setfloat like in the example in the script reference. So:
    shader.setfloat(_EmissiveIntensity, 3.21f);
    shader.setfloat(_AlbedoIntensity, 0.0f);

    If you are wanting to do something like a completely unlit shader, the other option is to have two materials, one unlit the other lit, set them up manually on the object so they look right individually, and then just switch them out via script.
     
    konsic likes this.
  22. Chris-Herold

    Chris-Herold

    Joined:
    Nov 14, 2011
    Posts:
    116
    In ShaderGraph 3.0.0 the shader generation is using a non-invariant culture, which means decimal separators are wrong and the shader wont compile (periods versus comma).
    In practice that means on a non-EN locale we have to put all properties to values that don't contain any separators (which is mildly infuriating).
    @developers try saving your graphs on a german OS locale.

    What i'd really like to see next is a PerRenderData checkbox on Properties (float1234, matrices, colors). It's easy enough to manually edit the shaders, but having done that it seems like low hanging fruit for the shader graph.
     
    Last edited: Aug 29, 2018
  23. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Aww. Thanks anyway. :(


    That's useful info. Thank you.

    Even without nifty tesselation (I'm thinking awesome realtime LOD stuff), this is all still great to know about.

    Thanks for the mini-tutorial on this. :)
     
  24. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    The PerRenderData property drawer doesn't actually do anything except hide the property in the inspector. Unchecking the "exposed" check box is equivalent AFAIK.
     
  25. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
  26. Desoxi

    Desoxi

    Joined:
    Apr 12, 2015
    Posts:
    195
    Isnt it possible to use float3x3 in custom nodes atm?
    The following code doesnt work for me and i cant find a problem with the glsl code itself:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using System.Reflection;
    4. using UnityEditor.ShaderGraph;
    5. using UnityEngine;
    6.  
    7. [Title("Custom Noise", "Y Rotation Matrix")]
    8. public class YRotationMatrixCustomNode : CodeFunctionNode
    9. {
    10.     public YRotationMatrixCustomNode()
    11.     {
    12.         name = "YRotationMatrixCustomNode";
    13.     }
    14.  
    15.     protected override MethodInfo GetFunctionToConvert()
    16.     {
    17.         return GetType().GetMethod("RotationMatrixY", BindingFlags.Static | BindingFlags.NonPublic);
    18.     }
    19.  
    20.     static string RotationMatrixY(
    21.         [Slot(0, Binding.None)] Vector1 v,
    22.         [Slot(1, Binding.None)] out Matrix3x3 Out)
    23.     {
    24.         return @"
    25. {
    26.    Out = float3x3(0,v,0,
    27.                0,0,0,
    28.                0,0,0);
    29. }
    30. ";
    31.     }
    32. }
    33.  
     
  27. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
  28. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    i build a graph. Looks fine. try to apply it. All pink. Does this thing work in 2018.2?
     
  29. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    Which versions of ShaderGraph and SRP packages are you using? Max supported version (for ShaderGraph, at least) in 2018.2 is 2.0.8
     
    twobob likes this.
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    ah.

    Code (Script):
    1. {
    2.     "dependencies": {},
    3.     "description": "Shader Graph",
    4.     "displayName": "Shader Graph",
    5.     "gitHead": "eff0eb92ffbc5afe521ec0f53b0cff8da83bcd95",
    6.     "name": "com.unity.shadergraph",
    7.     "repoPackagePath": "com.unity.shadergraph",
    8.     "repository": {
    9.         "type": "git",
    10.         "url": "ssh://git@github.com/Unity-Technologies/ScriptableRenderLoop.git"
    11.     },
    12.     "unity": "2018.2",
    13.     "version": "3.0.0-preview"
    14. }
    That'll be the issue then maybe.

    Why does it offer an upgrade to something it can't use??? "Min|Max Unity Version" attribute?
    Doh! :)

    Hero anyway
     
    Last edited: Aug 30, 2018
  31. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    So I am on 2.0.8 now

    upload_2018-8-30_19-39-18.png

    on a basic cube

    upload_2018-8-30_19-40-38.png

    and of course it fails on a terrain (Yup. I know, Tangents etc)

    upload_2018-8-30_19-41-16.png

    I dug around to see if I missed any steps. Didn't see anything blindingly obvious?
    Clues?
     
    konsic likes this.
  32. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    I think you should wait for new version of SG and new terrain system in 2018.3. New terrain system will have full support of SG.
     
    twobob likes this.
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    You're not wrong. But the cube?
    Also I fully expect - since the new terrain will be very GPU side - that much of what I have done with terrain in the past will go down the toilet... So.. kinda would like this to work on terrain that is rendered in a place I can get the values from. Not all squirreled away in unreachable GPU stuff
     
  34. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    awesomedata, sand_lantern and wyattt_ like this.
  35. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    Terrain support for LW and HD SRPs is coming. You'll have to wait just a tad longer for that. No ETA on official ShaderGraph support for creating custom Terrain shaders which is separate from SRP Terrain support.

    Not sure why the ShaderGraph Material would not be working on the cube. Do you have a SceneSettings GameObject in your Scene? And anything printed to Console?
     
    twobob likes this.
  36. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
    Thanks for fast response Ben, any idea if its possible outside of SG in 2018? When I've exported SG to shader and wrote AlphaToMask On and modified renderqueue and rendertype to follow your guide, there was no visible change.
     
  37. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    There's no reason it shouldn't work, assuming MSAA is working. With how SRPs are currently setup, the scene view never gets any MSAA, and in my personal testing I found enabling anti-aliasing on the pipeline asset often still did not actually enable MSAA for the main camera's render target. With out MSAA, A2C doesn't do anything more than alpha testing. I've not tried to figure out why MSAA didn't work, though last time I looked (LW 2.0.8?) it did seem to.
     
  38. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    150
    On LW 3.0.0 I can confirm, your shader example is working (MSAA is working as well (was disabled+unfunctional on previous releases), but only in game view).
    Had no luck with implementing Alpha to Coverage to SG copied code though.
     
  39. sand_lantern

    sand_lantern

    Joined:
    Sep 15, 2017
    Posts:
    210
    Oh dang, thanks for that! I spent a couple days trying to figure out how to get a skybox shader from the graph. I asked a question here about a month ago but nobody had any input. That's a dirty workaround, but it looks like it would work!

    Guess I'll need to queue that up in my list of things to do.
     
  40. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    Unity's shader graph can to a lot... But for alot of I have in mind... It looks you need to be a coding wizard to do them.

    Lighting I had in mind being one of them.
     
  41. jason_sone

    jason_sone

    Joined:
    Jul 7, 2017
    Posts:
    8
  42. KristofferH

    KristofferH

    Joined:
    Oct 27, 2012
    Posts:
    52
    When I create a PBR Master with the HD render pipeline the Enable GPU Instancing option does not show up, is this not yet supported in HDRP, and if so, when will it be available? I'm using v 3.0.0 of both HDRP and Shader Graph.
     
  43. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    I am on Unity 2018.1.6f1, why I can't find anything about the Shader Editor?
     
  44. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    You need to have one of the rendering pipelines installed to use the shader graph. You can get it from the Package manager (You will need to upgrade your project and switch the rendering pipeline to the new pipeline) or from a template when creating a new project.
     
    PolyMad likes this.
  45. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Thank you, I installed the package. I don't know all this thing about the rendering pipeline though, I'm using Unity 2018 as it is out of the box... are they going to change everything again?
     
  46. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    Nothing was changed if you want to just use unity as before you just install it and carry on. If you want to use the new pipelines then there are just a few things you will have to learn/work with. Lightweight is the quickest to upgrade to and is the most similar to the Default renderer. HDRP is more advanced but still pretty easy to get going.

    Setup is pretty simple this video will get you started - It shows how to upgrade a project to Lightweight Pipeline (same for HDRP)
     
    PolyMad likes this.
  47. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Thank you very much! :D
     
  48. Desoxi

    Desoxi

    Joined:
    Apr 12, 2015
    Posts:
    195
    Can someone help me with this, because im still stuck and i even tried it with the hlsl equivalent mat3 as type but that doesnt work as well. Maybe im missing something obvious?
     
  49. mattbirkettsmith

    mattbirkettsmith

    Joined:
    Mar 19, 2018
    Posts:
    8
    I have an old custom damage vignette shader that I wrote in ShaderForge. My new project uses HDRP and I would like to port it over to Shader Graph. Does Shader Graph support working with post process materials yet? I couldn't see an option for it

    Also as an aside does anyone know how to fix the compile error for my old Shader Forge vignette shader under the HD render pipeline? I don't know if I can hack around this with a header file tweak or if it's fundamentally incompatible:

    Code (CSharp):
    1. Errors 1:
    2. 'UNITY_PASS_FORWARDBASE' : macro redefinition
    3. Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL LIGHTPROBE_SH
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
     
  50. equalsequals

    equalsequals

    Joined:
    Sep 27, 2010
    Posts:
    154
    I'm curious if there is any intent on allowing us to create custom Editor/ShaderGUI on a per MasterNode basis?

    For instance, we have a custom SRP with its own MasterNode and I'd like all Graphs which come from that master to implement the same ShaderGUI by default.

    I was able to hack this in fairly trivially by modifying the MasterNode.cs file and creating a virtual function which either appends the line or NoOps in the GetShader method when assembling the finalShader string. This allows some of our 'first class' features of our SRP to be immediately available to any of our generated ShaderGraph content.
     
Thread Status:
Not open for further replies.