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. Em-de-Nem

    Em-de-Nem

    Joined:
    Mar 19, 2013
    Posts:
    104
    Hi All,

    I would like to ask for some help as it seems that SF works differently that other node-based stuff I used before.
    I would like to solve these things:

    1. A texture over another (imagine a logo on a wall), where I should be able to change the strength of the logo (no alpha used) and to be able to change the color of the logo (imagine a big 'A' letter as a texture).

    I could make it, but with using 'Blend' results that only darker colors could be seen on the wall, so a wall colored black and a logo colored to white does not work. Using 'Overlay' mode changes the background image (wall), too.

    2. Changing Saturation/Brightness/Contrast with a slider like PS does it.

    3. How do I change the strength of a normal map?

    Thanks
     
    Last edited: Nov 23, 2015
  2. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    @Em de Nem i think you should use alpha, so you can mix the wall texture and the "A" texture depending on the alpha of the texture, or even you can put an additional image and use it as a reference(splitting the channels), so the channel red maybe can be the wall and green can be the "decal" on the wall, also you can put 2 more decals with the blue and alpha channel, or just make it simple, with an alpha, black will be the wall, and white will be the letter, for this method you dont even need a blend node.

    For changing the intensity of a normal map you can lerp between your normal texture and a vector3 value of this color #a671ff which is close to a regular normal map background.
     
    Em-de-Nem likes this.
  3. Em-de-Nem

    Em-de-Nem

    Joined:
    Mar 19, 2013
    Posts:
    104
    Hello Deadlycrow,

    Thanks. I tested the normal strength, unfortunately it does not work properly.
    For the logo/wall problem; I will take a look on texture splatting.

    To be honest, I really miss basic tutorials for SF, it is a PITA to guess how things should be done.
    I hope the author will show up and gives some help, also will release some tutorials as it was promised a year ago or more.
     
  4. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hi Em de Nem,

    there is a plethora of guides and help pages available in the Shader Forge wiki:
    http://acegikmo.com/shaderforge/wiki/index.php?title=Shader_Forge_Wiki

    Also there now is a Forum dedicated to SF questions:
    http://neatcorporation.com/forums/

    Next there are already some more indepth tutorials on YouTube:
    https://www.youtube.com/user/Acegikm0/Videos

    The 3-part series about gradients is really nice. Also the custom lighting model tutorial is quite useful to understand more about shaders in general.

    Granted, some more Video tutorials would be great. But SF doesn't differ that much from the Unreal material Editor. So any tutorials made for it can apply to SF (modified of course to fit the Needs of SF and Unity).

    Regarding your text over a wall problem:
    The lerp node should be your answer. As an example you might stick your "writing on the wall" in the Alpha channel of your Albedo/diffuse texture.
    Multiply that Alpha Output by a 0-1 slider to get another layer of control over the intensity.
    Plug that result into the T of your lerp.
    Multiply the Alpha Output by a Color to get colored text.
    Plug that result into the middle of your lerp node's Inputs.
    Plug the RGB values of your texture into the topmost lerp Input.
    Plug the Output of your lerp into the diffuse/basecolor/Emission of your main node.

    Regarding your normal map strength:
    Send the RGB values of your normal map through a component mask that Outputs R and G only.
    Multiply that by a value property.
    Now plug the Output into an Append node. Connect the B Output of your normal map into the Append node as well.
    Normalize.
    Plug that new normal into the normal Input of your main node.
     
    DMeville likes this.
  5. Em-de-Nem

    Em-de-Nem

    Joined:
    Mar 19, 2013
    Posts:
    104
    Hello Marco,

    Thanks.

    Surprisingly I'm interested in tutorials what are covering my needs, so I don't really care about nice tutorials on gradients while I'm dealing with something else (but thanks anyway, I already found the YouTube channel, the wiki page, etc.) ;)

    'Granted, some more Video tutorials would be great.'

    Look, here it is how I see.
    The questions I asked are in the 'basic' category. To avoid spending time of the developers - if I was them - I would do this (so no questions like mine would come up ):

    Remake all the the Unity default shaders in SF with all the whistles in bells.
    That would cover all the basic needs, all the basic - and ideal - workflows ('cause making something to work is not enough, making it optimally work is the key).
    Then users could have all the specific tutorials.

    Related to the logo/wall problem.
    I solved it finally without alpha (there was some special needs), with using 'splatmap'. So it seems to be ok for now.

    The normal task:
    That was pretty helpful. It does not work as it works in Unreal if I remember correctly, also I have to say that it should be in the 'Basic shader' tutorial of the SF as no way to guess it by yourself without coder vein.

    I was not able to connect the 'Normalize' node to th Normal slot, but it seems to work. Are you sure it should be connectable?

    Thanks anyway
     
  6. Em-de-Nem

    Em-de-Nem

    Joined:
    Mar 19, 2013
    Posts:
    104
    Yep, the normal map does not work properly if 'Normal blending' node is used. Any idea? Thanks!

    EDIT: it smelled like a bug; after restart even 'Normalize' node worked.
     
    Last edited: Nov 23, 2015
  7. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Glad it is working for you.

    Catering to everybody's needs is - apart from nearly impossible - quite time consuming and probably not in the best interest of the majority of users or in the scope of a product with this price tag. Teaching basics of shader programming (in code or with nodes doesn't really matter) feels like a waste of ressources to me that should probably be better spent on enhancing this product. There are plenty of tutorials about shaders out there already.
    There are some parts of the software that could get some love tutorial-wise especially the left hand panel with all it's foldouts and options, however. Recreating every Unity-Shader in SF is somewhat redundant - SF was made to quickly create shaders that don't ship with Unity by artists.

    This is my personal opinion, though and the author's view might differ from it. Happy shading, Em de Nem!
     
    Last edited: Nov 23, 2015
    DMeville likes this.
  8. Em-de-Nem

    Em-de-Nem

    Joined:
    Mar 19, 2013
    Posts:
    104
    'Catering to everybody's needs is - apart from nearly impossible - quite time consuming and probably not in the best interest of the majority of users or in the scope of a product with this price tag.'

    Maybe that is why I suggested to make tutorials on basic functions;)
    Actually SF tutorials are like starting driving lessons with drifting.

    'Catering to everybody's needs is - apart from nearly impossible - quite time consuming and probably not in the best interest of the majority of users or in the scope of a product with this price tag.'

    Technically the price tag itself means nothing - basic economy. What matters how much do you sell from a product with the actual pricetag and what are your expenses.
    Related to the sales of the SF I'm pretty much sure that the developer(s) could pay someone to make tutorials to cover the basic functions.

    'Teaching basics of shader programming (in code or with nodes doesn't really matter) feels like a waste of ressources to me that should probably be better spent on enhancing this product. There are plenty of tutorials about shaders out there already.'

    Yep, but the author made tutorials, what was waste of time, too, according your argument.
    What I asked for to cover the basics, too. How much time does it need? A week of work?
    Also, please consider with this logic of yours there is no need of any tutorials of a product what has competitors; 3ds Max, Blender, MODO are all the same, so use MODO tutors for Max. Well, it will not work.;)

    'Recreating every Unity-Shader in SF is somewhat redundant - SF was made to quickly create shaders that don't ship with SF by artists.

    It is especially not redundant; it is the explanation (best way of learning) what happens under the hood of an advanced shader with many tweaking possibilities.

    'This is my personal opinion, though and the author's view might differ from it. Happy shading, Em de Nem!'

    Anyway, thanks for the tips; I made it work finally.
     
  9. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Seems the PBL functionality is broken in 5.3f2, is this a known issue? I know 5.3f2 only came out today, but I havn't tested in 5.3f1 to see if is broken there too. So might be a new issue or it might be that Shaderforge just doesn't work with 5.3 yet?

    Is there some sort of beta version we can try download with 5.3 fixes?
     
  10. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    heey @Acegikmo
    I have a bug in shader forge...
    Whenever I am using tessellation and setting the amount to ZERO for far away, then all mesh just disappears where amount is zero. If I change the number to 0.001 then the mesh becomes visible.
    Best thing is that the tessellation will be disabled for all areas where amount is ZERO.
    Is that possible? That way, I don't have to build a second shader without tess. for far away scenes.
    RT
     
  11. Em-de-Nem

    Em-de-Nem

    Joined:
    Mar 19, 2013
    Posts:
    104
    Hello again, new question, I hope someone could help.

    I for saving texture memory I use an RGB image where all the channels stores a separate pattern.
    Is it possible to scale the tiling of the channels separately?

    Thanks
     
  12. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Yes. Use the Texture Asset node and connect it three times to three individual Texture2D nodes.
    Feed three UVCoord nodes with three different tiling settings into the three Texture2D nodes.

    This way you are sampling your texture three times and can choose whatever channel you need afterwards.
     
    Em-de-Nem likes this.
  13. Em-de-Nem

    Em-de-Nem

    Joined:
    Mar 19, 2013
    Posts:
    104
    Thanks, I will take a look on it tonight.
     
  14. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    Any input about my question? please :)
     
  15. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    For a spherical force field this could be done in a simpler way.
    I wouldn't use the depth blend node. Passing in the Point of contact in worldspace to the shader should suffice.
    Inside the shader you could subtract the object Position from that ws PoC effectively creating a direction vector. Dot that direction vector against the sphere normal to create a mask.
    This mask can now be used to display your forcefield.

    There's one drawback - multiple PoC when several collisions occur.
    You could render additional spheres - one for each PoC. Resulting in lots of overdraw and probably White-out-effects if you are going for additive blending.
    Or you could limit the amount of PoC processed by your shader to say 4 which requires you to construct your shader in a way that it evaluates 4 datasets (PoC and time of Impact for instance).
     
    Ga2Z likes this.
  16. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    Hi, thanks!!

    Altough, I'm not going for collision with objects or contact points (as they were bullets) but for full objects intersection. I've got something working with depth blend node but I can't find a way to make the intersection effect bigger along the sphere without incrementing the depth blend distance creating unwanted visuals.

    But still I'm going to try what you told me, as I also wanted to make something like a bubble you can touch and reacts a little on the point of contact. Thanks :D!
     
  17. BigLouis1971

    BigLouis1971

    Joined:
    Mar 26, 2014
    Posts:
    107
    Guys I'm a new Unity user who bought this asset a while back, but I didn't had the chance to test it till now. Finally I have some time to build stuff with it and I'm building a test level using Probuilder Basic and some free substances from the asset store. I have this arch that is intended to be used as a round sidewalk corner and I have the geometry with the appropriate size, but when I try to texture it, it don't texture seamlessly as it is supposed to. I'm posting a pic so you can see what I'm talking about:


    What I think happened is that each face is textured individually and are not being matched. I posted a question in the Probuilder forums and I got my answer, but since I'm a newbie I don't know exactly how to fix it. According to the answer they gave me I just need to modify the shader to map UV coords to the vertex position instead of actually reading the texture channel. I have no idea about how to do that and I was hoping to find the answer here. Or maybe somebody can post a whole new shader that fixes the problem. Thanks in advance for your answers and such great a asset.
     
  18. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    A triplanar shader might help you.
    Please go to the new Shader Forge forums and have a look at the questions and guides section. There is a guide about triplanar mapping.
    Also on the Shader Forge wiki.
     
  19. BigLouis1971

    BigLouis1971

    Joined:
    Mar 26, 2014
    Posts:
    107
    Thanks for the quick answer. I found an example, but it has no normal map hooked to it. How can I build one with normal map, height map and specular map?
     
  20. dblincoeii

    dblincoeii

    Joined:
    Mar 4, 2015
    Posts:
    19
    Sorry for the delay but THANKS!
     
  21. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    heey, I would like to have some insights...
    Stepheight vs lerp...
    According to the docs, the stepheight node is optmized because it either renders pixel nr 1 or nr 2, not both.
    How is lerp doing this? What if the value is completly 1 or zero. Does it stil render both inputs? A and B? Even if B is not visible?
     
  22. Morfeuskiev

    Morfeuskiev

    Joined:
    Oct 10, 2013
    Posts:
    122
    @Acegikmo

    Hi. I Update Shader forge to version 1.25 and i can not open all of my shader create in 1.23. Why?

    P.S. I reinstall package. At now all works normally. Sorry.
     
    Last edited: Nov 26, 2015
  23. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    You see, there is a topic covering normal mapped triplanar shaders on the SF Forums at http://neatcorporation.com/forums/viewtopic.php?f=4&t=8
    But it is a lot to ask for fully featured shader graphs. I hope you understand that almost nobody is willing to spend time on your request if you don't show a little effort of your own.
     
  24. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

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

    I'm trying to create a shader for our terrain (floating mesh islands) that will be used in our cartoon themed game. I am trying to get a result such as this :



    We are really looking for sharp contrast between textures (potentially even a boarder texture to separate say grass from rock). We have a maximum of 4 textures to be used at anytime on an island (Grass, Rock, Path, Water). My artist is thinking that the best way achieve this is through vertex painting. So far it was easy enough to create a simple shader to apply the correct texture to the painted verticies but before I continue I want to make sure this is the best way to do this and what is all involved if we go down this road?

    Is vertex painting the best way to achieve this? How does the transition work between textures (Mask? Some kind of Boarder texture?) Should we split the mesh into multiple materials or would a single shader work better? anything else we should know?

    Any help is greatly appreciated as this is my first shader,
    Thanks in advance!
     
    Last edited: Nov 27, 2015
  25. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    You basically want to create a channel-blending shader!
    Make a channel blend node, plug in the vertex color into the mask input, then plug your textures into the rest of the input slots, in whatever order you like, and you're set :)
    You can then of course tweak it however you like, to get the effect you want. For example, if you want the transition to be sharp rather than smooth, you can likely just round the vertex color node, or use smoothstep, before plugging it into the channel blend mask input.
     
  26. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    974
    Is node nesting implemented yet?
     
  27. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Thanks for the quick reply Ace, BTW great product you have here :)

    Is it possible to get a defined pattern between the grass and rock? Say a jagged line?
     
  28. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Is there a way to get the From Origin outline value? Basically I want to lerp a color by how far from origin each vertex is. I've been fiddling with Object Pos node which I subtract from World Pos and then transform to local but can't get a value that doesn't end up uniform for the whole mesh.
     
  29. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Nope
     
  30. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Yep! Just mask out the channel you want to apply the mask too, blend a texture into it using the Blend node if you want lots of control, and then reappend it to the combined mask, then plug it into the channel blend node again.

    World - object should work. I could be that is's very large, making it white all over. Multiply it by a slider, and drag the slider to see if the value changes.
     
  31. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Works like a charm! Here is what i've got going right now..
    upload_2015-11-29_12-20-4.png

    Is it possible to rotate the mask to align with the transition?

    Cheers,
    Colton
     
  32. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    That would be very tricky, just make a tiling pattern that could mask it in every direction instead!
     
  33. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Hey Ace. I know this is kinda tricky but is there a way to blur the scene color node somehow ?
     
  34. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Well I kinda used a workaround but the blur is not perfect. Here is a honey or goo shader :)

     
    pottering likes this.
  35. w00523

    w00523

    Joined:
    Nov 19, 2015
    Posts:
    8
    @Eideren
    Who can tell me how to connect the nodes, you can send me this node map thank you?

    upload_2015-12-1_1-52-7.png upload_2015-12-1_1-52-28.png
     
  36. w00523

    w00523

    Joined:
    Nov 19, 2015
    Posts:
    8
    @Obsurveyor
    : hello, can you tell me the effect how, can look at it to node figure, thank you
     
  37. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Maybe something like this: sf_worlddissolve_1212015.png
    And for the glowy bits along the edges refer to this tutorial:
     
  38. w00523

    w00523

    Joined:
    Nov 19, 2015
    Posts:
    8

    Thank you very much


    Again, please How to make control abreaction edge color
     
    Last edited: Dec 1, 2015
  39. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Hello everyone,

    I'm currently running into a curious problem with ShaderForge V1.25. The shader I try to realize should re-ink regions of a mesh dependent on specific grayscale colors in a texture.

    The problem is that the shader forge multiply node which shows the end result, shows the correct result but the shader preview (and in Unity editor) it's wrong.

    I've attached 2 images and the resulting shader.

    Has anyone encountered a similar bug?

    Also, what does the Direct3D 9 underneath the shader preview mean? We're setup for DX11...

    Thanks for your help.
     

    Attached Files:

  40. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    I investigated this a little bit further (because there was also a discrepancy in limit checking).

    Actually, the ink map is "darkened" somehow. The original image has a clear band in the middle which is of color 192, 192, 192. But when taking a screenshot of the Texture2D containing this image, the clear band has a color of 134, 134, 134...

    This leads to problems when I try to set my filter values to 0.33 (which is 84)...

    Does anyone know where this darkening is coming from?
     

    Attached Files:

  41. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    how can i make water caustic with shader forge ._. ?
     
  42. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    hi,
    is it possible to create a triplanar shader by just sampling one texture instead of three? I was thinking to lerp / mix UVs but this getting heavy distortion around the edges. There is no need for me to overlap the textures, but reducing the UV distortion would be great!
     
  43. w00523

    w00523

    Joined:
    Nov 19, 2015
    Posts:
    8
    How to make control abreaction edge color
     
  44. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Yes
    You can use one Texture Input connected to 3 (or any amount) or Texture2D nodes, each with their own UVs which you would set up like a normal triplanar shader.
    For lerping them together you can use the normals (even convert local/object to world so they rotate with the object) and blend them together with the channel blend option.


    wat

    you mean 'chromattic abberation'?
     
  45. Panerox

    Panerox

    Joined:
    Apr 27, 2010
    Posts:
    15
    compile error occurs in Unity 5.3
    upload_2015-12-2_14-7-11.png
     
    Tonks likes this.
  46. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    Thnx, but this would require me to setup everything twice aka tripple times right? What i mean is, is it possible to really just use one texture? I have already setup a triplanar flow, but my shader becomes insanly slow and i need to fix everything twice now. ( i skipped the Y component) hope this makes sense.:)
     
    Last edited: Dec 2, 2015
  47. Chng

    Chng

    Joined:
    Feb 11, 2015
    Posts:
    4
    Just wondering, I'm really new to shaders in general ,and never touch UE's shaders, just wondering if theres any beginner tutorial that explains the logic behind setting up the nodes? I know there are some from the site, but they are really vague, and doesn't explain the logic on how to go about arranging the nodes.

    Should I try learning UE's node editor? does it translate well with Shader Forge? ( i recall SF was kinda bases off of UE's node editor). Any advise on where to start learning the fundamentals for this would be appreciated C:
     
  48. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    I'm doing something similar, what's your method? Are you multi-sampling the scene color by shifting UVs? I'm using CommandBuffers to deal with the blur.
     
  49. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Exactly. It samples the scene color node 16 times with slightly shifted UVs, 4 in each direction. I also added a panner node to the UV with a noise texture to scatter each sample, otherwise the sampled layers become way too obvious when stacked on top of each other.
     
  50. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    heey, there is a new or old bug...
    sometimes in certain situations, absolute unknown to me, a seperate node branch structure doesn't seem to evaluate. II a huge shader network I have to search for the bottleneck and have to reconnect some random node to make the structure work again.