Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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. Desoxi

    Desoxi

    Joined:
    Apr 12, 2015
    Posts:
    124
    Thank you very much, im going to try that out when im back home!
     
  2. partha-d

    partha-d

    Joined:
    May 28, 2018
    Posts:
    8
    Hi,
    I want to extend the Shader Graph for my Custom SRP.
    Can anyone help on that.
     
    Last edited: Sep 20, 2018
  3. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    48
    Capture.JPG
    Holy heck it worked! Thanks for pointing me in the right direction :D
     
    URocks and wyattt_ like this.
  4. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    Nice! And no problem!
     
  5. empika

    empika

    Joined:
    Jul 12, 2012
    Posts:
    24
    Hey there,

    Will Stencil buffers be added to the Lightweight pipeline any time soon?

    I'd like to convert my project over to using LWRP but it depends heavily on the stencil buffer.

    If it won't be added any time soon, are there any hacks/workarounds I could use to add it in?

    Thanks
     
    EricLowry likes this.
  6. partha-d

    partha-d

    Joined:
    May 28, 2018
    Posts:
    8
    Hi,
    How to extend the Shader Graph system to export shaders for any custom SRP .
    Do I need to write a something similar to LightWeightPBRSubShader or LightWeightUnlitSubShader
    Any help on this would be appreciated.
     
  7. ziv0001

    ziv0001

    Joined:
    Sep 20, 2018
    Posts:
    1
    Hello,Which node of shader forge is Normal Direction in shader graph?
     
  8. hot-knife-digital

    hot-knife-digital

    Joined:
    Oct 22, 2013
    Posts:
    11
  9. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    404
    What are the current plans for supporting shader_feature/multi_compile?
     
  10. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    If you mean the vertex/fragment normal then it's the Normal Vector Node in Shader Graph.
     
  11. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    Mostly that they are planned. No ETA for it yet
     
  12. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    Ya, best bet would be to look at LWRP implementation. If you decide to embark on this adventure, please keep in mind that, since Render Pipelines and Shader Graph are in preview/experimental states, things like API and shaders are subject to change at any point.
     
  13. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    48
    OK, so shell furshader question 2 here. How would you go about correcting the normals on the strands? My thought was to use tangent vector, and feed that into the Rotate About Axis node and rotate it around the normal vector towards the viewpoint. But how would I get the correct angle for that?
     
  14. empika

    empika

    Joined:
    Jul 12, 2012
    Posts:
    24
    Hi there.

    I'm having trouble importing and using Shader Graph 3.0.0-preview via the package manager in an existing project.
    I have upgraded the project to 2018.2.8f1, installed render pipeline core via package manager, and imported and set up LWRP via the package manager also.

    When I open a graph I get the following error:

    Compilation error in graph at line 466 (on glcore):
    failed to open source file: 'ShaderGraphLibrary/Functions.hlsl'
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)​

    I the Functions.hlsl exists in the Shader Graph package, in the correct ShaderGraphLibrary folder, but for some reason the generated shaders do not have access to that path.

    I have temporarily fixed this by copying the Functions.hlsl file into the CoreRP/ShaderLibrary/ folder (and creating a meta file for it). Other includes that reference files in CoreRP/ShaderLibrary (Color.hlsl for instance) are included correctly.
    I then searched through the RP+SG packages, replacing any mention of 'ShaderGraphLibrary/Functions.hlsl' with 'CoreRP/ShaderLibrary/Functions.hlsl'. Shaders now compile correctly, but obviously this isn't an ideal fix.

    Testing the render pipeline + shader graph with a fresh project works correctly (though I had to turn off Metal editor support in order to view the shader preview correctly).

    Something else of note, when running "Edit/Render Pipeline/Generate Shader Includes", the script apparently didn't have write access to "Packages/com.unity.render-pipelines.core/CoreRP/Utilities/GeometryUtils.cs.hlsl", I had to go in an chmod +w it.

    I am on OSX 10.13.6 btw.

    Any ideas what could be up with the missing Functions.hlsl? It's really hard to tell what's going on in the background as all the package files are kept in /Users/eddy/Library/Unity/cache/packages/packages.unity.com/, but yet Unity is probably caching these somewhere for the project, or at least re-writing the paths so to speak so that the project has access to the files.

    Quick update: Having copied out the shader and pasted it into a fresh file, this too is unable to compile due to Functions.hlsl, ShaderVariables.hlsl and ShaderVariablesFunctions.hlsl being unable to be referenced. This has been hacked by copying these to the CoreRP shader directory and then editing GraphUtils.cs to output the new directory for each file.
     
    Last edited: Sep 21, 2018
  15. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    31
    For everyone who suffering with Shader Graph + .NET 4.x Equivalent - the problem is finally get it root cause.
    Thank to the guys who post this - https://www.patreon.com/posts/20285845

    In short - you cannot use floating values (including colors) in shader graph properties. After replacing all of them and place those values in material I finally able to switch my project to .NET 4.x

    The cause of the problem seems to be locales https://www.patreon.com/posts/unity-bug-dot-to-20433384
     
    Last edited: Sep 24, 2018
  16. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    Shader Graph and SRP packages that are 3.0.0 and up only work with Unity 2018.3 and up. If you are on 2018.2, you'll have to use 2.0.8 or another package from 2.0
     
  17. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    Would be great to see tessellation and sss controls added
     
  18. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    This is a bug with the shader generation and locale and has been fixed
     
  19. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    694
    SSS is coming in the next update with the Lit Master Node, not sure about tessellation (also this is for HDRP)
     
    wyattt_ likes this.
  20. empika

    empika

    Joined:
    Jul 12, 2012
    Posts:
    24
    Ok, thanks! I didn't see that in the changelog or readme's. I would have thought the package manager would not list any versions incompatible with the version of unity running?

    I am still getting the "failed to open source file: 'ShaderGraphLibrary/Functions.hlsl'" issue after having removed RP's and SG and then reinstalled the 2.0.8 versions.
     
    Last edited: Sep 22, 2018
  21. roryo

    roryo

    Joined:
    May 21, 2009
    Posts:
    1,404
    So I have finally gotten around to trying Shader Graph but hit a snag right out of the gate. I installed the LWRP and ShaderGraph and then created a PBRGraph, but when I opened the graph window, I noticed that the thumbnails were not showing. Has anyone run into this? I'm using Unity 2018.2.3f1 on MacOS 10.13.6.

    Capto_Capture 2018-09-22_01-29-26_PM.jpg
     
  22. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    694
    Did you switch the rendering Pipeline to LWRP?
     
  23. roryo

    roryo

    Joined:
    May 21, 2009
    Posts:
    1,404
    If you mean in Graphics Settings, yes.

    Archimatix 2018-09-22_02-40-54_PM.jpg

    The shader renders an object in the scene ok, but always the default gray, regardless of settings in the shader graph.
     
    Last edited: Sep 22, 2018
  24. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    694
    Thats weird, it might be a bug. Which version of LWRP/Shader Graph are you using? 3.0.0 sometimes give problems on some people's machine since it's intended for 2018.3 but got slipped into 2018.2 package release.
     
  25. roryo

    roryo

    Joined:
    May 21, 2009
    Posts:
    1,404
    Thanks, @Grimreaper358 - I was using 3.0.0. I tried going to 2.0.8, but still no luck. :(
     
  26. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    694
    No problem. Hopefully, a dev will be able to help you out.
     
  27. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    31
    Hi, is there an way to determine in which version it will be fixed? I still observe bug in the latest released one.
     
  28. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    105
    Hi and thank you for the new "toy" :)
    Is it possible to convert the 3D Unity KIT Shaders so that I can see, change, manipulate them with the visual editor ?
     
    Moonblade-Studios likes this.
  29. eduroam

    eduroam

    Joined:
    Jul 2, 2015
    Posts:
    20
    Hi Guys, isn't still GPU instancing avaliable in the shader graph?. Thx.
     
  30. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,670
    if you use Shader Graph for HDRP, they just added HD Lit Master Node on SRP master which exposes most of the regular HD Lit functionality, including option for GPU instancing.
     
  31. OtakuD

    OtakuD

    Joined:
    Apr 24, 2014
    Posts:
    44
    Forgive me if it's been stated, I tried to search this thread but came up empty. How would I write a shader for UI Images? I copied my sprite diffuse shader which used_MainTex referencing but that doesn't seem to help. Absolutely amazing feature though!

    Edit: on further inspection it seems almost all of what I wanted to use graphs for are not possible, that being sprite distortion, image manipulation (to make up for not having particles in UI overlay space) and heat/fire distortion. Hope these will be added one day as it's very easy to use, just seems to be lacking in features.
     
    Last edited: Sep 25, 2018
    EricLowry likes this.
  32. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    490
    How can I rename the existing shader graph to place shader in catergory? Double clicking as suggested before seems to not working or I don't understand where I should click.
     
  33. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    Fix might not be in the current release available through Package Manager yet. I'll get back to you (and everyone else with this issue)

    EDIT:
    Fix recently went into the latest version of Shader Graph which is not yet available via Package Manager
     
    Last edited: Sep 25, 2018
    dandepeched likes this.
  34. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    You did this right?

    6ed5c71666b0a3ca90d6fab0f1615db9.gif
     
    URocks likes this.
  35. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    314
    Do the previews update/return if you save the Shader Graph?
     
  36. roryo

    roryo

    Joined:
    May 21, 2009
    Posts:
    1,404
    Thanks for the suggestion, @wyatttt. That did the trick!!!! :)
     
  37. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    490
  38. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    105
    @wyatttt Can you please point me to an answer of this question ? 3D KIT I reffer to this one: https://unity3d.com/learn/tutorials/s/3d-game-kit
     
  39. jeffsarge

    jeffsarge

    Joined:
    Jan 3, 2014
    Posts:
    24
    Is there any way to create a simple color gradient ramp? The gradient node doesn't seem to work for that.
    Thanks,
    Jeff
     
  40. Fellshadow

    Fellshadow

    Joined:
    Dec 2, 2012
    Posts:
    169
    Are there any plans to add a gradient property, so that they can be set on a per-material basis?
     
  41. EricLowry

    EricLowry

    Joined:
    Apr 12, 2015
    Posts:
    7
    @jeffsarge & @Fellshadow
    Here's the solution I came up with for gradients.
    Only 2 colors, but it works great, with transparency and rotation included!

    The "Gradient" texture can be any linear, horizontal, black & white gradient. This way you can have one color in the middle and the other at both ends if you want (Use a 256x256px sized image if possible).

    The part that builds the gradient is to the left of the Add node with the gradient in the preview.
    All the stuff to the right of that is managing transparency and "blending" it with a texture (this texture's alpha acts as a mask in this case, and the RGB is multiplied).

    Lots of the first section is there for the rotation bit, if you don't need it and want a basic linear gradient, you probably can just use the R(horizontal) or G(vertical) channels of the UV to get a basic linear gradient.


    NOTE: Though the ShaderGraph doesn't work with stencils - yet, I hope - I tried using it with a "Sliced" UI image, and the gradient will scale with the slice (in my case, rapid change at the sides, almost none in the middle). You'll have to use actual masking if you want to avoid that bit.

    NOTE2: You could probably play around with the RGBA channels of the gradient texture to get more than 2 colors in. It might require a bit of messing around in order to create the actual image, but it should work.

    Gradient_Shader.jpg
     
    Last edited: Sep 27, 2018
    URocks likes this.
  42. roryo

    roryo

    Joined:
    May 21, 2009
    Posts:
    1,404
    @Grimreaper358 and @wyatttt - thanks for helping me get started with Shader Graph. I am excited to see how procedural Shader generation can be better integrated with mesh generation in Archimatix.

    Archimatix 2018-09-26_12-06-02_AM.jpg

    For example, a grid of windows on a building could be generated in Shader Graph and/or as physical holes in the building mesh with Archimatix. If they share data, then there could be an LOD transition or at least a global parameter that is shared by both systems.

    At the moment, I am trying to see if Shader Graph can set up a vertex color blending of textures. Archimatix can procedurally set vertex colors based on architectural logic, so it would be great to have a Shader that can blend the textures in an architectural mode.

    The following image shows a test I did a ways back where the top vertices of the building are one color and the bottom another, with the vertices going up the height of the buildings are blending linearly or otherwise.

    Archimatix 2018-09-27_01-02-25_PM.jpg

    Is there a way for Shader Graph to handle the vertex colors to blend textures?
     
    P_Jong likes this.
  43. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,415
    roryo likes this.
  44. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    694

    No problem, glad everything is good for you now. To work with vertex colors in shader graph you can use the Vertex color node, split, and lerp. The lerp (B) would be connected to the different texture inputs you wanna use and (A) for the main texture.

    upload_2018-9-27_16-33-17.png
     
    wyattt_ and roryo like this.
  45. roryo

    roryo

    Joined:
    May 21, 2009
    Posts:
    1,404
  46. tgtrignol

    tgtrignol

    Joined:
    Aug 4, 2015
    Posts:
    1
    Hey there, been enjoying the new shader graph system. Are there any plans for custom lighting functions or how would you go about creating these in conjunction with the shader graph?

    I've been trying to create a toon shader among other things and the two limitations that have been holding me back are:
    - No multi pass support
    - No custom lighting effects

    Anything I'm missing out on?
     
    awesomedata likes this.
  47. Fellshadow

    Fellshadow

    Joined:
    Dec 2, 2012
    Posts:
    169
    @EricLowry

    Thanks for the response!
    Unfortunately, if I'm understanding your post correctly, that solution won't really work in my case, as I wouldn't be able to adjust the "strength" or "amount" of each color in the gradient, since I'd be limited to the gradient texture.

    I'm creating sort of a "watercolor painting" effect, which is generally a mixing and blending of multiple colors. Since I'm not particularily good with art, it's much easier for me to do this through procedural generation of textures, and just adjusting the colors while looking at the effects in realtime.

    It gets some OK results, like this:
    but it would be hard for me to do this without being able to adjust the different parameters of a gradient in realtime.

    Although, thinking about it, it could work just as well by having a single "base" color, and having it procedurally choose which other colors to mix in based on math to reach a similar result... Unfortunately, without a really good understanding of color theory, this would probably be extremely difficult.
     
  48. EricLowry

    EricLowry

    Joined:
    Apr 12, 2015
    Posts:
    7
    Just off the top of my head, you could use a somewhat similar approach to what I hinted at at the end of my post with using an image's R/G/B/A values as an equivalent of masks for 4 (or even 8 colors in some specific cases).

    The basic approach would be this:
    Take one channel from your "color mask" texture, which is basically a black&white gradient. With multiplication, division and power math you can manipulate the amount of black vs white in the image (basically recreating the luminosity window from photoshop).
    Then you apply the logic I had on the right of my gradient shader to get more or less presence of the given color based on the black/white image you get.

    Rinse an repeat 4 times for your 4 channels, blend as needed and you get a texture built with 4 programmable gradients that you can fiddle with in realtime. 8 colors if you have one color at each end of each gradient (like I did) ;)

    This is really really "rough" and non-specific, but if you play around with the idea, it could probably work ?
     
  49. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,060
    This should really look like a text-input field. -- Keep the UI somewhat consistent with the rest of Unity, please, guys?
     
    Last edited: Sep 28, 2018
    sebastiansgames likes this.
  50. eduroam

    eduroam

    Joined:
    Jul 2, 2015
    Posts:
    20
    Hello, is not possible to use Decal in shader graph material right?.

    I don't see the toggle "Enable Decal" in the shader graph.

    It will take too long to add this features?.

    Regards.
     
Thread Status:
Not open for further replies.
unityunity