Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Shader Forge - A visual, node-based shader editor

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

  1. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    I've planned to make more tutorials going through things from the start!
    Check out the tutorial section on the website! There is a very basic one over there :)
     
  2. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,049
    Gave ShaderForge a little Sunday afternoon spin to see if I can get a nice "plastic/toy" look. Looks especially nice via the Oculus Rift!
     
  3. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,089
    this is probably a really silly question that I should have RTFM'd, but... how do I zoom in/out of the node panel?
     
  4. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    You can't, but it's a planned feature :)
     
  5. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    726
    Thanks for the reply! What about the Ambient Diffuse and Specular Inputs? Are you planning to include them to the energy conservative inputs?
    Also, i am not sure if i understand correctly, the Spec input has the Schlick approx. Fresnel considdered, how is that dealing with different materials like metalic vs nonmetallic etc.? Should i disable the Fresnel checkbox in the lighing settings if i work with fresnel nodes(i.e. on spec)?

    Another unclear topic is the visibility term, can you point me into the right direction where i could learn more abou this?

    Sorry for the many questions but i want to use the full potiential of SF :) Maybe you want to add a FAQ page to your website with things like that explained, i guess that many users will ask the same questions over time.

    Thanks again!
     
  6. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Ambient Diffuse and Specular don't take it into account yet no.
    It was a long time ago I did the PBL implementation, I think all the info you need on that can be found here: http://www.altdevblogaday.com/2011/08/23/shader-code-for-physically-based-lighting/

    Which outlines the same implementation I have in SF :)

    And yes, I should get a FAQ up.
    I'm cleaning up the Changelog section at the moment though, so, soon!
     
  7. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,420
    That's very Becoming of you! :D

    Might we see the Forge nodes? I'm rather interested in comparing the PBL (and IBL) here to Alloy or Jove (and Marmoset).

    Thanks man!

    -Steven
     
    Last edited: Jan 12, 2014
  8. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    The Forge nodes?
     
  9. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    yeh please don't remove that feature as it is VERY handy as I can render shadow casting lights in forward renderer... Maybe make it an settable option or something :)
     
  10. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,420
    Becomings Shader Tree...Forge Node Tree...how he came up with the surfaces in his shot. :D
     
  11. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    I like the phrase "Node tree", it points to the very foundation of what it is, a tree of nodes!
    "Node graph" is a bit misleading, in my opinion, but is used quite a lot.
     
  12. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,089
    so far, i'm really liking this tool.. great work. I also really appreciate the effort you've made so far in providing examples of the various node features as shown here: http://acegikmo.com/shaderforge/nodes/

    I'm an artist, ... so visually this helps tremendously. I hope you are able to provide the same type of guides for the more complex areas like the differences between blend modes and how they're used... etc.

    also, the code you're generating within the shader is nice and clean.
     
  13. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Thanks tswalk!
    Glad you like the code output too - I tried to make sure it would look as if it was handwritten in the style I personally do.
    I've planned to have a documentation for all the settings in the left hand side panel, I just haven't gotten to it yet :)
    (I've actually written it all down, but it's not on the website yet)
     
    Last edited: Jan 12, 2014
  14. BloodHound92

    BloodHound92

    Joined:
    Dec 21, 2013
    Posts:
    40
    Hello Shader Forge Developers,

    I am still very new to shaders so I have a very basic question. Could I use Shader Forge to create efficient shaders for mobile games which use the GLSL 2.0 shader model?

    From,
    BloodHound92
     
  15. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    726
    Well, then lets get naked ;)

    $SF_PIBL01.jpg
    (right click and open in new tab)
     
  16. DaDarkDragon

    DaDarkDragon

    Joined:
    Jun 6, 2013
    Posts:
    109
    Great tool man, love it. I might be missing something but I don't see it. Is There a way to use a float property lets say, and use that to multiply it with the speed in the panner? The things I have tried also tile the texture which is un-wanted.

    Edit: Also how would you incorperate a flow map into the shader? (Not making the texture but plugging it in the right place with other nodes, I found an app that can make them)
     
    Last edited: Jan 13, 2014
  17. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,420
    Haha oh me likey gitin nekkid...

    ...and wow that's far and away more elaborate than I expected! Two things:

    • There's a great deal of math going on, so I'm wagering it's a rather expensive shader; what was the process that lead you to ultimately using so math 'Multiply' nodes? Were you simply not getting enough of an effect you were looking for?
    • Were your IBL cubemaps anything special, such as generated by Skyshop or being HDRI?

    Good work mate, really. :D

    -Steven
     
  18. SmashedAvocado

    SmashedAvocado

    Joined:
    Dec 19, 2013
    Posts:
    32
    Really awesome tool! I just bought it and started mucking around. It's fun and easy to make shaders.

    Really hoping for Deferred Lighting support soon, as I didn't realize that it wasn't working properly when I purchased. I used Deferred in most of my games and so I can't use a lot of the shaders I make at the moment.
     
  19. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    2,861
    Alright, I admit defeat. I've been able to make a few general purpose shaders in SF that work for my current project, but this DICE translucency thing is just completely kicking my ass. Here's the relevant info from that link:

    [​IMG]

    See, I'm AWFUL at writing shaders and also awful at reading the code of other shaders. Near as I can tell, this is what my shader is supposed to look like, structure wise:

    [​IMG]

    But for some reason it doesn't seem to read the depth mask right at all and just seems to overlay it on top of whatever I apply it to. I'm sure there's something obvious I'm missing here. Any help anyone can offer would be great though.
     
  20. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    You can!
    Shader Forge emphasizes on quality though, so most operations are done on a per-pixel level rather than per-vertex. This can be controlled to a degree in SF.
    So if you're doing mobile shaders in SF, I would recommend using simple lighting models or unlit stuff. It largely depends on the type of shader you want to make. :)
     
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    1,579
    Congratulate with the first release, it is THE BEST thing on Asset Store.
     
  22. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    You're plugging it into transmission, so you've essentially got doubly defined light and transmission calculations now. Set light mode to custom and plug it into custom lighting instead :)

    Thanks Arkhivrag!
     
  23. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    2,861
    Well now I feel stupid, seeing as I have nothing but custom lighting shaders in all my current shaders. I'll give it a look over and adapt it for the custom node when I'm more awake.
     
  24. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    That looks fantastic! I thought the Unity team were developing a new shader editor but you've beaten them to the finish... :)

    Now I have a question: can I use Shader Forge to create a layered tessellation shader and use the alpha value of the mesh's vertices to do the blending? Meaning a vertex with alpha at 1 will show the first "sub-material" while a vertex with alpha at 0 will show the second "sub-material". And intermediate alpha values will blend between the two.

    By "sub-material" I mean a set of diffuse + normal + height maps.

    And if this is possible, does Shader Forge's preview meshes include vertex color info (including alpha) to actually see the blend?

    Thanks...
     
  25. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Yes, all of that is possible, assuming you have DX11 hardware and software!
    Only three of the included meshes are vertex painted though, but you can load any model you like into the preview window of SF :)
     
  26. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226

    Make a Time node and multiply it by a Value property, and then plug that into the Dist input of the panner!
    If you want more control you can make a manual panner like this:

    [​IMG]


    For flow maps, check out this .pdf and you should get all the info you need: http://www.valvesoftware.com/publications/2010/siggraph2010_vlachos_waterflow.pdf
     
  27. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    145
    No idea how,where and why this happens..

    build errors >
    Assets/ShaderForge/Example Assets/Scripts/EditorLabel.cs(2,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?


    Any suggestions ?

    Unity 4.3.2f1
     
  28. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    That's fixed in the upcoming Beta 0.19! In the meantime:

    1. Open EditorLabel.js
    2. Put this above all text on a new line: #if UNITY_EDITOR
    3. Put this below all text on a new line: #endif
    4. Save, and it should work again :)

    0.18 is still being verified by Unity as of last friday, so 0.19 will take a while sadly :/
     
  29. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    145
    Thank you! It worked.
     
  30. RideTheT

    RideTheT

    Joined:
    Jun 11, 2012
    Posts:
    23
    Hi, could you expand on this a little please? I'm thinking of getting Shader Forge for an upcoming mobile project.

    Also congrats on the release, looks as though its going to be very successful.
     
  31. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Thanks :)

    You can control it in terms of disabling/enabling features that are superfluous, as well as specifying some quality settings for real-time lighting, such as whether or not to normalize the incoming normals on a per-pixel level.
    But in general, for mobile stuff, you'll want super cheap rendering (Depending on the game of course), and right now there's no per-vertex lighting, for instance, which makes it expensive on mobile.

    That said, if you run custom lighting and make relatively cheap shaders, you can absolutely use the SF shaders.
    And of course, the high-end shaders work too, it just depends on your target platform and how expensive your game is otherwise.

    You could also use SF for prototyping/iterating, and optimize the shaders after creating them.
     
  32. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,343
    Do you have or can you add some optimizations for mobile such as using the smallest datatypes needed - fixed/half etc - that helps a lot. I've found there is quite a high demand for `mobile` versions of shaders so it could be a good `feature` to add.
     
  33. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    I'm not sure if SF can figure out the "smallest data type needed" as everything is extremely context sensitive.
    But it is something that should be implemented!

    Perhaps a global precision setting for now, and later a per-variable setting?
     
  34. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    @Acegikmo: I just bought Shader Forge and it looks really neat!

    I'm attempting to do a simple tessellation shader and I'm having a problem: the preview mesh looks fine (it's correctly tessellated) but when I assign the shader to a mesh (a cube) in my scene it looks wrong: the cube is tessellated but looks like it has a second darker cube within itself.

    Do you see any obvious mistake with this graph?

    [​IMG]


    My second question concerns the DX11 Tessellation plug: I would like to have the mesh tessellated according to its distance to the camera (instead of an absolute amount). Any hint about doing this?

    I'm still a little bit of a newbie at this so any help is appreciated...
     
  35. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Make sure you're running forward rendering! If that doesn't work, try toggling shadows on/off in the object

    As for distance biasing: this is an example of a camera fade, but you can use similar setup in your case :)

    [​IMG]
     
  36. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    542
    Out of curiosity, has anyone built a normal mapped lit particle shader with SF, yet?
     
  37. Rog

    Rog

    Joined:
    Oct 16, 2012
    Posts:
    23
    Purchased. I'm already so, so happy with it. Overall it feels really well-rounded considering you've just released it to the asset store.

    I would like to see more detailed documentation, especially for the IBL features. I'd like to know more about how standard specular and gloss affect the IBL. On your example IBL picture it seems like you have other values multiplying for IBL intensity when I would have expected to plug the cube maps in directly and driven them from the other inputs if present (diff, spec, gloss and normal, etc.).
     
    Last edited: Jan 13, 2014
  38. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    Thanks for your quick reply! I'm seeing strange things here. I'm on forward rendering mode and I just assigned the demo tessellation material from Shader Forge (the one that looks like clouds running over some square patterns) to a simple cube.

    This is what I see:

    [​IMG]

    That looks very wrong an not at all like on the preview mesh. It looks like the skybox is covering parts of the cube (?!!). Any idea what's happening here?

    I also tried without skybox (solid gray and it's the same problem).
     
  39. Rog

    Rog

    Joined:
    Oct 16, 2012
    Posts:
    23
    Also I like shadows (on point lights, etc.) enabled for forward rendering. If that gets removed by default, it would be nice to have it as a toggle perhaps under Lighting or Quality, so I don't have to manually edit each shader after changes.
     
    Last edited: Jan 13, 2014
  40. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226


    Oh, hm, no idea what that could be :(

    Maybe there are some weird quality settings in your project or a weird light setup?
    How does the included example scene look with the same shader?
     
  41. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    Oh my. I just saw that the artifacts go away if the cube is set NOT to receive shadow. Please don't tell me that tessellation shaders created with Shader Forge cannot receive shadows...
     
  42. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Just double-checked on my Windows machine - It's because you're running deferred rendering, switch to forward rendering and everything should work :)
     
  43. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    Oh, I feel silly now: I made sure that the project is in forward mode but hadn't noticed that my game camera was still in deferred mode! Silly me. Thanks again for your quick reply! :)
     
  44. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    671
    So I tried the distance-based tessellation but for the reasons explained on this page: http://docs.unity3d.com/Documentation/Components/SL-SurfaceShaderTessellation.html I decided to go with edge-length tessellation. Now as a code it's written:

    Code (csharp):
    1.  
    2. float _EdgeLength;
    3.  
    4. float4 tessEdge (appdata v0, appdata v1, appdata v2)
    5. {return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength); }
    But what would be the way to access the edge length information from within Shader Forge?
     
  45. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    No probs! Glad it works

    There's no way of accessing that at the moment - feel free to request it on the feedback page! -> http://shaderforge.userecho.com/
     
  46. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Thanks Rog!

    The IBL, marked as Diffuse Ambient Light / Specular Ambient Light, are multiplied with the Diffuse and Specular inputs.
    So if your diffuse is red, the Diffuse Ambient will also be red - the same goes for the specularity and the specular ambient light.

    If you want to drive gloss through the MIPs of the specular cubemap, you need to plug it into the MIP input of the specular cubemap.

    The reason I have the values multiplied by the IBL cubemaps, is to bias the RGBM decoding to unpack them to HDR range. The values in the example image aren't exact, they're arbitrary at the moment, as I haven't look at which unpacking constant they used :)
     
  47. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    121
    Hello there~
    So far, I'm absolutely thrilled with my purchase--thank you so much for developing such a wonderful asset!

    However, I have a question due to me being new to shader creation--how does one combine two textures according to their alpha channel?
    I am currently working on an eye shader, and I'm playing with the thought of having the iris texture as a greyscale and colouring it with a colour attribute (which works great so far)--I fail, however, at combining the ground image with the transparent iris texture.
    [Also, SF seems to have problems with textures with transparent background--while they show up fine in the "Texture Asset", they fail to be shown correctly in "Texture 2D".]

    Thank you for your time!
    - KW
     
  48. Almighty_gir

    Almighty_gir

    Joined:
    Oct 22, 2012
    Posts:
    24
    i thought ambient was supposed to be additive not multiplicative? with multiplicative it would always give a metallic type look. unless i'm mistaken?
     
  49. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    I think you'll want to use the lerp node for that, similar to this :)

    [​IMG]

    And thanks for the bugreport!

    Well, it depends on where in the equation you look ;)
    Simply put:

    diffuseInput * diffAmbLight + specularInput * specAmbLight
     
  50. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Also, some neat news!

    Shader Forge Beta 0.18 now released:
    • You can now use Shader Forge in Unity 4.2.0
    • New node: Vector Projection
    • New node: Vector Rejection
    • The main menu now has a much more visible out-of-date notification, when a new version is out
    • Fixed a bug where properties didn't show up when connected to some inputs
    • Fixed a bug where deleting nodes didn't update the Main input availability status
    • A bug where shaders didn't save when using the built-in Perforce version control, may have been fixed now

    Click to see all changelogs

    (Don't forget to delete the old Shader Forge before updating to this one!)
     
    Last edited: Jan 13, 2014