Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Shader Forge - A visual, node-based shader editor

Discussion in 'Assets and Asset Store' started by Acegikmo, Jan 11, 2014.

  1. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    Hi,

    That didn't cross my mind. I'll try that. Thanks for the help

    doc:)
     
  2. Mikulus

    Mikulus

    Joined:
    Sep 19, 2016
    Posts:
    1
    Is there a Shader Forge book in the works? It would be great to have a resource to guide you from being a noob to being an expert. All of the tutorials I've found are either really simple or really complex.
     
  3. retmia

    retmia

    Joined:
    May 31, 2013
    Posts:
    25
    Hello Everyone,

    I'm trying to achieve a "color" blending mode in Shader Forge (the blend node doesn't have it :/) to tint some colorful textures, working like the one that can be found in Photoshop, I've tried to find something one the internet but without succes, does anyone here have any idea how it can be done ?

    Kind regards,
    Romain
     
  4. DaDarkDragon

    DaDarkDragon

    Joined:
    Jun 6, 2013
    Posts:
    115
    @Mikulus I cant imagine so. try experimenting with it, or try breaking down a material/effect into base parts.
     
  5. kdm3d

    kdm3d

    Joined:
    Jul 20, 2012
    Posts:
    15
    If I understand the blend mode correctly this should be close:

    ColorBlendMode.PNG
     
    hopeful likes this.
  6. retmia

    retmia

    Joined:
    May 31, 2013
    Posts:
    25
    kdm3d : Thank you so much, it works perfectly ! :)
     
  7. retmia

    retmia

    Joined:
    May 31, 2013
    Posts:
    25
    Hello Everyone again,

    I'm facing a new problem that I could not solve on my own, let me explain :

    I'm trying to make a glass shader that casts a transparent shadow, I want to have an irregular opacity, roughness and normal on the glass. But also very important I want to have "No Shadows", or a shadow driven by the opacity property. (opacity clips gives transparent shadow, but it cuts my object).
    My glass and frame need to be in the same mesh with "double sided" shadow ticked (to be breakable).
    Can I achieve that with Shader Forge ? How ?


    Regards,
    Romain
     

    Attached Files:

  8. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    I'm not sure how it could be done in a shader but I'm thinking you could keep both things (glass and frame) in one mesh but use two different materials for each and I understand you could get what you want with the Standard shader.
     
  9. synapsemassage

    synapsemassage

    Joined:
    Jul 27, 2009
    Posts:
    334
    Did a clean reinstall, still t he same. I'm on Unity 5.0.1f1. Konsole gets this message after clean install.
    MaterialEditor: Could not create custom UI from the CustomEditor: '' of the shader. Does the class name include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?
    UnityEditor.AssetPreviewUpdater:CreatePreviewForAsset(Object, Object[], String)
     
  10. paulomuggler

    paulomuggler

    Joined:
    Mar 18, 2014
    Posts:
    4
    Hi there,

    I stupidly upgraded my project to 5.5.0 beta without a proper backup, and now am stuck on this version, and guess what it isn't playing nice with the ShaderForge plugin. Obviously I did not have high hopes that the plugin would just work, I am running a beta version of the editor after all.

    But I might as well report the issue I'm having, maybe it can help the upgrade process in case something in ShaderForge side will need to change in order to work from Unity 5.5.0 upwards.

    Here is the error from the console output:

    It seems to be an issue with code reflection, followed by a NullReferenceException when it attempts to destroy the shaderforge editor window (which never got created in the first place).

    From the looks of it, this could be caused by changes in unity C# API in version 5.5.0 beta. Maybe a method's name or signature has changed? Or maybe some C# namespace change affected ShaderForge code somehow.





    On a side note, the example shaders are giving compilation errors; maybe this is related? They all give the same error:

    cheers
     
    Last edited: Sep 24, 2016
    VOTRUBEC likes this.
  11. Enoch

    Enoch

    Joined:
    Mar 19, 2013
    Posts:
    198
    I posted this in shader forum but perhaps Shader Forge has a builtin way to do this.

    Is there any way to control the Shadow strength from lights via a shader property or even vertex color?
     
  12. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    As opposed to changing the strength of shadows via the light itself?

    On a per-shader level, I wouldn't think so. Light Attenuation is calculated in Unity's internal Defferred shader pipeline - you can edit it there but I don't think you'd be able to break it up further without then somehow getting Shaderforge to recognize the new lighting property.
     
  13. Shiyao

    Shiyao

    Joined:
    Nov 27, 2013
    Posts:
    23
    Does anyone know how to use Shader Forge to make a bark shader for unity tree creator? Is that possible?right now, unity dose not support PBR shader for tree creator. That is a big problem for my project.
     
  14. synapsemassage

    synapsemassage

    Joined:
    Jul 27, 2009
    Posts:
    334
    Reinstalling Unity still shows Shader Forge version 1.18 and warnings related to custom editor as mentioned before.

    I did a reinstall of Unity 5.0.1f1 as I am also plagued by this bug that occured after messing around with reinstalling/deleting shader forge. Although I don't know if this is related yet it's a coincidence that gives me some feelings in my guts as both bugs hint to GUI.
    https://issuetracker.unity3d.com/is...-but-is-not-known-in-guidmapper-dot-dot-dot-1

    The issue is also escalated in the forum https://forum.unity3d.com/threads/u...mps-but-is-not-known-in-assetdatabase.274492/

    The timestamp-problem specifically started when I renamed a folder from lower case to upper case (first letter in folder's name) that made the folder magically disappear and broke references to shader forge shaders. But I had a lot of warnings and errors in console before that startet with shader forge issue. Just want to let you know, maybe you have a brilliant clue in this matter as the Unity guys couldn't fix this timestamp issue completely as you can see in the issue tracker.
     
  15. adamlukegoodwin

    adamlukegoodwin

    Joined:
    May 10, 2015
    Posts:
    15
    Please can anyone help me?

    I am trying to make a fairly basic shader, but am really struggling..

    I am trying to make a shader with parallax from a height map.. Also trying to make a color mask like the example from Unreal below..

    I would be so grateful if anyone can point me in the right direction!

    Thanks :)
     
  16. adamlukegoodwin

    adamlukegoodwin

    Joined:
    May 10, 2015
    Posts:
    15
    I saw the height map example that comes with shader forge and it helps a lot ~ but using lerp in SF (To use a mask and add a tint to anything not masked) doesn't seem to work quite the same as in Unreal. Any ideas how I could do this?
     
  17. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi there,

    Would be possible to create a shader that could add some kind of decal over a given position in the mesh material. Like regular decals on click over a surface but driven by a shader? Obviously, using SF. I know it is possible, but quite hard to achieve!

    Thanks for the help!
     
  18. adamlukegoodwin

    adamlukegoodwin

    Joined:
    May 10, 2015
    Posts:
    15
    Ignore my above posts.. Was just inpatient! :D I figured it out :)
     
  19. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Feel free to share your solutions. It might help someone else down the road. :)
     
  20. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    I'm using Unity 5.4.1 p2 and ShaderForge 1.28 on OS X (El Capitan) I'm having some issues seeing the shader actually render in the Scene and in the Game view. When I finally press play, I get this error spamming to console:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. ShaderForge.SF_EditorNodeData.CheckHotkeyInput (Boolean mouseOverSomeNode)
    3. ShaderForge.SF_Editor.UpdateKeyHoldEvents (Boolean mouseOverSomeNode)
    4. ShaderForge.SF_EditorNodeView.OnLocalGUI (Rect r)
    5. ShaderForge.SF_Editor.OnGUI ()
    6. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    7.  
    After this, all my windows stop responding. The only way to restore it is to reset my workspace to another setting. Usually, shortly after this, Unity crashes. I've already filed the Unity Crash report but without my project as it would take most the night to upload and I can't do that at the moment (1.3 GB).

    This bug is pretty infuriating because it happens every other play so I may try to downgrade Unity but this patch has other fixes I need because Unity on OS X has been so terrible in the last few months.
     
    Last edited: Oct 1, 2016
  21. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    Tried Downgrading to Shaderforge 1.27 because it was easy to roll back in the Repo. (So glad I check in after every package update. Same steps but different error:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. ShaderForge.SF_PassSettings.OnLocalGUI (Int32 yOffset, Int32 in_maxWidth)
    3. ShaderForge.SF_Editor.DrawPreviewPanel (Rect r)
    4. ShaderForge.SF_Editor.OnGUI ()
    5. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    6.  
    Update: Looks like this issue is the same reported here: http://shaderforge.userecho.com/topics/1204-shaderforge-editor-glitch/

    Attaching the shader I'm working on in case it can help: https://www.dropbox.com/s/cju8a84ib5l9k9l/WindVertexAnimationAlbedo.shader?dl=0
     
    Last edited: Oct 1, 2016
  22. munnergep

    munnergep

    Joined:
    Feb 17, 2011
    Posts:
    13
    Hi there,

    Would be possible to create a sprite shader that could mix the default and the diffuse sprite shader with a texture mask?
    (the base would be diffuse and the mask would set the emission with optional color)
     
    Last edited: Oct 1, 2016
  23. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    I've tried Unity 5.3, 5.4 and various version of 5.4. I've reimported my project, reset all my layout settings.

    So it looks like the reproduction steps are:
    1. Open Shader Forge
    2. Open a Shader
    3. Press Play
    4. Stop Play once your game is running
    5. Press Play again
    6. Stop Play
    then Shader Forge window ceases to fully render and:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. ShaderForge.SF_PassSettings.OnLocalGUI (Int32 yOffset, Int32 in_maxWidth)
    3. ShaderForge.SF_Editor.DrawPreviewPanel (Rect r)
    4. ShaderForge.SF_Editor.OnGUI ()
    5. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    6.  
     
  24. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Did you also delete the whole shaderforge folder and reimport the latest version from the assetstore?
     
  25. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    Yes, that too. Tried Version 1.27 and version 1.28. I even Uninstalled Shader Forge, Reset my windows, Deleted the Library, Upgraded to latest Unity Patch version and then re-imported everything in my project.

    Edit: Spelling
     
    Last edited: Oct 3, 2016
    Martin_H likes this.
  26. MS80

    MS80

    Joined:
    Mar 7, 2014
    Posts:
    346
    Hi. I'm not sure if this is possible with ShaderForge or not, maybe you can help me here?!

    I would like to build a UI shader which works with the unity ui image and mask component. I tried different stencil settings, but without success.

    warning => Material UI doesn't have _Stencil property
    UnityEngine.Canvas:SendWillRenderCanvases()

    I added stencil property like described here: http://answers.unity3d.com/question...ader.html?_ga=1.67120727.772644758.1467823388
    It kind of works, but it's far from useful (shader needs to be changed every time after editing in shaderforge) and the material is not updating!?
     
  27. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Hello! Sorry if this is a known thing -- I'm trying to implement parallax, but I get a shader error when I attach the UV to the Diffuse node: "undeclared identifier 'partZ' at line 117 (on glcore)"

    I wasn't able to find any videos / tutorials on how to really use the Parallax node, so I may be doing something wrong of course. Anyone know anything about this?

    Thanks!

    Full error:

    Shader error in 'Shader Forge/TestVertexShadre': undeclared identifier 'partZ' at line 117 (on glcore)

    Compiling Vertex program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP
     
  28. synapsemassage

    synapsemassage

    Joined:
    Jul 27, 2009
    Posts:
    334
    This warning is quite annoying. I always fix line enings in VSCode but after opening a shader in Shader Forge it rolls back to Unix Style line endings. I start to feel like sisyphos.
     
    Martin_H likes this.
  29. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Is there a way to grab the RGBA from the Texture node, rather than just the RGB?

    Screen Shot 2016-10-05 at 10.09.42 PM.png
     
  30. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I think you can just feed RGB and A into an "append" node to get RGBA.
     
    infinitypbr likes this.
  31. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Hey guys.

    I came across the World-Space UV Mapping example a few weeks ago and have been trying to adapt it to use object-space instead of world-space as I don't want it to move when the object moves, but can't use tri-planar.

    Does anyone know how to create an object-space shader in SF?
     
  32. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I don't fully understand what you are trying to do, but you might want to experiment with the transform node that can convert between localspace and worldspace.
     
  33. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Thanks, that did work. However it doesn't get the end result I'd like

    I'm trying to layer one texture onto another with a mask. That part works, but the opacity of one layer doesn't get taken into account. I'll keep working at it!
     
  34. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Is there a way to do a switch only if a map is selected? I see the "If" node, but I don't see how that could be used.

    I'd like to user a Metal/Rough slider only if the map has not been selected. If the map is selected, I'd like to not only not use those sliders, but make them disappear from the Inspector. Is that something that can be done in SF?
     
  35. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Try using a Lerp node:
    http://acegikmo.com/shaderforge/nodes/

    Feed in both textures in A and B and the mask texture into T.



    I have no idea, but I'd like to know as well. Is this something that still get's done at shaderlevel or are we in "custom-editor" territory already?
     
  36. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    What I am trying to do is have a shader that means I don't make to unwrap any of my basic geometry (walls, floors etc) which all use basic tiling textures.

    I have textures that have been built to require a size of 4m per tile, so objects smaller than that will need to have their UV's carefully fiddled with which takes time.

    I would prefer to have a shader which uses a value to tell the shader how many meters per tile, and have it so that if I scale that object up, the UV's don't go with it, so if I scale, the shader maintains that 1 tile per 4m resolution.

    I remember seeing something like that on here a long time ago but there are 110 pages of thread here, I doubt I'll ever find it, so I was hoping someone might know how it is done.
     
  37. DaDarkDragon

    DaDarkDragon

    Joined:
    Jun 6, 2013
    Posts:
    115
  38. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I'm not sure if that really is best solved with a shader or if it wouldn't be better to write a solution that "auto-unwraps" the geometry according to what you need. Imagine a Hallway making a sharp corner, you'd want the textures to correctly loop around the corner for the best visual result. That would be easy to do with correctly unwrapped geometry, but I have no idea how or if a shader could solve that. You could google for regular non-shaderforge shaders that do something like that. If you find one, look at the sourcecode and see if you can transfer that into Shaderforge.
     
  39. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Is there a way to increase or decrease the contrast of a B&W mask?
     
  40. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
  41. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Making some progress on the UFO hunter thingy

     
    Ga2Z likes this.
  42. kdm3d

    kdm3d

    Joined:
    Jul 20, 2012
    Posts:
    15
    You're looking for the power node.
     
    infinitypbr and hopeful like this.
  43. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi @Acegikmo can you tell me if ShaderForge currently has support for the new GPU instancing features in Unity 5.4? or if support for this is on the roadmap? I need it for big RTS scenarios and would help a lot, thanks.
     
  44. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    Thanks, I'll give that a try!


    Anyone know if a TriPlanar method that works w/ normal maps has been figured out? Last @Acegikmo said on this forum thread is that he got half way there but issues still existed: http://neatcorporation.com/forums/viewtopic.php?t=8
     
  45. deab

    deab

    Joined:
    Aug 11, 2013
    Posts:
    93
    Apologies but reposting as didn't see an answer to this.
     
  46. Josh-0

    Josh-0

    Joined:
    Oct 12, 2011
    Posts:
    29
    Will support for Baked GI with Directional mode set to Directional Specular ever be added? I'm also curious as to why this isn't a feature. It seems like a pretty big deal.
     
    Martin_H likes this.
  47. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    Is there any realistic skin shader for shader forge? I can't achieve realistic skin with shader forge.
     
  48. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    That's a good topic: how to make a good, performant skin shader. I think the docs suggest using light wrapping as an inexpensive way of approximating subsurface scattering. Maybe a little fresnel ...?

    I'm sure other people here have a more sophisticated take on it than me, and there's probably an example skin shader chart out there somewhere.
     
  49. Deleted User

    Deleted User

    Guest

    Hi guys,

    I'm new to Shader Forge. I want to create a shader that has a Cubemap node which provides diffuse IBL, because I find it annoying that Unity's reflection probes provide only specular reflections and no diffuse ambient lighting like for instance Skyshop does. Instead that terrible global diffuse ambient lighting is everywhere and I want to override it on a per-material basis.

    Since Shader Forge offers a "Diffuse Ambient Light" channel, I suppose it's straight forward to create want I am looking for.

    Please have a look at my simple shading network I attached.

    Is my setup correct?


    - I imported the HDR image as "Advanced" and set the "Convolution Type" to "Diffuse (Irradiance)".

    - My Shader Forge network is set to PBL Specular mode and I made sure that I supply a high MIP level to the diffuse IBL Cubemap (in this case value 10) so that I get a sufficiently blurred Cubemap.

    - Is the "Normal Dir" node correct?

    - In the importer settings do I have to generate MIP maps in linear space?

    Have I set something wrong in the importer settings? Do I have to use additional nodes in my shading network?

    Thanks so much for your help!

    Sean
     

    Attached Files:

  50. Deleted User

    Deleted User

    Guest

    Finally Gater it's recursive! :D