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. Bitfabrikken

    Bitfabrikken

    Joined:
    Mar 24, 2013
    Posts:
    34
    I think the Shader Graph is just awesome! One thing I can't figure out though:

    How to make a shader that only receives shadows? Sort of a transparent shader that catches shadows and display them. It's for characters in AR. Anyone got any ideas?
     
  2. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    I know, And that is why i'm asking for a Set/Get node pair. In ShaderForge i created a special shader for my needs but , although it has only 3 different functions, there are several checks/conditional branchings that make a mess of the graph. And given the available nodes in ShaderGraph, i think the graph would be much messier. It would help a lot if we could our graphs clean.
     
  3. reflectingb0t

    reflectingb0t

    Joined:
    Apr 10, 2018
    Posts:
    18
    Hi,
    I want to have a flat object always facing the player (rotating aroung it's local y axis). I tried to achieve this using the Position output. Problem is, it seems we cannot get the objects rotation right now. The Object node contains only position and scale. Also there is no rotate node for vector 3 rotations as far as I can see. Am I overlooking something? Or is this not possible right now?
     
  4. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    There's a good short discussion here on it, but it doesn't use the shader graph.
    https://forum.unity.com/threads/standard-surface-shader-billboard.513060/

    I would think that the matrices is what you want to modify rather than position data.
     
  5. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    Oh, i thought of something that might be neat : with shader graphs (shader graph GUI in general, not only Unity ShaderGraph), i often see people taking screenshots to show their graphs. Which might look nice, but it's a pain to reproduce. How about being able to export/import the graph as json or xml? That would make sharing graphs much easier than showing full graph screenshots or passing files to download.
     
    BradZoob and MythrilMan51 like this.
  6. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    That, and a node that takes in light attenuation while we're at it.
     
  7. reflectingb0t

    reflectingb0t

    Joined:
    Apr 10, 2018
    Posts:
    18
    Thanks. I'll look into it!

    I think the main issue with this is that I can't get the Camera Direction though. Doesn't matter how I try to use it, as long as it is connected it gives me an error and the shader won't work. I think this might be a bug. I'm using Unity 2018.2.2f1 with Shader Graph version 3.0 and HDRP 3.0. Any ideas?

    upload_2018-8-8_16-13-33.png
     
    sewy likes this.
  8. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    Also, how do we do decals?
     
  9. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    I was trying Shader Graph in HDRP. I added a Reflection Probe node to the graph, which is fine. But after i linked it to the main core, it just crashes the shader. Do anyone experience this problem? Is there a way to fix it?

    *Edit*
    it return error:

    Assertion failed on expression: 'success'
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)



    fail_reflectionProbe.jpg
     
    sewy likes this.
  10. Bitfabrikken

    Bitfabrikken

    Joined:
    Mar 24, 2013
    Posts:
    34
    The shadow thing I solved by adding two materials to the object. The second material you could call shadow matte. It just shows the shadow :) See screenshot:

    upload_2018-8-9_8-3-58.png
     
  11. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    I'm not sure this was suggested already, but how about letting us add custom nodes? I'm pretty sure there are way more nodes that people want than what is available. For example, i want a procedural gradient noise node with more control than a simple scale + uv.

    Another node i might want is conditional colors. Choosing a color from multiple sources (procedural noises) depending on the resulting values of another noise.
     
    Last edited: Aug 9, 2018
  12. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    You can already do this. See the documentation.
     
  13. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
  14. diorama

    diorama

    Joined:
    Sep 10, 2013
    Posts:
    1
    Wouldn't it be more elegant to have a PBR Mixer node with color out. That way there could be a single Master node (with the same inputs as the current Unlit Master) which is always in the graph.
     
  15. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    @Clyde_Coulter since i just began playing with ShaderGraph, i didn't see that feature. Thanks for pointing it out.
     
    Clyde_Coulter likes this.
  16. przwlodarski

    przwlodarski

    Joined:
    Aug 8, 2018
    Posts:
    3
    Hello, I'm checking out these shader graphs with LWRP. However, I get this weird problem, even on the simpliest graphs (like adding a color property and connecting it with the albedo) - everything goes pink after saving it and I get the message: "Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)". It's the same when I'm trying to import a graph. Sometimes it feels like it stops working at random. Did anybody stumble upon the same problem? I've seen people had it with HD, but I'm not using this one.
     
  17. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    Did you use the template for LWRP to create a new project? (do you have all LWRP resources in place)?
    If so, what level of shader support does your graphics card and driver have?
     
  18. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    upload_2018-8-9_14-1-48.png HOWEVER... THIS wasn't done in shadergraph.
     
  19. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    And baked's next.
     
  20. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    I'm having fun with Shadergraph 3.0.0
    Something that is NOT a problem....

    Vertex Displacement fun

    A Gerstner node (with offset and normal/tanget outputs) would be great for something like this and be more realistic.

    Now, I just need to unscramble this graph for readability (and maybe that will help my brain too) :D


    Maybe a labeled rectangle would help in situations like this?
     
    Last edited: Aug 9, 2018
    wyattt_ likes this.
  21. przwlodarski

    przwlodarski

    Joined:
    Aug 8, 2018
    Posts:
    3
    I'm 100% sure that the graphics card supports the shaders and drivers are up to date. But no, I didn't use the LWRP template, I had an existing project, and changed the rendering pipeline later on. I downloaded render pipeline core, lightweight, and shadergraph packages. Is something possibly missing because I didn't use the template?
     
  22. madks13

    madks13

    Joined:
    May 8, 2016
    Posts:
    173
    @przwlodarski i created an empty LWRP project, and copied the LWRP assets it created for the pipe line inside my existing project. It worked fine that way. I'm not sure how to get those inside existing projects, but you could try that approach for a fast solution.
     
  23. przwlodarski

    przwlodarski

    Joined:
    Aug 8, 2018
    Posts:
    3

    Seems reasonable, I'll try it out, thanks.
     
  24. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    The following must be in place under "Edit->Project Settings->Graphics"
     
  25. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    If you need a Lightweight Pipeline Asset it can be created in "Assets->Create->Rendering->Lightweight Pipeline Asset"
     
  26. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    HOWEVER... Is there a node where you can make custom lighting maps for a given material. That would be useful for mobile... Now where was I?
    Tampering with lighting shaders. Something you COULDN'T do in shadergraph, why I fled there in the first place.
     
  27. TheWanderingBen

    TheWanderingBen

    Joined:
    Nov 3, 2015
    Posts:
    98
    Hey all,

    Maybe a simple question: Is it possible to adjust the example PhaseShader to fill the hole with a flat surface?

    upload_2018-8-10_10-14-10.png

    i.e.: above, the part cut out of the sphere should look like it has a face instead of being completely empty.

    There's a Cross Section Shader on the Asset Store that does something similar. I'm wondering how (or, if it's possible) to replicate this with Shader Graph.

    Thanks in advance!
     
  28. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    Can you just use his shader? It uses a plane (or more) to define the cross sectioning, there are scripts that go along with it to set the shader parameters.

    Take a look at his code for the scripts and shaders on GitHub.
     
  29. TheWanderingBen

    TheWanderingBen

    Joined:
    Nov 3, 2015
    Posts:
    98
    Hey Clyde,

    Thanks for jumping in! Unfortunately his shaders use the old Surface shader syntax. Converting surface shaders to vertex/fragment shaders doesn't seem trivial (at least, not to me!) and since the Shader Graph gets me almost the full way there, I was wondering if there was something simple I was missing.

    I asked the question generally in case I had something wrong, but more specifically, I think I just need to control back-faces separately from front faces. Not sure if that's possible (or if that's even the correct approach).
     
  30. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    AND for baked lighting...
     
  31. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146

    Crappy by default.

    And when I hacked the pipeline... Thanks to a hardlight formula.
     
  32. Euri

    Euri

    Joined:
    Sep 30, 2014
    Posts:
    11
    yes it can be done, create the same shader in the new shader graph, and use the node "is front face", conect it to a "brach" node so it transforms into a float then use a "lerp" node, to lerp from the normal color to the color inside, but is a bool so when its true put the color you want (the object outside color) and when its false put the inside color.

    upload_2018-8-11_9-34-36.png

    upload_2018-8-11_9-36-24.png
    result
     

    Attached Files:

    URocks and TheWanderingBen like this.
  33. TheWanderingBen

    TheWanderingBen

    Joined:
    Nov 3, 2015
    Posts:
    98
    Oh wow, I didn't even know there was an Is Front Face node! Thanks Euri!!

    This is almost perfect -- the only problem now is the back faces are still lit:

    upload_2018-8-11_11-16-45.png

    I want lighting to affect my front faces, but not my back. Is there any way to tell the back faces to ignore any lighting? I haven't found anything yet, but I'll keep digging!

    Thanks again!

    EDIT: Actually, adding it to Emissive for back faces did the trick!

    upload_2018-8-11_11-27-43.png

    Now I'm just trying to figure out how to add a texture to the back faces -- so it looks like it's facing up in world-coordinates always.

    Tried for a couple hours without success -- clearly some matrix multiplications required that I don't understand. If anyone can point me in the right direction, I'd really appreciate it!
     
    Last edited: Aug 11, 2018
  34. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
    Unlit Premultiply and Multiply blend modes don't seem to work in hdrp. They both function like opaque, is this not implemented yet?
    Working on Unity 2018.2.3f1 and HDRP/Shadergraph 3.0.0

    And lit shader does not look good for FX with premultiply

    unlit-premultiply.jpg
     
  35. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    This's a common mistake, for sure, but if you want your color to ALSO act like your alpha, you would need to use a split node.
     
    Last edited: Aug 12, 2018
  36. Euri

    Euri

    Joined:
    Sep 30, 2014
    Posts:
    11
    Your welcome!. I didn't have that problem because I was using unlit.

    That's something I want to know too!. If you find anything don't forget to post it please.
     
  37. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
    Thanks, but I know that (it uses red channel automatically) and not what i'm trying to do. It's all zero in this case yet alpha still has no effect.

    I use split in my shader and can not in any way get the alpha channel to have any effect with premultiply and multiply blend modes.
    Just to make it simpler, here is RGBA 0,0,0,0 and it's still completely opaque. This appears opaque in scene and in game.

    unlit-premultiply.jpg
     
  38. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    The idea behind premultiply's that it's add with NO opacity, by alpha with 100%(Great for fire and explosions, by the way), but Alpha controls if it's an alpha or not, and the BIZARRE thing about Unity's color node's that unity doesn't add alpha into color(probably to preserve it), so you would need to use a split node... JUST to take the alpha channel... LIKE THIS...
    upload_2018-8-12_14-17-52.png
     
  39. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
    Precisely. It's good to see it should be working at least. But as you can see in my previous example it does not work for me. I am very familiar with blend modes. But just so you'll believe me...

    unlit-premultiply.jpg


    My problem is not about confusing the color node and channels. If I directly change the Alpha value on the Master node it has no effect whatsoever. Again I understand how premultiply is suppose to work
     
    MythrilMan51 likes this.
  40. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    Don't know why you don't have a checkerboard background... It should be there. But how's this ball in game?
     
  41. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
  42. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
    I think I should add that even when I'm using a normal alpha blend I don't see the checkerboard background in the preview window, though the alpha does work. I'm assuming it should be there...

    unlit-premultiply.jpg
     
  43. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
  44. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
    If I start with an empty project, add hdrp asset and volume script, I still have this issue. So maybe my shadergraph package is corrupt? I've tried deleting the package from packages.unity.com folder and reinstalling packages to no effect.
     
  45. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    .... THAT might be the problem... I was running with LWRP (The hell would I need INSANE graphics for what I'm working on?). Shadergraph was JUST introduced on HDRP, so I BET there would be something wrong with the pipeline.
    Then again, Shadergraph.... Eventhough a GREAT feature that everyone went to 2018 for...

    Is not as great as we want it... Taken I have to hack the render pipeline's scripts to achieve THIS lighting.
     
  46. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
    Oooh sorry yes. lwrp works correctly for me. Oh well

    My goal here is a premultiply shader that works with particles FX, the default HDRP shaders have premultiply but Particle System can not change the color/transparency of the defaults. I suppose I will patiently wait for now...
     
  47. MythrilMan51

    MythrilMan51

    Joined:
    Apr 24, 2017
    Posts:
    146
    I was gonna say, With HDRP, The hell are you using Premultply? CRANK IT UP WITH EMISSIVE MATERIALS! And perhaps ACES...
     
    nickrart likes this.
  48. nickrart

    nickrart

    Joined:
    Mar 24, 2017
    Posts:
    31
    Yeah thats a better solution lol
     
  49. alvion

    alvion

    Joined:
    May 30, 2013
    Posts:
    8
    Yes, you can do this. If you uncheck the "expose" box for the property, then the property will NOT appear in the Material, and WILL be settable using SetGlobalXXX().
     
  50. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    83
    In Unity 2017.2.0p4 (incl. relevant Shader Graph, SRP Core, LWRP packages) I had a Raw Image UI component without a texture, but using a material with a Shader Graph shader. This shader used a RenderTexture as Texture 2D Asset. Below you see the result in the center of the radial menu.



    After upgrading to Unity 2018.2.2f1 I noticed the resulting image is black in the game view. When changing the shader from Transparent to Opaque I get an expected result although without the circular mask that I need for this menu. Is this a bug? Is there a workaround?



    Opaque



    Transparent



    The preview in the Inspector also looks really strange when set to Transparent. Maybe this is a hint as to what the problem might be.

    Opaque


    Transparent

     
    Last edited: Aug 13, 2018
    EricLowry likes this.
Thread Status:
Not open for further replies.