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. games_lam

    games_lam

    Joined:
    Nov 2, 2015
    Posts:
    8
    Any ideas?
     
  2. HAWK12HT

    HAWK12HT

    Joined:
    Nov 6, 2012
    Posts:
    26
    Depth blend not visible or flickers when plugged into opactiy. Anyideas why?
     
  3. Deleted User

    Deleted User

    Guest

    Ga2Z likes this.
  4. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    Really cool!!! but it'd be great to see it in action in a more complex container.
     
  5. Deleted User

    Deleted User

    Guest

    Complex like this? :D





    P.S = Yes I have created a Lenin container. :D
     
    Last edited by a moderator: May 1, 2016
  6. operator23

    operator23

    Joined:
    May 17, 2013
    Posts:
    14
    What is the best way to fix seams caused by vertex displacement? (currently using UV coord through height map)
     
  7. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    Loool, that would be cool :D
     
  8. Wintermute088

    Wintermute088

    Joined:
    Apr 29, 2016
    Posts:
    5
    Alright, this is a question for the more skillful out there, i've ran out of ideas about how to make this terrain shader work. Basically I need a shader that will work with unity terrain that blends at least 4 textures, with diffuse/spec&gloss/normal/parallax. Ive managed to get everything except parallax to work correctly... Does anyone have any clues to throw my way on how to achieve this. Here is what I have so far.
     

    Attached Files:

  9. Eideren

    Eideren

    Joined:
    Aug 20, 2013
    Posts:
    309
    IFL and hopeful like this.
  10. HAWK12HT

    HAWK12HT

    Joined:
    Nov 6, 2012
    Posts:
    26
    Hey all, Camera enabled depth in forward is causing flickering on mobile. I am making water shader.
    Also Ace if you can fix preview and scene shader difference that be great. Especially when using alpha blended or depth based nodes it dont sync with preview or in scene. Cheers.
     
  11. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I'll take a guess at this - I think it may be either:
    a) your UVs aren't lined up correctly (they need to be like a mesh, joined up at that point where they're coming apart. Not in UV 'islands')
    b) your displacement map needs to be polar co-ordinated/spherical. Check how the textures look for planet texture maps for what I mean.

    Hope that helped?
     
  12. Wintermute088

    Wintermute088

    Joined:
    Apr 29, 2016
    Posts:
    5
    @Cactus_on_Fire I've seen your work on here and it's pretty amazing, could I get your opinion on this? Do you think its even feasible at all? Do you think I can make this work with SF or should I start looking for alternatives. Thanks!
     
  13. marggob

    marggob

    Joined:
    Feb 24, 2013
    Posts:
    65
    Sometimes you need to create a custom Lightning, but Shader Forge no node that transmits information from the standard ReflekshenProbes. The problem is solved by three lines of code in the node "Code".

    Attention! This code is not supported boxprojecting. You will need to connect it yourself.
     
  14. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I think it should be doable. Default SF parallaxing is relatively cheaper to POM and other methods of relief mapping. Whats the issue with your parallax mapping ?
     
  15. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Improved the SSS shader a bit.

     
    Fab4, IFL and looki666 like this.
  16. Wintermute088

    Wintermute088

    Joined:
    Apr 29, 2016
    Posts:
    5
    With my current setup as soon as i plug in my parallax it completely removes the normal map. Instead of seeing normal + parallax I get no normal whatsoever and get an odd-looking parallax. Ill try and post a screenshot of whats happening.
     
  17. Wintermute088

    Wintermute088

    Joined:
    Apr 29, 2016
    Posts:
    5
    Alright so here's whats happening. Ive hooked up parallax on the grass texture only, you can see on both other textures on the side have normal correctly working but as soon as i plug in parallax this weird distortion happens. Any ideas? I've included my latest node tree.
     

    Attached Files:

  18. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    Hello, I have kind of a noob question but I can't get my head around on how to get the intersection of two objects. I've tried with a depth biased alpha approach but I don't really want to get the alpha on the intersection, instead I want to control the alpha differently and get a contour effect on the intersection and be able to control the thickness of this effect, like in this Overwatch shield example at the 17 minute mark (the sharing is not posting it in the right time mark):



    I don't post my graph because is really a mess and not that different to the depth bias example on the wiki.

    Thanks!
     
  19. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
  20. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    I created another shader using similar intersection math to what I used for this effect, but it's not working **at all**. I don't currently have time to look into it deeper, but you might check your code that gets generated. I actually can't get any of the depth buffer inside SF (except for the current object's depth, but I don't think that's from the buffer). It does some weird thing where it shows the depth map from the scene/game view in the SF preview window.
     
  21. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Any ideas on rendering back faces black without adding a whole pass just for it? That was the solution I found on google.
     
  22. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Geometry tab, Face Culling: Double Sided.
    Then, use the Face Sign node to mask front or back faces. So in your case, you could simply multiply the final color by the Face Sign ("1 and 0" setting on node) to make the backfaces black. It does it in one pass.
     
  23. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Following up on this issue, more weird behavior from depth stuff. If I set Face Culling to Double Sided, the Depth Blend node works... on the backfaces. It just doesn't work on the frontfaces. That said, the result from that node is almost identical to the shield effect in Overwatch (that game is wonderful). Depth Blend -> One Minus -> [Emission]. Maybe the answer to your question is more about plugging into the Emission output vs Alpha output more than the actual code problems that I'm experiencing.

    Does anyone have any idea what I might be doing wrong with the depth stuff? I tried using Alpha-blending and a slew of other combinations of settings, but maybe I missed something?

    [EDIT::] Completely unrelated, but has anyone searched for "snow" in the asset store recently? Is that an easter egg? Are there more?
     
    Last edited: May 12, 2016
  24. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    Hi, im working on a tree shader, but i dont know how to do the "billboard" when the tree is to far from the view :( help pls
     
  25. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    I'm not an expert on this. But I can tell you that it won't likely be just a shader to do this. You are going to need code to check distance to camera and swap the mesh and material out with the billboard. Just a single shader I'm not sure how to make it work.
     
  26. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    Hi, sorry for the late reply.

    This is the closest I could get to get that effect, but I was also trying to get another effect like the one in this post about Zelda's timeshift, unfortunately I don't understand a lot of shader coding and I can't get my head around the implementation on shader forge: http://flafla2.github.io/2014/12/09/zeldatimeshift.html

    He's implementing some kind of intersection but I'm not quite sure if is using the same method.

    Thanks for your help.

    [Off topic] I noticed some months ago the snow thing on the asset store, I guessed it was a left over from december hahaha
     

    Attached Files:

    IFL likes this.
  27. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    I have another question, im trying the unity cinematic beta effects, but when i create a PBL shader and put metallic and gloss to 1, i still can not see any screen space reflection on my object's material, how can i make it to work ????
     
  28. TheLordDave

    TheLordDave

    Joined:
    Mar 2, 2014
    Posts:
    28
    Any tips on how to access a light map? specifically the one generated by the SFSS asset?

    I have been beating my head against the wall with this, I have a shader I am happywith and just need to multiply the colors generated by the lightmap and shadows generated by SFSS.

    Any help would be appreciated as there doesnt seem to be any documentation about this.

    Thanks
     
  29. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    Hello,
    I'm wondering if anyone here, or the asset seller, can give a general comparison between the Unity standard shader and a shader created using shaderforge. I'm primarily interested in better handling and control of smoothness parameter. I'm just finding it very hard to get the smoothness value correct using the Unity standard shader.
    Using shaderforge, can you create a shader which gives you more control over how the smoothness/roughness is handled/Calculated. You can see I just created a question here regarding one issue I'm having.:
    http://forum.unity3d.com/threads/specular-dot-from-lights-when-smoothness-is-100.405242/
    The standard shader is just not quite cutting it for me any more now that I'm moving on to using reflections and such.

    Thank you.
     
  30. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Generally you won't find may things with 100% smoothness. Maybe a high quality telescope will be 99.9 or above, and a bathroom mirror might be 98 or MAYBE 99 for a very high quality one.

    That pic looks sorta like a tiled wall (I think). They're a bit tricky because it's then 2 layers for that sort of material; something Unity doesn't have a built-in solution for yet.
    Layer 1 - the tile. Ceramic, often either painted or porus...not particularly smooth or reflective.
    Layer 2 - the clearcoat/finish. Mostly transparent, but highly reflective and smooth.

    The only suggestions I have are to check that you never go above 99% smoothness, ideally keep it under 97%. The other thing is maybe try to edit the standard shader so the smoothness slider only goes from (instead of 0-100) 5-97 or something. That way you can't accidentally set an unrealistic value.
     
    ArachnidAnimal likes this.
  31. q7204k

    q7204k

    Joined:
    Dec 4, 2011
    Posts:
    15
    Good day everyone!
    I'm trying to create a simple snow shader with 2 main components:
    1. snow should cover object from the custom direction (done - right now it works with the light direction)
    2. vertex offset on snow pozitions (stuck here)

    I was trying to use output from "if" as a color/texture source for offset - but it doesn't work =(


    Edit: nevermind - I've found a solution)
     

    Attached Files:

    Last edited: May 19, 2016
  32. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    The problem is if I reduce the smoothness, even a little bit, then then the material doesn't receive enough of the reflection probe. So I cant find a good balance. I can increase the intensity of the reflection probe, but then it will affect other items in the scene.
    Can shader forge be used to create a solution for this? Can it be used for this two-layers you mentioned?
     
  33. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    What resolution is the reflection probe? Can you increase that from 128 or 256 to 512 or 1024 (at most) - it might help keep things sharper and more visible.
     
  34. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    How do I create a vertex color shader? I mean I want to make a height base recolor shader, using fragment is too expensive for ipod5 target.
     
  35. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Can you post in more detail exactly what you're trying to do?

    Vertex color is fairly easy; instead of textures in the shader you use the vertex color node. At least, I assume that's what you're talking about. But keep in mind Unity doesn't (by default, anyway, check the asset store maybe) have any vertex color tools to make adjustments to your models.
     
  36. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    I want to manipulate the vertex color base on a height value, essentially move that to vertex shader:
    blob:https%3A//drive.google.com/123f11fd-9e85-4853-9f42-f3d363999729
     
  37. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    Wait it's a depth node I'm asking everything wrong!

    The goal is to have a shader that produce a heat effects that swallow the scene as the lava move up. The problem is using a depth node on low end hardware mean it has huge overdraws because it need to interpolate a huge portion of the screen to get the effect.

    So instead of doing it with depth and fragment, I want to make it using a color ramp on vertex by recoloring them along the Y axis.

    Is that more clear?
     
  38. jammer42777

    jammer42777

    Joined:
    Apr 21, 2014
    Posts:
    116
    Hello
    I'm very new to shader creation (I've meddled with ue4 a bit but switched back to unity. I have taken a course on shader forge but never had a chance to use it. I haven't bought shader forge yet. I have used alloy. I am wondering... Do shaders made with shader forge work well with alloy? Would I still be able to make custom lighting paths with shader forge while using alloy in my project settings? Thank you for any help!

    --joshua
     
  39. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    This is a question better asked in the Alloy thread.
     
  40. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I was looking for an example to replicate Unity`s Standard Shader (Metallic and Specular) and I couldn`t find anywhere. Can somebody help me with a screenshot or a shader example how can I replicate them? I tried to replicate the metallic one but it doesn`t behave the same in similar lighting conditions. To be honest I wasn`t able to build any PBR shader.
    Thanks in advance. Really appreciate any help I can get.
     
  41. jammer42777

    jammer42777

    Joined:
    Apr 21, 2014
    Posts:
    116
    Will do Thank you!
     
  42. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hello,

    I'm trying to use the opacity input for a forward rendering, PBL, Metallic, Gloss, Fade, Multilight shader. And my rendering path in unity is deferred. I found no other options to use the opacity input.
    My problem is, that with maximal transparency (in opacity input) I still see the mesh, its transparent, but it is visible. How am I can achieve full transparency with opacity? I need a transparent/opaque ramp, so opacity clip is not for what I'am looking for.

    Thanks in advance for your help!
     
  43. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Windows 7
    Unity3D v.5.3.1.f1, Build for PC, Mac and Linux
    Shader Forge 1.25
    Steps:
    -New Project
    -Import Shader Forge: first error about some incorrect line numbers
    -Window/Shader Forge/New Shader/Lit (PBR): 2 red errors and a nice pink material (see picture below)

    Is it me? Or is it Shader Forge?

     
  44. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    I use 1.26 under Windows 7 with Unity 5.3.3f1. No such problems.
    - Probably because of the purpur color, drop shaderforge folder directly under the Asset folder.
    - Sometimes, very rarely shaderforge pruduce wrong code, just open the shader code and maybe you see an obvious mistake.
    - At last, update to 1.26
     
  45. foxnne

    foxnne

    Joined:
    Apr 18, 2016
    Posts:
    59
    Hey guys, I'm new to Shader Forge and shaders in general.

    I'm attempting to make a shader that would modify colors of sprites for a multiplayer 2D game. If possible, I want to sample from a supplied palette texture, and then recolor the sprite based on the selected palette. My art is split so that each piece of the character is its own sprite, with 3 colors per piece (hair, body, shirt, pants etc.)

    The palette texture is a grid of colors, and I can split it and get the colors of the "tiles" pretty easily.

    What I can't figure out is how to replace the colors of the current sprite with the colors of the palette completely without blending colors and losing accuracy from the palette. My attempt was to basically take the value of the sprites and increase contrast, append so black and white becomes green/red and then channel blend to apply the new colors, but sadly of course this is a blend.

    Does anyone have any info on how I could accomplish this? Is there a way to take a given sprite with 3 different values of color, and replace those colors with new colors (brightest, mid, darkest)?

    Edit: I ended up getting it to work pretty well by modifying my sprites beforehand to make darkest value pure blue, mid green, and lightest pure red, and then using Channel Blend. The issue here is that I'm still definitely limited to 3 colors. I tried using the IF node to rearrange colors but it seems that comparing a sprite to the color Red, the A=B output includes any part of it that has any red value.

    Anyone have any ideas for replacing sprite colors that isn't limited to the 3 colors?
     
    Last edited: May 25, 2016
  46. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    @mkgame - updating to 1.26 did the trick. Thanks for pointing me in the right direction. :)
     
  47. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    Hello,

    I have an issue with depth buffer ...
    My shader works on Unity 5.3.3 but not in Unity 5.3.4 ...

    It works when the camera has clear flags set to "Solid Color" but not when "Skybox" ...
    (for ref, the white quad is a Standard Fade material)

    upload_2016-6-1_17-10-8.png

    Any ideas ?

    Specs:
    Shader forge: v 1.26
    Forward rendering

    Thanks
     
  48. R3nD

    R3nD

    Joined:
    Jun 28, 2013
    Posts:
    2
    Hi everyone!
    I'm kind of a newbie in the whole shaders/Shader forge world, and I've been banging my head on something I don't get. I don't if it's me, or if it's a bug, but here it is (using version 1.26 on Unity 5.3.4 with Direct3D 11) :
    a basic unlit shader gives me some kind of permanent directional light (oriented towards 0,0,1) even if I don't have any lighting in my scene.



    But if I plug the light color in, this weird directional light disappears.




    I was assuming that even without multiplying by the light color, if there was no light in my scene, my model wouldn't get any illumination. What am I missing?

    Thanks in advance for your answers!
     
  49. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Skin shader I was working on. Somewhat similar to the pre-integrated skin shader asset but made in Shader Forge and customizeable. The falloff is smoother are more accurate. I used the infinite demo headscan release, which is a great model to test out the shaders

     
    FPires likes this.
  50. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    @Cactus_on_Fire
    Fun stuff you can approximate the tex2dLod node (blurred normal sample inside the normal mip map) with a simple multiply of the normal map with a fraction of thesurface normal (basically vector (0,0,1)*0.75) and normalizing the result