Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Shader Forge - A visual, node-based shader editor

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

  1. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,523
    Thanks for the response. When using the UV4 though I am only using the on UV node an only UV4. When selecting any other UV channel on the node it works fine. Just cannot select Uv3(UV4) on the node in DX9 mode. I can also remove all but one of the bending node trees and as long as I am using Uv3 it still gives the error. So seems to be something wrong with Shader Forge and UV4.

    I know I used to have this same problem a long time ago when using UV2 in Shader Forge. Was a simple AO on UV2 shader but had the same error. You fixed it pretty quick of course.
     
  2. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    You can try to duplicate the diffuse with parallax offsets and lerp them on top of each other using a fur mask. Although you won't get a bigger fluffier mesh, it's just a trick to make the surface look like its spikey.
     
  3. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
  4. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    This looks like an asset I'll need to buy any way both to actually use it and to also learn better how shaders work. I still have to ask: would this offer a (preferably easy :)) way to build a solution for my two problems:
    1. Having a plane that will prevent anything from being rendered behind it
    2. Having a plane that will prevent anything from being rendered in front of it

    For the first one I had a simple solution that worked in Unity 4, but not consistently anymore in Unity 5 (for some reason I'm totally clueless about). For the second one, I've got a half-way solution (through help I've received in this thread ) that does prevent the objects themselves from being rendered by clipping them, but doesn't clip the shadows (and also requires duplicates of all other shaders).

    If shader forge offers a way to do these two things in a somewhat easy way, I'll buy it in a heartbeat. And if it offers a way to do number 2 without having to do duplicates of all the other shaders, I'd be ecstatic! :)
     
  5. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Made some volumetric clouds.

     
    Gekigengar, KWaldt, Hazor and 4 others like this.
  6. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,523
    Wow! Did not think you could do volumetric shaders in Shader Forge.
     
  7. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    This is tricky, even with Shader Forge, though it may be partially possible. I'm not sure to be honest!
     
  8. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    Huh, now that's a letdown.:( I never thought it wouldn't be possible (especially after seeing what awesome things can in principle be done with shaders), I just thought it could be hard to find out how. But you as the author of an awesome looking shader tool saying only that "it may be be possible" makes it look like that I might need to do some kind of a compromise solution - unfortunately in terms of performance, visuals, content and simplicity of implementation, or if not all four, then at least in terms of two out of the four.

    Going more specific to my two problems, there still has to be a way to do the number 1: preventing rendering anything behind a plane? I mean that worked consistently in Unity 4 with a very simple shader, so why wouldn't it be possible to make it work consistently with Unity 5? o_O

    Regarding number 2: By using the clipping method in a surface shader (such as in the slicer example of the unity docs ) number 2 (and number 1 for that matter, just in a more complex way) can actually be almost done, it's just that it doesn't clip the shadows. So is it really so that there is no way to clip shadows the same way as one can clip the meshes? If so, one option that I could reluctantly consider, would be somehow switching off shadows for one camera (I guess there is a way to do that).

    Originally I actually thought that there would be a somewhat Stencil-shader style solution for doing number 2. Basically letting it render something and just have all other shaders be of lower priority and thus having their values discarded. No clipping or other complex trickery involved. Just choosing which pixels stick. But I guess this isn't possible even though lots of vertex-manipulating mechanics (which to me seem much more complex) are?

    Oh, and sorry for making this so off-topic. This thread is for the asset after all...
     
    Last edited: Dec 16, 2015
  9. oppaikir

    oppaikir

    Joined:
    Jun 17, 2015
    Posts:
    3
    Hi, I am a beginner for shader programming, and ShaderForge helps me a lot.
    I like this asset.

    When I read my *.shader file, I find a float4 value named 「_TimeEditor」
    I know 「_Time」 is the time value that Unity given, but where is the _TimeEditor and what does it do?

    thanks a lot.
     
  10. fercb17

    fercb17

    Joined:
    Dec 26, 2013
    Posts:
    13
    Guys i just bought mine, very ecited about shader forge. Is there a library with pre prepared shaders?

    Thank you
     
  11. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    There's a demo scene included with SF, that you can take a look at the shaders on objects in the editor, then open them up in shaderforge to see how they were done.
     
    fercb17 likes this.
  12. boromir6

    boromir6

    Joined:
    Feb 23, 2015
    Posts:
    21
    Hello all, I got shader forge a while ago, and I've been able to do a lot of neat stuff with it, but recently I've come across something that just doesn't make sense to me.

    I'm working on a simple vertex animation shader that should "ripple" across the surface to give it a distort-y look. And for the most part, it works exactly how I want it to. The only thing I don't understand is why the triangles are split the way they are. Even on completely smoothed meshes, the faces split. Isn't the intended behavior simply supposed to offset vertices? can anyone tell me what I'm doing wrong?





    Thanks for any advice
     
  13. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    494
    First thoughts are that the splits are occuring at the UV seams, or that the noise texture doesn't tile completely (you should be able to make a 3x3 grid seamlessly).

    Instead of pluggin in UV coords to the texture 2D, try feeding it (append) (world position x) and (world position z).

    If it fixes it, it's your UV splits. Otherwise, it's likely your noise texture.

    Also, maybe try turning backface culling off? Set it to double-sided, see if that works.
     
  14. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @MacMC Never done anything with the vertex offset. I know @Acegikmo briefly touches it in one of his video tutorials, might be something useful in there.

    @Jesus has some good ideas to try too!

    Have you tried the shader on any of the meshes that come with SF (or Unity)? Does this occur on all meshes, or just your custom meshes?
     
  15. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Thats quite weird. Normally I'd say the normal group on your model are split which is the usual cause of any mesh splitting when you move the vertices around, but the default sphere in SF is split as well. I honestly can't figure out what can be the cause of that.
     
  16. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    Hey, thanks!
    _TimeEditor is written by SF in order for the material to be able to animate while the game isn't running. It's a bit of a hack that has been around for a long time. There's probably a better way of solving it now.
     
  17. misterlee

    misterlee

    Joined:
    Sep 19, 2014
    Posts:
    54
    Shader Forge looks to be really amazing, and I'm sure I'll be able to do some cool stuff with it eventually but here is my first experience as a new user....

    Start new Unity project, download and install Shader Forge from the Asset store.

    First thing - 11 warnings in the console.
    "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)"

    Ok it seems to still work so I'll just ignore them for now...

    Open Shader Forge window...

    "Shader Forge is out of date! You are running 1.18, the latest is 1.26"

    But I just downloaded it 2 minutes ago...

    Back to the asset store to update.... Hit the Import button again....

    "Nothing to Import! All assets are already in your project"

    Hmm ok, maybe a restart.

    Restart Unity, open project, open Shader Forge window...

    "Shader Forge is out of date!"

    /sigh

    Delete the whole thing in case I did something wrong and start over.

    Repeat above. Get annoyed. Write post on Forum.

    It's not exactly a great first impression. Probably more on the side of the wonky asset store than the asset itself, but still, quite annoying. I guess I'll just carry on with the 'old' version and ignore those warnings for now.
     
  18. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    Sounds like you're using an old version of Unity. You need at least 5.3.0f4 for the latest version
     
  19. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    Hi all!

    I'm not sure if this is the right place to ask but I've been toying around with SF trying to get just the right shader that I want, and my entire experience can be summed up with the "I have no idea what I'm doing" dog pic.

    What I'm aiming for is much like most Toon shaders but more towards a "3d cartoon" feel if that makes sense.
    The JoJo Bizarre Adventure opening is probably the best example I can give (I've attached a couple of screenies)




    My question is if I should keep going with experimenting with SF (or at least what direction I should be going in/ any required reading I should look at first) or should I go head deep into cg tutorials first and then give it another crack?
     
  20. misterlee

    misterlee

    Joined:
    Sep 19, 2014
    Posts:
    54
    Thanks for the reply .
    According to 'Check for Updates' in the editor - "The Unity Editor is up to date. Currently installed version is 5.1.1f1"
    So I guess that isn't working properly either. It's one of those days....

    Anywho, that's not Shader Forge's fault so I'll go and try to fix my Unity version and hope that solves the other issues.


    UPDATE!
    So as not to spam this page too many posts about my troubles.... I've manually installed the latest Unity version and all the various errors/warnings I was getting with Shader Forge seem to have gone away now and it has also updated to the latest version too. Success! :D
     
    Last edited: Dec 17, 2015
  21. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I think it's quite doable with SF although you would have to sacrifice some of the 3D elements and use them as 2D for the sake of polygon count optimization. What you need is experimentation and time. I suggest you look at the examples of outline shaders and custom lighting. We had a project where we did everything in Mike Mignola style and it was quite close to what we wanted to achieve.

     
    fengshuifever likes this.
  22. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    Hi all,

    I am very new to shader and decide to learn SF to create my own shader. As I have limited knowledge about shader, I am not sure if what I want to achieve is possible in SF.

    The shader that I want to try to make is that it will create a hole to see what's behind the object. But the hole is in line with the direction of the camera pointing. For example if there is treasure hidden inside a house and this shader can make a transparent hole on outside wall of the house which I will have to orbit around to look for the treasure.

    I have gone as far as making a circular mask on the opacity clip, but I don't know how to reposition the mask. Where do I go from here?

    Sorry if I can't explain myself clear enough.
     

    Attached Files:

  23. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    Instead of the UV node and the remap node, use the screen position node instead, and set it to tiled instead of normalized
     
  24. boromir6

    boromir6

    Joined:
    Feb 23, 2015
    Posts:
    21
    Jesus you're a genius! Turns out it was the UV splits after all. Thanks a million.

    Thanks to @Cactus_on_Fire and @DMeville as well for the fast responses!
     
  25. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    @cactusonfire how do i get your brain, you should be selling the stuff you make or even better, giving them to me
     
  26. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    lol thanks :D You only need time and experimenting really. That cloud shader isn't even that optimized. Although it is completely transparent with only minor sorting artifacts when changing angles. It also got some distance based fake shading going on.
     
  27. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    That really works! thanks!
     
  28. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    Thanks for the quick as hell reply! :D
    I figured I might need to take another glance at the example scene to see if there's anything I've missed.
    I'm having a tough time trying to understand the effects of certain nodes but that'll pass with time!

    Any pearls of wisdom that you can pass down from what you've learned that I should be aware/look out for on my graphical quest? That would be super appreciated!
     
  29. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I suggest you start with custom lighting. You get the Light direction and normal node which opens a lot of doors for creativity. Blend them with flat textures and you'll get very interesting comicbook style shading. The hardest part is the outlines which is more tricky to make it the way you look, but with slightly costly solutions can achieve the more complex look you want.





     
    hopeful and fengshuifever like this.
  30. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    First off, can I just say how goddamn great your screens look. Holy crap!
    Secondly, (and I'm a bit reserved in asking this cause I'm gonna toy with it first but I'll ask anyway) would there be a way, obviously via passing through the tiled UV co-ords in my texture sheet, of getting the greater colour in a specific tile and using that to influence the lighting of that particular face?

    I'm gonna go back and mess with it cause I think I've got an idea of how to do it though!
    Thanks! :D
     
  31. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Thanks :) Although I didn't quite get the question.
     
  32. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    I just reread my post and even I went "that made no sense. What".

    Re-wording it a little, I've got a texture sheet for a room that's split into different squares for different textures.
    An object I have is a cabinet that uses only two squares in the texture sheet, a light wood colour for the body and a dark wood colour for the top and bottom of the cabinet.
    Right now it's taking a broad stroke and colouring the entire object in the light rather than the texture colour itself influencing the colour.
    Is there a way of basing the light/colour of that object based on the texture itself rather than a broad stroke?

    (Oh God I hope that's worded marginally better haha)
     
  33. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Maybe it's best if you post screenshots xD I'm having a hard time visualizing it.
     
  34. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15

    Hahaha Would you believe English is my first language? (it's been an odd day :p)
    Ok so the record shelf/cabinet here has the two colours I was talking about before.
    (also, pay no mind to the funky colours, just me tooling around with the shader)
    Using just the regular example it's obviously taking the ambient light and adding that colour over the texture

    So I tried just a quick switch of inputting the RGB values of the texture into the Add Node, replacing the Ambient Light node which makes this

    The colour obviously being a little dull.
    So I was thinking if there was a way of using the texture tile's colour itself to influence the light colour on a the object, bringing it at least a bit closer to the first example where the colours are more vibrant (I don't know if vibrant is the right word I want to use).
     
  35. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    you can use the Remap node to brighten, darken or crush the RGB values to get the tone you want. I usually conenct them to emmission rather than diffuse which takes out the shading and light dependancy. Try the remap node with [0,1] for the top values and [0,3] for the bottom ones.
     
    fengshuifever likes this.
  36. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    I want to do the same with SF, mind if can share the nodes out?
    Thanks
     
  37. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    Oh AWESOME man! I really appreciate the help, it's given me a bit of a kick in the right direction :D
    Thanks again!
     
  38. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    np :)
     
  39. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Hey Ace. I'm wondering if there is a way to use weight blended transparency where the value of the grayscale color or vertex color tells the order of which polygon to be rendered ?
     
    Last edited: Dec 19, 2015
  40. ArthurClark

    ArthurClark

    Joined:
    May 12, 2013
    Posts:
    15
    Hi! I need your ideas on how to solve my problem! In my game I need some objects to glow, while other objects of the same type - not. The unity native glow/bloom effects can't help me because they make all the objects glow in similar manner. That happens because the Bloom post effect works by enhancing a pixels that are brighter then some level. And since all of the objects have the same brightness - they all get themselves enhanced. Can I make a shader that separates one object from the other on post-processing? For example is there any way to make a map that describes which parts of render texture should be processed by shader and which parts should be ignored, and then passing this map to a post-processing shader? Can you suggest something on this problem? Thanks in advance?
     
  41. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    494
    Gonna assume you're using HDR and deferred.

    Instead of the 0-1 brightness range you may be used to in Unity4, HDR lets you go from 0-8 (ish, I think, or something).

    For that object, you can set the emissiveness to something beyond 1 (maybe try emissive = main texture + 0.5 (or a number you can change in the inspector, use a Value node here) in shader forge). Then on the camera you add another bloom post effect, maybe low quality, but set the minimum threshold to something like 0.8. That way you get your glowy object to bloom, plus any other bright things like the sun get a (second) bit of glow.

    Of course using HDR, and actually everything in Unity5 on PC now, you should be using a HDR-enabled camera, Linear lighting and a Tonemapping image effect, but do the tonemapping after the bloom. Tonemapping takes a 0-8 linear lit picture (which looks weird) and makes it appear like a nice, reasonably lit 0-1 image for your monitor.
     
  42. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Are the "Target renderers" settings not working?
    When I tick them in Shader Forge and click the Compile Shader button, close Shader Forge, then open up the shader again, they are all unticked, and it hasn't saved the settings.

    Is this a glitch or something?
     
  43. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    159
    can someone explain to me the very basics of how to do a volumetric fog in shader forge pleaseeee, i dont have a clue :(
     
  44. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    They come in many forms. What's your use-case?
     
  45. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    159
    i just want to create a very very simple water fog, a cube volume fog will be enough, and then add stuff by myself :), like gradient from shallow to deep water, etc. but my problem is that i dont understand the "volume" generation being independent of the faces of a "cube" mesh, i mean the normal of the faces and the culling so inside my cube there is "nothing" :( i dont know where to start
     
    Last edited: Dec 20, 2015
  46. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    These things are tricky, but if you just want a depth-fog effect, and your camera won't be inside of it, the depth blend node and this should help
     
  47. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    159
    that is the problem, i need to be underwater :( so thats why i want some basic volume fog
     
  48. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Well it's quite a cheap trick but you can stack up some quads in a grid like fashion and use a depth blend shader setup like so to fake volumetric local fog. Which is essentially how I made the clouds :)

     
    Baldinoboy likes this.
  49. mk1978

    mk1978

    Joined:
    Dec 27, 2009
    Posts:
    276
    I have bought Shader Forge already 1-2 years ago but I have not used it at all. Anyway, is there some easy/simple way to make a shader that would blend geometry with skybox? For example I have terrain where I would like to make the surroundings transparent/invisible so that player would see only the upper part of the terrain that is relevant. The idea has been to create a cylinder that would hide rest of the terrain and make that geometry to blend nicely with skybox. I would at least assume that this could be achieved quite easily with some kind of shader.

     
  50. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,523
    When enabling SSAO with my Shader Forge leaf shader I get this problem:



    Guessing there is a issue with the depth shader and the leaf shader. Shows a static version of the tree in blue.