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

    elvisov

    Joined:
    Nov 14, 2015
    Posts:
    1
    Hi! Sf is cool! Does anybody know how to make a vertex lit shader? Any examples? Plz :)
     
  2. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Anyone having an issue where the graph for any shader is empty?
    I am using the latest version of SF and Unity 5.3.2f1
     
  3. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Very nice, hope you will continue working on this.
    Do you have somewhere I can download this latest version?
     
  4. Deleted User

    Deleted User

    Guest

    Last edited by a moderator: Apr 5, 2016
    DMeville, Studio_Akiba and hopeful like this.
  5. jackishere

    jackishere

    Joined:
    Mar 1, 2014
    Posts:
    22
    I can confirm! that one works but i still hope on the future update the meta pass will not be included because it's kind of annoying to keep deleting those lines everytime you build the shader
     
  6. qwert024

    qwert024

    Joined:
    Oct 21, 2015
    Posts:
    43
    Hello!
    I just get started with Shader Forge and like it a lot :) Still learning and playing around with it.
    I want to create a "wireframe-style" shader like the picture below and apply it onto meshes.
    Or a shader which can highlight/emphasize the edges of my mesh.
    However I don't really know where to start.
    I think some keyword might be VertexColor, Opacity, etc.?
    Thank you for your help! Any suggestion and advice are appreciated.
    upload_2016-2-19_15-45-32.png
    (I don't own the picture, I googled it. It belongs to VallentinSource .)
     
    Last edited: Feb 19, 2016
  7. toxicFork

    toxicFork

    Joined:
    Sep 15, 2011
    Posts:
    8
    Hi :) I have just updated the script and shaders to work with 5.3.2 ( http://www.toxicfork.com/273/per-object-clipping-planes-shader-updated-for-unity3d-5-3-2 ) , and for rotations just make sure you use euler angles :) You can PM me for additional help if you like! I am sure there must be a way of getting similar functionality using SF as well :)
     
    hopeful and Deleted User like this.
  8. Deleted User

    Deleted User

    Guest

    Many thanks ( I did not think to receive news, directly from the creator of asset :D ), and yes, would be very useful if your shader was recreated on ShaderForge, would make the project more complete/accessible. :)

    P.S = If it can be of help, this is a old one of my clipping project, which unfortunately does not work with the position and rotation of a plane. Maybe you can help me to improve this:

    http://forum.unity3d.com/threads/sh...sed-shader-editor.222049/page-86#post-2260918
     
    Last edited by a moderator: Feb 19, 2016
    hopeful likes this.
  9. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    On the latest version of SF and Unity 5, I lose my shader graph when I re-open it, it just sin't there anymore, but the material still works as if it was al still there.
    When I try to take a screenshot with the camera button, it flashes back for a second and goes away again, is this a know problem or just me?
     
  10. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Bump?
     
  11. Ace_1999

    Ace_1999

    Joined:
    Jun 11, 2014
    Posts:
    30
    Well the render texture shield bubble for deferred decals I was able to get to work except for issues it has when overlapping with other objects which can't be solved without major performance hits.

    So I was wondering if anyone had some on-collision code that could be inserted into a shader so that the coordinates of a texture on a mesh could be tied to inputted coordinates from a script grabbing the collision data?
     
  12. w00523

    w00523

    Joined:
    Nov 19, 2015
    Posts:
    8

    Attached Files:

    • 231.png
      231.png
      File size:
      19.3 KB
      Views:
      1,047
  13. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Not sure what to say about this one.

    If you've saved previous versions (shader_v1, _v2, etc) you might be able to rebuild your progress.

    The other things I can think of are:

    Fresh install of SF (or a new project) (or both).

    Zoom really, really far out (I have to do this sometimes, I get self-inflicted node tree creep).

    Copy the shader (so you have something expendable), and see if you can work out some method of how to reposition one of the nodes so that it's visible, then follow the lines to presumably the rest of the shader.
     
  14. Grovel

    Grovel

    Joined:
    Feb 24, 2016
    Posts:
    6
    Hello fine folks. Picked up Shader Forge recently and I'm in love.

    Recently I've run into a tiny snag. I created a wonderful little toon shader with hatching and unfortunately my character is not casting a shadow. Below a photo of the no shadow situation.

    Is there a particular node or shader setting I need to enable for shadows to work?

    Thanks in advance fine crew of Unity!

    [/url][/IMG]
     
  15. Deleted User

    Deleted User

    Guest

    Anyone know how obtain a recursive rendertexture, like in this screen?

     
  16. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hi All,

    I am rendering a cubemap from within unity however, my shader is the only thing that does not light properly (no light or shadows). Can anyone think what might cause this?

    Thanks,
    Colton
     
  17. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Post a pic of your shader in the game/editor window, might help to see if there's anything that could help.

    Gut instinct is telling me that it's the cameras Unity is using to make the cubemap. In the 'rendercubemap' script there's probably a setting that changes the camera rendering path, from forward, deferred, etc. If your shader is set to something else, then that could be the problem because it's not doing the right passes to generate the info the shader needs to display properly.

    Either change the cubemap rendering path (in the cubemap script), or the shader rendering path (in the lighting panel in SF).
     
  18. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey Jesus,

    That was my first thought as well but both camera and shader are in forward rendering path.

    Here are some screenshots of the shader:
    upload_2016-2-28_19-50-39.png upload_2016-2-28_19-51-17.png upload_2016-2-28_19-51-34.png

    The node tree is too large to make sense of and I don't think it will be much help anyways

    Thanks,
    Colton
     
  19. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Can you post a pic from the game view of the object?

    The other thing I can think of, is that if you've got the object for reflection rendering (or whatever you're doing with the cubemaps) on another layer, is that layer excluded from the lights? You can change what lights affect, etc, in the inspector window for the lights.

    On the object itself, you can also toggle shadow and other lighting support (under the mesh renderer component).
     
  20. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    The cubemap is actually being used for a portal, here are some screens:

    Gameview:
    upload_2016-2-28_20-30-44.png

    View of cubemap through portal:
    upload_2016-2-28_20-31-38.png
    (Notice the color difference which is the same shader)

    Cubemap inspector which also shows dark images.
    upload_2016-2-28_20-32-10.png
     
  21. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Look in the cubemap script for something called pixellights (or similar). That could be doing it? Maybe PM me the cubemap script if you can, and a general overview of the shader (looks like it's fairly simple, grass on top otherwise, rock).

    Is there any reason you need double-sided? Try backface culling. Toggled lightmaps and light probes?
     
  22. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    I grabbed the cubemap script from the Unity docs http://docs.unity3d.com/ScriptReference/Camera.RenderToCubemap.html.

    The shader is fairly simple, triplanar that chooses a material based on the angle of the normal. It also has vertex painting as an override. The reason for double sided is that my game is made for VR and you can stick your head inside the terrain, if the shader is not double sided Unity culls everything but you can see through it.. This way when the engine culls the objects you still see the inside of the mesh.
     
  23. Deleted User

    Deleted User

    Guest

    Bump
     
  24. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    I don't have an answer for you, but I'd like to know too!

    I think I read a paper once about how they did this in Portal, but they didn't have "infinitely" recursive portal rendering. I think they limited it to 8 or something. Maybe it wasn't a paper, I don't remember and my google-fu is not strong this morning.
     
    Deleted User likes this.
  25. Deleted User

    Deleted User

    Guest

    Same thing that I have read yesterday, and the amount of recursions was 9 (the maximum number choosed by Valve) not 8, but however this is the link:

    reddit.com/r/Portal/comments/2z5j7z/how_are_portals_in_portal_actually_coded

    The problem is how achieve this effect on Unity :-\
     
    Last edited by a moderator: Feb 29, 2016
    DMeville likes this.
  26. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    @Acegikmo I am still incapable of opening any SF files in Unity.
    Any time I try to re-open any created shader I get this blank screen, the shader still works but I can do nothing at all with it.
     

    Attached Files:

  27. MOSTY

    MOSTY

    Joined:
    Sep 6, 2013
    Posts:
    266
    Looks very cool!
     
  28. testure

    testure

    Joined:
    Jul 3, 2011
    Posts:
    81
    you probably already know this- but don't forget that under the hood, drawing two sided actually doubles the triangles for those surfaces (no such thing as a free lunch). And worse still- in VR you're drawing everything twice, so you end up with four times the geometry that you 'think' you have.
     
  29. DotTeam

    DotTeam

    Joined:
    Feb 12, 2016
    Posts:
    196
    @Acegikmo Hi.
    Does "No extra files to sync over your version control system; Shader Forge uses a single file for shaders - the .shader file itself" means that i do not have to get Permission from you, so i can get materials made with Shader Forge into my assets, as long as i bought Shader Forge package, and then put my assets for sale on Asset Store?
     
  30. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    All the data for a Shaderforge file is stored as a comment at the top of the *.shader file. You can include the *.shader file in your assets, and anyone who owns SF will be able to open the shader in the SF editor and see the nodes. Anyone who does not own SF will still be able to use the shader like any other unity shader, but will not be able to edit it in SF.
     
    hopeful and DotTeam like this.
  31. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Working on a city terrain. Clouds and city shader done with SF

     
  32. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    ?
     
  33. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Not sure what to tell you. I'm using the latest version of SF and the same version of unity as you with no errors.
    Something must have happened to the SF data in your shader - it can't read it properly maybe. Not sure what would cause this though.

    You mentioned it flashes on when you take a screenshot of the node graph - why don't you recreate the nodes from the picture in a new shader and delete the old corrupted one maybe?

    Just to double check you could try loading the shader into a clean project with the latest SF and see if that does anything.
     
  34. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Assuming you've tried re-installing SF and Unity?

    Is anyone else able to open the shaders?

    Cactus, that's looking pretty good. Can you post a bit of a write-up on how you did the city stuff? I assume the clouds are just a series of transparent shells with alpha. I did a similar thing for a planet shader a while back, and I found that you could bastardise the parallax node to get both the appearance of several 'layers' of cloud per layer of mesh, and if, instead of working parallax from the view, you work it based off the lightsource, local self-shadowing as well.
     
  35. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    334
    hello everyone,
    i've been having issues with directional light cookies with alpha blend shaders for some time.
    i thought it will go away by time with shader forge patches etc.. but it didn't yet :(

    i have a very simple water shader which is semi- transparent as you can see in the first screen.
    in the next one, i added clouds cookie for directional lighting..
    note, i have this issue consistently appearing, there is nothing wrong with cookies or shader.
    it just water no longer shows background properly when clouds cookies is enabled, or something effects shader that makes its color tint doubled or something?

    lightcookiesIssues.jpg

    any feedback about this , i'll be thankful :)
     
  36. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    I have tried creating loads of new shaders, the second I close and re-open them this happens to them.
    I have also tried a clean project and re-downloaded SF.

    I have also re-installed Unity several times, all to no avail and a lot of time spent getting no-where :(
     
  37. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Can you post the shader to see if anyone else can open it without issues?
     
  38. MikeR_UFG

    MikeR_UFG

    Joined:
    Dec 1, 2014
    Posts:
    12
    Is it possible to have Shaderforge honor the stencil buffer state in the deferred pass? It appears to only write stencil settings into the forward pass.

    We are using Aras' deferred decals and he recommended using stencil state to control what does and doesn't get decals.

    Also, thanks for the fantastic product, Shaderforge is a joy to use.
     
  39. Kelborn

    Kelborn

    Joined:
    Feb 10, 2016
    Posts:
    9
    I need to put Vector3 in float value (metallic, for ex.). In unreal metallic is 3-dimensional value, but how can I do this using SF with same effect?
     
    Last edited: Mar 7, 2016
  40. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    577
    How to rip off a specific color?
     
  41. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Sorry, only just noticed your post.
    I've attached it to this post :D

    I started a new project...again. But still no luck, same thing happens.
     

    Attached Files:

  42. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    How is metallic a vector3? I don't understand.

    Shouldn't it be a single value for how metallic a material is at any given point. Unless that's what the vector3 is used for (some sort of material blending).

    Can you post some Unreal examples of a light gray (187/255) object with a metallic of (1,0,0), (0,1,0), (0,0,1), (1,1,1), (0.5, 0.5, 0.5) and (0,0,0). No blending, or anything else, just that on a sphere.


    Assuming I'm correct in this, you just need to put one value into metallic. If you need to access the individual channel, you can use the Component Mask node to grab R, G, etc on their own.
     
    DMeville likes this.
  43. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @Labyrith Studios

    I just loaded it into my SF test project, and it works without any problems. Node graph looks as it should. Noticed I was on an old version of SF (1.24), so I deleted it from the project, downloaded and imported the latest version and things still work perfectly.

    I'm also using Unity 5.3.2f1, and on OSX. Not sure what the problem could be, but I can't reproduce it, even in a clean project (like you said you tried).
     
  44. Kelborn

    Kelborn

    Joined:
    Feb 10, 2016
    Posts:
    9
    I mean, that in PBR we have to choose metal/rough or spec/glos. In both variants there are no floats like "how metallic is it" but we have to use maps like in this picture http://img.3dyuriki.com/15.03/raznica-dvuh-pbr-podhodov.jpg
    Maps for metallic and roughness, like in my example. In unreal it looks like this http://i.imgur.com/h46YxOG.png and the result is http://i.imgur.com/SoSXZ0K.png
    Or maybe I should use some different options to have the same look of texture?
     
  45. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    The first (russian?) picture doesn't work, but I think I know what's going on.

    Both the things going into Metallic and Roughness are grayscale in that example though, right? Either use a Component Mask node, then grab a random channel (they should all be the same in a grayscale image) and plug that into either Metal or Rough, or use the Desaturate Node.

    You can feed either the Desaturate or C.Mask node with RGB inputs, and it'll give you a single line out (meaning single channel).


    EDIT: Just for kicks, can someone try feeding Unreal some Metallic and/or Roughness values that are vector3's? Like Red, Blue, Cyan, etc?
     
  46. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I'm taking a break from UE4 to work on shader forge
    Made a fuzzy furball with smooth shading :)

     
    lorenzodom, StenCG, Malbers and 16 others like this.
  47. Kelborn

    Kelborn

    Joined:
    Feb 10, 2016
    Posts:
    9
    Thanks man, that's it :)
     
  48. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    I'm considering the purchase of this wonderfull asset; i'm particularly interested in making this kind of water (with moving vertices)

    Is it possible ? And since i'm a very n00b into this, any tutorial or pre-made shader ?

    Thanks !

     
  49. RogueCode

    RogueCode

    Joined:
    Apr 3, 2013
    Posts:
    230
    I'm having an issue creating an post-process imageeffect and I'm hoping someone can help me.

    I create a new "Post-Effect" shader in SF, and leave everything as default (or add a Texture, doesn't make a difference). Then I create a script with this in it:
    Code (CSharp):
    1.   public Material Material;
    2.  
    3.   void OnRenderImage(RenderTexture source, RenderTexture destination)
    4.   {
    5.     Graphics.Blit(source, destination, Material);
    6.   }
    And put that component on the camera and assign material.

    The screen is just always black. If I change that material to rather use the Unlit>Color shader from Unity then it works, and the Game window shows the correct color. But no matter what I try with a SF shader I can't get it to do anything other than be black.

    If I put the SF shader on an object in the scene then it works.

    My camera is in forward.

    Any ideas?
     
    DMeville likes this.
  50. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    In advance, sorry if this is a little too in-depth, just wanted to use my knowledge of PBR tech.

    As you already know, you have to pick either a Metallic/Roughness or Specular/Glossiness preset, these are inverts of each other:

    Metallic = Glossiness Inverted - Specular = Glossiness Inverted
    Roughness = Specular Inverted - Specular = Roughness Inverted

    This is dependant on whether you are using the Disney GGX BRDF shader model (Specular/Glossiness) or the more standard Roughness/Metallic model. As you are using Unity we will assume you are using the Spec/Gloss method.

    In order to use a B&W Specular or Gloss map (you shouldn't use colour as it is not supported), use either the Red, Green or Blue channel of the Texture2D node in the slots, instead of the RGB one.