Search Unity

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,294
    You can do it manually! The remap range node is just regular math in a simplified format :)
     
  2. Paulo-Henrique025

    Paulo-Henrique025

    Joined:
    Dec 12, 2010
    Posts:
    230
    I just wanted to say thanks for this, it is the greatest thing since 3.0.
     
  3. MarkBenitez

    MarkBenitez

    Joined:
    Oct 5, 2013
    Posts:
    44
    Just bought it but first thing i noticed is the vegitation shader looks like this right after loading the scene:
    http://gyazo.com/e2f6d5e3d4f809290a94fa82c7a168f6.mp4

    So then I go to Edit>Graphics Emulation>Shader Model 3 and then it looks like this:
    http://gyazo.com/da2791f6be8264e74e04ef83e4c294e4.mp4

    And then when i go to click on the light wrapping it crashes. Any idea why? Here are my PC specs:
    i7 4770k
    Msi z87-g45 Motherboard
    Gigabyte 4gb 770 OC
    16 gb 1866 gskill ram
     
    Last edited: Jan 18, 2014
  4. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Thanks! Glad you like it :)

    The crash sounds very strange, got any more details on that?

    The first issue if because you have deferred rendering on - switch to forward and it should work :)
     
  5. MarkBenitez

    MarkBenitez

    Joined:
    Oct 5, 2013
    Posts:
    44
    Thanks, changing to forward rendering did it. I absolutely love this tool.

    When will you be sending out the next tutorial?
     
  6. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I suspect the next tutorial will be on tuesday! I've planned to make something more advanced this time - what would you like to see?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I wouldn't say that the options are more limited, but that what you can do is different, or in some cases can be accomplished with a different technique.
    For instance, take a look at the tomb raider talk from GDC last year; they use custom shaders when drawing lights to make "fire" and "water" lights, which add these effects to the scene as part of the lighting stage. This is super powerful, because you don't need to have those effects as part of every shader which might need to look wet or be lit on fire. The same is true for things like reflections, which can be rendered like lights and allow you to avoid baking a cube map into every shader for a location specific reflection effect. This decoupling of the effects from the initial shader, made possible by information in the gBuffer, is a huge side benifit of deferred. That said, I believe Unity uses a thin gBuffer (light pre-pass renderer)? That certainly limits things as well.

    As for light position, color, etc - you won't be able to represent these for every light hitting a surface, but you can expose this information for the dominant directional light in the scene (sun).
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Almost all deferred renderers used forward as well, since alpha isn't easily covered by deferred approaches. As for light indexing/forward++/etc, from what I can tell the main issue with these systems is poor cache coherency. Given Unities need to run on a wide range of systems, I wouldn't expect them to venture into compute based rendering approaches any time soon.
     
  9. MarkBenitez

    MarkBenitez

    Joined:
    Oct 5, 2013
    Posts:
    44
    Is it posssbile to create a shader that can generate moss on random spots or controlled spots on the uv map or etc with a slider? like here have moss come out of the cracks
    $7d19474c9d7d790df90b4cd88c9b1703.png

    Also how can i set up a shader for using a displacement map like this:
    http://blenderartists.org/forum/attachment.php?attachmentid=283433&d=1389940162&thumb=1

    As for the tutorials some ideas I have are below:
    -One I listed above with moss
    - like seen in this video -->http://www.youtube.com/watch?v=3tHI2J9_c9k (Real-time spherical area lights along with rectangle and square ones) or from a imported model

    These below to me seems like it would be the most basic of all shaders but i dont know how to do it
    -Have a plane flash between colors (like this http://i690.photobucket.com/albums/vv268/mzdiamondprincessc/flasher.gif)
    -Have ONLY certain parts of a uv flash
     
    Last edited: Jan 19, 2014
  10. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    The main thing i want to know is, how would it be possible to do billboarding with vertex manipulation (especially ueseful if it would work on a combined mesh if thats even possible).
    I find manipulating the positions of vertices is pretty straight forward but rotating things is something i can wrap my head around!

    another interesting topic would be to make the outline of a mesh transparent and not having the inner parts affected(simple fresnel solution does not work in this case unfortunately).

    Thanks again for SF, but i am repeating myself ;)
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, but for that to be robust you need matrix operations; which are available in HLSL but will need to be added to shader forge (or a way to create your own nodes via HLSL or an HLSL node).

    To billboard sections of a combined mesh, you'll need to store a pivot position for each billboard (or mesh cluster). In the past, the way I've done this is to compute a pivot point for each billboard as an offset from the model's pivot and store it in the RGB channels of the vertices. I'm not sure if Unity does this, but many engines pack the RGBA vertex color into a single 32bit value, which only gives you 8 bits per channel to represent the pivot position. To deal with this, I scan through the model and compute all of the pivot offsets, then normalize them into a 0-1 range based on the maximum offset and write them into the RGB channels. Then, in the shader, I multiply by the maximum offset to reconstruct the pivot offsets so we can rotate the vertex around them. I think it works out to about 20 vertex shader operations, which is pretty fast.

    Another note; you still have that alpha channel open, since your only using the RGB channels as the XYZ values. I usually write a unique identifier for each billboard into this value. This lets you use it as a seed for other operations since it is a unique value for that entire billboard (though it truth, you could likely use the pivot for that as well, but that would take more operations). Anyway, examples of this; doing exploding meshes and having each shard rotate uniquely.

    BTW - shader forge really needs noise nodes (preferably 1d, 2d, 3d value noise, perlin, veroni, and simplex variations using either texture lookups or hashes). These are incredibly useful nodes, and I'd add these nodes myself, but there's no way to do that right now. :(
     
  12. RogDolos

    RogDolos

    Joined:
    Oct 16, 2012
    Posts:
    42
    Is there a way to get good character lighting, something like a half lambert or wrapped lambert, without resorting to using unlit / custom lighting? Something like this (which I currently have plugged into custom lighting, multiplied by a diffuse texture):

    $SF_wrapped_lambert_attempt.jpg

    It would be really nice to get clean consistent lighting onto characters, but still use specular and especially the IBL features. The example above of course cannot use specular without re-implementing it into the chain.
     
  13. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Thanks for all the tutorial suggestions!
    I'll probably do something with texture blending / terrain / vertex paint blends; which seems to be a popular request :)

    Why should that be done on a shader level rather than just using noise textures?

    Half-Lambert / Wrapped lambert is *exactly* what the light wrapping input is made for :)
    Set light wrapping to 1 for half-lambert shading, or any value between to make the effect a bit weaker
     
  14. donzen

    donzen

    Joined:
    Oct 24, 2009
    Posts:
    54
    I'd like to read a tutorial about triplanar mapping.
     
  15. TRIAX GAME STUDIOS

    TRIAX GAME STUDIOS

    Joined:
    Nov 27, 2013
    Posts:
    49
    HI THERE ! ... Cool to See you Daring Asking things like that Man xD ! But very Glad you Asked!
    Personaly I would like to see you Doing Terrain Shaders With SkyShop Terrain Meshblend Interaction.

    What i Have in mind is Something like This in the Shaders Setup:
    ... I think thats What i would call a REal Advanced Shader : ) And Something i reaaly would like to see !

    Thanks for asking ! You Rule !
    Regards

    TRISH DIAN // TRIAX GAME STUDIOS

    PS: Yes As you might assume After The mail i Sent you - I Tought twice and asked a Friend to lend me the money , i think the buy was worthy, I couldnt waith 8 months of Savings just for having this Asset LOL Im pretty happy And Scalling the walls ! But im still Waiting for More features as Zoom in Zoom out Export of Shaders nodes, Relief Shader mapping.. And if i Can think of SOmething else i will tell you : ) Best Regards Joachim.
     
    Last edited: Jan 19, 2014
  16. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hi Acegikmo,

    I think you could add a "basics" tutorial into the mix.
    Showing some simple vector math in SF. Like custom lighting via N dot L.
    Cubemap reflection.

    Later on (for the advanced tutorial) you might consider extending on the basic tutorial.
    Adding specular highlights, normal maps.
    Switch from cubemap reflection to planar reflection via rendertarget texture.

    This kind of stuff gets asked pretty often on the forums from what I see.

    Of course the vertex blending stuff is cool, too.
     
  17. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    Thank you so much for that great explanation, that cleared it up for me! Actually, it shows that i need the help of the shader programmer on our team :D I was hoping i could surprise him and come up with it on my own but this is a bit above my knowledge, though your explanation is very clear and i totally get the concept!
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There are many reasons this has a huge advantage over using a texture; if you use procedural noise to warp a UV input, it looks many times cleaner than using a texture because it's not being quantized to 8 bits (or as low as 4 if your using texture compression) per channel. You can also fully animate the parameters of the noise which is impossible with a texture. You can infinitely zoom into a noise function, because it has no native resolution, and noise functions do not have to tile. You can also generate noise of multiple dimensions which would be memory restrictive in textures (3d noise, etc). And in some cases, a procedural noise function can be faster than using a texture if you're bandwidth limited.
     
  19. Draxy

    Draxy

    Joined:
    Nov 16, 2012
    Posts:
    11
    I am very new to shaders, and this tool is great at visualising the processes so thank you.

    I have one request for a tutorial, a vertex shader that does wave ripples.
    I'm currently stuck with one wave and don't know where to go from there to get multiple ripples =]
     
  20. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    Hey there guys. Maybe somebody can give me a hint. I have this Damascus steel blade/knife here and I currently like the way my blade part looks. However, I am not so happy with the wooden part. The specular is too sharp and has a orange tint to it. I would like for it to look more like a clear coat. How would I go about that without using two shaders?

    Video: https://www.dropbox.com/s/vsf0atctiqaitwv/Knife_2.mov

    $Screen Shot 2014-01-19 at 8.56.16 PM.png
     

    Attached Files:

  21. TRIAX GAME STUDIOS

    TRIAX GAME STUDIOS

    Joined:
    Nov 27, 2013
    Posts:
    49
    HI THERE !

    HUM.... Ok So Here is a IDEA for you .

    STarts as this :

    - In your 3D modeler / like in max etc ... Setup 2 uvs for the knife.
    - - In first uv map you put the Uvs Layout as they are . With a Litle Extra Space for a Mask for the Wooden part
    - - Duplicate that Uv map to the Secound uv , and in that Secound uv Remove from the uv 1-0 Space all everything less the Wood part
    - - - In secound uv you can also scale the uv1 parts so they are not so litle that dont afect or put them aside just in the uv space

    - Bake Alpha 1 / bake alpha 2 - Overlap them .. So in 1 Alpha Texture you got Information of both Alpha of uv1 and uv2 in same space
    - - Inspite that uv1 Will just mask Part of the alpha / and uv2 Will just mask the other part .

    - - In Shaderforge use the Texture asset to Duplicate same texture, but Use Diferent Uv And : There you go 1 Alpha Chanel That can Work as if was 2 ...

    - - - IN Shaderforge you use the Uv2 to mask the Wood part Alone / and those properties not afect the other parts of the model
    - - - - This you can use in Whatever material properties you Want - in your case in to mask light Warpping and IBL And Specular ...

    If yo in troubles : You can Send-me always the Model And textures to TRIAXGAMESTUDIOS@GMAIL.COM If yoU Want-me to do it for you ...

    But im sure some other pros Will give you moar ideas : )

    GOOD LUCK ! Big beared guy ...

    PS: Dont delete my post / Seams Helpfull this time : ) *giggles*

    Cheers Dude ! Keep Cool and Fresh : )

    TRISH DIAN. / TRIAX GAME STUDIOS
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You need to create a mask to separate the wood from the blade; this can be done with a texture channel, or using the vertex colors. UDK has a
    well written tutorial on this here: http://udn.epicgames.com/Three/MaterialExamples.html

    Note that your shader will compute both values for each pixel, so packing lots of very different/complex shaders together using this technique can be costly.
     
  23. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Opened Shader Forge for the first time and saved a new shader, got this error.

     
  24. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Strange. Did you use any odd folder structure or so? Did anything else break, or did SF work otherwise?
     
  25. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Well, I did place my saved shader in a folder outside of Unity, wrong?
     
  26. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Outside of Unity? You need to have it in the asset folder, in the project where you have SF installed. (I should probably make this error more clear)
     
  27. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Yes, here is the error when the shader is saved in the project folder:

     
  28. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Does it work when placed in the asset folder?
     
  29. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Yes, it does seem to be working, will have to do some tutorials, thanks.
     
  30. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
  31. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    ok, thanks.
     
  32. hobstob

    hobstob

    Joined:
    Dec 18, 2013
    Posts:
    20
    Sometime soon are you going to do video tutorials on the uses of every nodes uses with in shader forge. The only real reason I've not bit the bullet and bought this asset is do to the lack of video tutorials.
     
  33. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    That would be a lot of videos, but it would be good :)
     
  34. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Possibly, but I will probably make more general shader related tutorials before going into nodes specifically!
    However, you can read about all the nodes here: http://acegikmo.com/shaderforge/nodes/
     
  35. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Another idea for videos tutorials : how to (re)make Unity Built In shaders with Shader Forge. :D
     
  36. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Any news on Skyshop compatibility?
     
  37. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    I think it should start from basic.

    Maybe explain what each options on the left side does... what works with DX 11.. the nodes...

    Everyone wants a complex shader, but for beginners, I think that they will only copy and not understand.

    If you explain it to them.. then they can track the other shaders tutorial.
     
  38. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
  39. joelfivat

    joelfivat

    Joined:
    Aug 14, 2013
    Posts:
    45
    Hello, I have a noob question :

    I need a flat lightening of my faces (faces have the same color), but I am not using the lights in the scene (I want light emitted from the camera). So I need to compute the angle between a face normal and the camera. The problem is the "View Direction" nodes outputs a pixel-camera vector which vary across the face when I need a constant face-camera one.

    Do I need to pass the view direction as a parameter to my shader, or is there another way ?
     
  40. hobstob

    hobstob

    Joined:
    Dec 18, 2013
    Posts:
    20
    I seen that page before.. There is good number of nodes on that page don't translate to a artist easily at all. This was a issue that people was having with the strumpy shader editor as well. The lack of video tutorials on how to use the product in its entirety and support going into great detail on how to tackle a shader and have it explained in a way for artist to understand... I do believe that if you had a ton of examples of shader tutorials, it would be easier to understand how to integrate into our own projects. I'm sure it would be a lot work to create these videos but I'm also sure it will increase the monetary value of you're product.
     
  41. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    You could use a separate specular texture to achieve the visual quality you're aiming for and plug that into the Specular input.
    No need to create a secondary UV set.
    RGB of the spec map would describe the specular highlight color. And the Alpha channel could be used to modulate the glossiness. Note that specularity and diffuse add up. So it is easy to overshoot the range of 0-1 thus getting only white highlights.
     
  42. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294


    Absolutely :)
    More videos are planned too, it's just that right now it's still a beta, which is why the documentation is a bit incomplete. It would be nice with a complete guide for all nodes at some point!
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    One thing to keep in mind is that if you really want to learn how to write shaders, you have to understand a fair bit of math. Luckily, most of this can be expressed in a visual way, and interactively, which makes it pretty easy to understand what a dot or cross product is, and basic vector math operations. (I spent a fair bit of time doing shader graph lessons over the last two years). That said, the biggest thing I saw constantly was people not realizing that it IS just math; in that there is no difference between a color and a vector; it's just a set of numbers which can be manipulated.
     
  44. TRIAX GAME STUDIOS

    TRIAX GAME STUDIOS

    Joined:
    Nov 27, 2013
    Posts:
    49
    ...
    HI ! JOACHIM !

    I have here a Feature but also Support request : ) Im sure many More Advanced Users Would like to know how ...

    As SHaderForge Shaders end up Having so many parameters Sometimes the Linear Aspect of them is Quite messy

    Im trying to do Nested Folders Of Parameters Inside Shader inspector : For that Seams its possible to do it with a Custom Inspector :

    http://docs.unity3d.com/Documentation/Components/SL-CustomMaterialEditors.html

    I noticed That you Use at the end of shaders the Custom Mat inspector trick WIch we can Amplify :

    Code (csharp):
    1.     FallBack "Diffuse"
    2.     CustomEditor "CustomMatInspector"
    3. }
    Can you Please Show us The Shader CustomMatInspector.cs Configuration for us to have Nested FoldOuts In parameters Like this :


    http://aras-p.info/blog/wp-content/uploads/2012/03/ShaderParams.png


    Sorry to ask ! But this WOuld Reaaly but reaaly Help Massively to Organize Shaders Parameters ...
    And i think is not that Dificult even for us to do it by hand with a CustomMatInspector.cs Configuration.

    Can you pleaase "For gods sake" please show us how and send us a Working Nested FoldOuts CustomMaterial.cs Example For us to work!

    THANK YOU DEEPLY SO MUCH !




    TRISH DIAN / TRIAX GAME STUDIOS
     
  45. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    As you are clearly a dA user why dont't you come onto the chats and discuss your thoughts on Unity, i can be found in #devart most hours and would be interested i hearing what you had to say
     
  46. TRIAX GAME STUDIOS

    TRIAX GAME STUDIOS

    Joined:
    Nov 27, 2013
    Posts:
    49
    THANKS LAZY : Would be a Honour ... I Love Deviantart. I growed up there As a artist since 12 years ago ...
    I got a idea Join up : http://soulsshine-unity.deviantart.com/ Wich is the Main "Communitary" JoinVentures Open Source "Universe" Project i work with ...
    Every members Can use the blogs and send its own journals to talks about Any whatever Subjects / expecialy About its Own Projects / ideas, And Making offs ...

    Invite is Extendable to All everyone !
    Kindest regards !

    TRISH.
     
  47. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I'll see you there then!
     
  48. joelfivat

    joelfivat

    Joined:
    Aug 14, 2013
    Posts:
    45
    Thanks a lot ! :)
     
  49. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I think that's the backwards dir though, you might want to do 0,0,-1 instead, depending on what you're going to use it for :)
     
  50. JoeW97

    JoeW97

    Joined:
    Nov 3, 2013
    Posts:
    56
    Should it be possible to store and use an alpha channel in a normal map? I thought it would be a good way to store an extra mask, but I get shader errors whenever I try to use it in a graph?