Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  6. Unity 2017.2 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
    Hello!
    After about 5 months of development, Shader Forge is finally ready to be released publicly :)
    With Shader Forge, I wanted to bring AAA quality shading to Unity with massive amounts of flexibility and customization in an intuitive way - not just a rigid set/pack of shaders.

    Mail: webmaster@acegikmo.com
    Twitter: @JoachimHolmer or #ShaderForge

    And of course, a little feature summary and screenshots below!
    Hope you like it :)

    // Joachim Holmér


    Workflow:
    • Create shaders visually with a real-time 3D preview - no code required
    • No extra files to sync over your version control system; Shader Forge uses a single file for shaders - the .shader file itself
    • SF writes CG shaders that can be used in any project, without installing Shader Forge
    • Works in both Unity Pro and Unity Free
    • Documentation and support center, for contributing feedback and bug reports
    Some of the features:
    • Built-in Physically Based Lighting mode and energy conserving shading
    • Visual and intuitive interface - Get a clear overview of what each node does
    • Custom lighting nodes and IBL support, with seamless Skyshop integration coming soon!
    • DX11 Tessellation Displacement
    • Transparency; both partial and alpha clipping
    • Refraction Render Textures
    • Optionally use lightmapping and light probes / spherical harmonics
    • Plus all the essentials such as cubemaps, custom blending modes, depth sorting, fog control, and much much more!

    [​IMG][​IMG]
    [​IMG][​IMG][​IMG][​IMG][​IMG]
     
    Last edited: Oct 5, 2015
  2. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    1,782
    This tool is absolutely amazing.
     
  3. donzen

    donzen

    Joined:
    Oct 24, 2009
    Posts:
    54
    Cool tool, and now is mine! :)

    Can you please show all the connections for this effect?

    Another question: how can I distort the UV using a 2D texture?
     
    Last edited: Jan 11, 2014
  4. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    93
    This is an amazing powerful tool....

    I've created beautiful shaders in a really fast way, and the best part, it is really well performed.

    I tested it on OUYA and Galaxy S, it work and really fast (obviously it depends on wich shader you are using)

    Thanks for this tool... for sure, on the top best tools in asset store.
     
  5. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Distortion can be done my offsetting, with the add node, a UV coordinate node by a texture, and then plugging it into the UV input of a texture.

    Here's the node tree you were asking about:

    [​IMG]
     
    OP_toss likes this.
  6. The-Spaniard

    The-Spaniard

    Joined:
    Jan 7, 2012
    Posts:
    149
    Awesome! Congratualtions on release!

    A question: what would be the best way to get the distance from a vertex to a camera clip plane in Shader Forge?
     
  7. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,046
    One of the most anticipated tools is finally on the Asset Store! Good work Ace. Keep moving forward. Would love to see more tutorials, nodes etc in future updates :)
     
  8. donzen

    donzen

    Joined:
    Oct 24, 2009
    Posts:
    54
    (I've deleted the post by mistake)

    I can't connect operations like MULTIPLY and ADD to ANG and UV, I'm doing something wrong?


    $FailedConnection.jpg
     
    Last edited: Jan 11, 2014
  9. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    This is a bit tricky. Assuming you are content with a pretty close approximation, this should do for a camera fade:

    [​IMG]

    It's not 100%, because it's assuming your screen is not flat, but radial. You can add a slight bias to it by adding a small value to the projection parameter near distance, if you experience some clipping issues near the edges of the screen :)
     
  10. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    686
    View attachment 81969

    Is there a rule which value to use to decode the RGBM? Also i would like to know how to drive the Specular IBL Cubemap Mip with a glossmap, if that is possible. Thanks a lot for this awesome Tool !!
     
  11. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    That's because your multiply node hasn't evaluated yet. Connect the inputs of it first!
     
  12. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    There is no rule for RGBM, there are different standards depending on how the cubemaps were saved in the first place!

    Unity probably has one rule for their RGBM (I think it's 4), Skyshop probably has their own value. It may not even be linear, so this is just an approximation from me :)

    If you want to control glossiness, connect a value, such as your glossiness value, into MIP and multiply it by something around 5-8, and you should get MIP control with the glossiness!
     
    Last edited: Jan 11, 2014
  13. donzen

    donzen

    Joined:
    Oct 24, 2009
    Posts:
    54
    I've found the problem. I was connecting RBG instead of a single color channel with the 2Dtexture node :)

    Thank you for you your answers :)
     
  14. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,151
    ooooooh it's released
     
  15. jmatthews

    jmatthews

    Joined:
    Jul 27, 2011
    Posts:
    199
    Congrats, quite an accomplishment.
     
  16. The-Spaniard

    The-Spaniard

    Joined:
    Jan 7, 2012
    Posts:
    149
    Hmm, ok then, thank you! I was hoping for something more accurate - my current shader works basically as you described, and I get issues near the edge of the screen. I'll give the bias a shot. Or maybe if I use the view angle and some trigonometry... Is it possible to get view angle? Something about projection matricies? Shaders make my brain hurt sometimes.
     
  17. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    It is quite dark, because it's doing energy conservation calcs. You'll need stronger lights in your scene or, like you said, multiply the diffuse by some value :)
    By default, the Unity directional lights have an intensity of 0.5, I recommend setting it to 1

    Yeah that's because you're connecting a loop (infinite loop), I haven't added a loop detection yet! Ideally you shouldn't be able to make the connection in the first place
     
  18. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    The 0.18 update is soon out! It's not a very big update, but it fixes an issue where some properties didn't show up.
    I'm also adding two new nodes; Vector Projection and Vector Rejection :)
     
  19. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    588
    Gratz on release!

    This product and documentation look very well made.

    Will surely get it at some point.
     
  20. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    What do these nodes do? also as I've said in the other thread numerious times this tool is really awesome and Acegikmo is very good at answering questions if you get stuck. I'd highly reccomend it!
     
  21. Acegikmo

    Acegikmo

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

    About the new nodes;
    Assuming you have two vectors, a and b (The black ones in the image), you get get the resulting vectors a1 and a2 using Vector Projection and Vector Rejection.

    The Vector Projection node gets you the green vector, a1
    The Vector Rejection node gets you the red vector, a2

    [​IMG]
     
  22. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    645
    Ok, I created a flow refraction shader using the example refraction shader as a base. It'll flow the texture, refract anything behind it. I've it designed to support a flow texture, a refraction texture, flow speed, flow direction, flow emission, refraction intensity, and you can add color to it.

    With that said onto my issue. I can't seam to get specular to work. I want to be able to add a "shine" to it, but neither gloss or specular seam to do anything. I think it has something to do with the refraction as once I sent refraction intensity to 0 it's ok. Any ideas how to go about fixing this? Attached is my current shader progress.
     

    Attached Files:

  23. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    I tried running it, but it seems to work fine for me, with reflections and all. Are you sure your scene and preview is set up correctly? Lights are on etc?
     
  24. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    645
    It's just specular that won't seam to do anything. I'm using DX11, Deferred Lighting, Linear Color Space, and 1 light next to it. I've tried upping the specular a ton, adding a slider to it, adding a color to it. Changing it just doesn't seam to do anything. If I set the refraction intensity to 0 then it works.
     
  25. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    I've found a pretty critical showstopping bug. on ANY shader I make none of my properties show up and the shader is bright pink, even with just a diffuse slot. This ShaderForge is a clean install.
     
  26. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    840
    In my prototype space I was able to get a custom ibl shader going ;) Thanks!
    $wip8.jpg
     

    Attached Files:

  27. DSebJ

    DSebJ

    Joined:
    Mar 30, 2013
    Posts:
    101
    Known issue. Has been fixed and will be released in the next version.

    For the time being a workaround I found was to setup a property that's needed for evaluating the defuse, compile the shader. Those properties seem to show up in the properties window most I the time. You should then be able to safely break the link and use it where you actually want.
     
  28. DSebJ

    DSebJ

    Joined:
    Mar 30, 2013
    Posts:
    101
    That looks awesome! Looking forward to seeing what comes from you now that you've got Shader Forge :)
     
  29. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Deferred is the culprit, I believe. SF doesn't make deferred passes at the moment, which means some shaders can't be rendered properly. Transparency and DX11 tessellation being the two known cases where things break so far. Switch to forward and it should work :)

    Like DSebJ said, it's a known issue, but has been fixed in 0.18, which is now in Unity's hands waiting to be approved!

    Very nice one!
     
  30. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    Is there a way to recreate this shader in ShaderForge...
    The shader has the road mesh plain appear flush with the terrain, but without z-fighting. What I have managed to get is a road shader where the further to the camer view it is the higher up the road becomes, The 2 main problems I have are the roads appear to be 'above' the terrain, even if it's just by a tiny bit, the other issue is anything on the road such as players feet or dropped weapons 'sink' into the road some. If i push the road down any more than it is right now t z-fights
     
  31. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    I completely forgot the offset values! (Offset -0.5, -275)
    I'll implement this in Beta 0.19. Could you request it on the feedback page? :)
     
  32. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    What do you mean by the offset values?
     
  33. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
  34. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    Ah awesome, yeh if you could add that it'd be much appreciated! :)
     
  35. Dimage1989

    Dimage1989

    Joined:
    Jan 30, 2013
    Posts:
    1
    Refraction tutorial will be?
     
  36. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,502
    Amazing asset! I'm curious about the deferred lighting...specifically transparency (your vegetation shader to be exact). As you mentioned, this has issues in deferred mode. Is this simply not possible, or a feature that is still in the works?

    Thanks!
     
  37. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Possibly! Although there is a refraction shader included in the example assets :)

    Thanks!
    SF doesn't render deferred passes, so all shaders created in SF are rendered in forward rendering, regardless of your render pipe setting.

    So, what basically breaks (from what I can see so far): Alpha blending, alpha clipping and Tessellation.
    It is planned, but it might take a while to get it sorted out, because deferred works in completely different ways!
     
  38. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    645
    I'm not sure that's the issue. Transparency seams to be working fine. Everything is except Specular. I even changed to forward rendering (which I can't as my game doesn't look good with it) and there's still no Specular. I wonder if this is just an issue with the Normal being generated by my texture.
     
  39. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    You might need to normalize your normal direction before it goes into the normal input of the main node
     
  40. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    686
    Really love SF so far! It needs a lot of convinient features for managing big graphs(collapsable compounds, node instances, labeled fields, wire routing points, etc.) but since its still a beta i am sure the future will bring some of these. The functionality is already outstanding :D Like already mentioned i also hope that we can author shaders that work in deferred mode at some point.

    I would be interested to learn more about the PBL and especially about what could eventually break the energy conservation. Does the energy conservation happen in the main node and everything we plug into it will be automatically handled correctly or do we need to take care about some things? Another question i have is, what is the best way to get custom fresnel curves for reflectivity:

    $fihms.jpg

    my idea is to have a second fresnel node inverted and added on top of the first fresnel node before multiplying it onto the specular color/map. Is that a good way to do it or are there better ways?

    However, love the tool and already made a neat PB IBL multi purpose shader in no time:

    $PBL.jpg
     
  41. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    The fresnel node is not very related to the fresnel term in PBL rendering. They both have to do with intensity based on view dir and normal dir, but they work in fundamentally different ways.
    The fresnel reflectance is currently the specular input, more or less, but it is using an approximation (Shlick's approximation) that's a lot faster, but looks pretty much the same.

    The method you described could work! It probably won't be physically based or energy conserving anymore, but, personally, I'd rather go for artistic flexibility rather than realism, if the project allows ;)

    Energy conservation is based on lighting, so the inputs that are currently take energy conservation into consideration are:
    Diffuse, Specular, Gloss, Light Wrapping, and Transmission, as transmission is essentially a flipped diffuse.

    As for node management; nested nodes are planned, as well as zooming in the editor, which should make it much easier to navigate and organize :)


    Also, very nice shader!
     
  42. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    645
    Ok, Once I set Normal Quality to Normalized then set it to Forward Rendering the specular worked. So does look like once you add Deferred Rendering support it should work as expected.
     
  43. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    2,786
    Just after I requested nested nodes yesterday? Clearly this is all my doing.
     
  44. Justei

    Justei

    Joined:
    Aug 31, 2012
    Posts:
    133
    I have to say this tool is one of the best and most helpful tools I have every bought. Worth every penny it cost :).

    I can't wait to see where this goes.
    I'd also love to see more tutorials :) I'm not very experienced in shaders, and even though I can make some of the stuff I needed. Tutorials are always welcome as I'm very hungry for more information and to get more skilled at this :D!
     
  45. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Thanks Justei!
    More tutorials are planned, just need to find the time for it :)

    What sort of tutorials would you like to see?
     
  46. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,502
    Personally, my main concern was the vegetation shader, which has issues for me in deferred. A double sided vegetation shader which properly handles lighting and shadows is huge for me. Heck, I probably would have paid $50 just to have THAT.
     
  47. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    I would pay $50 for that too, deferred has a *very* different lighting pipeline! That said, it should work just fine in forward rendering!
    Deferred is planned to be implemented down the line anyhow :)
     
  48. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    I've found a... well I wouldn't call it a bug but it's definately different. I put 'shadows' on to be cast from a local spotlight as I was testing something with differed rendering, anyway I turned it back to forward rendering and came out of Unity and completely forgot about it.

    A few days later I am wondering why my light source is still casting shadows on meshes with shaders that I've made in ShaderForge, I double checked and it's definately set to forward rendering. It appears shaders made with ShaderForge are either magic or something strange is happening, the shadows seem to work perfectly without any artefacts.
     
  49. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,226
    Yeah, I've enabled shadow casting for all light types, including point lights :)
    (Whoops!)
     
    Last edited: Jan 12, 2014
  50. NA-RA-KU

    NA-RA-KU

    Joined:
    May 5, 2013
    Posts:
    869
    Can anyone point me to resources for shader theory that do not go into great technical detail, so I am better able to understand how to create the effects I'm looking for without blind experimentation?

    I'd love to know what all of these words mean, and how to combine these things together without having to know GLSL.