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

    afsanchez

    Joined:
    Aug 9, 2016
    Posts:
    1
    Hi everyone,

    I updated to Unity 5.5 recently and my shaders stopped working. I'm trying to download the latest version of Shader Forge, which shows as v1.32 on the Asset Store, but everytime I download it and open it, it seems to be version 1.30. I click the "download latest version" button, but it sends me back to the Asset Store and download again, but same thing happens, so I'm stuck on that loop. Did the guys from Shader Forge uploaded the wrong version???
     
  2. amasinton

    amasinton

    Joined:
    Aug 12, 2006
    Posts:
    137
    petey likes this.
  3. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    167
    How can I achieve an effect of proper shockwave like in the examples below?



    I tried to recreate shockwave effects using refraction and normal maps, but i get wrong results - http://prntscr.com/du1y4f and http://prntscr.com/du1ymr (nodes)

    So, i need distortion in all directions like in examples but not like refraction with normal map. It is possible to achieve this effect?

    Also tried it with panner node with only V coord - http://prntscr.com/du36mg (node tree), effect is close to what i looking for, but still wrong.
     
    Last edited: Jan 11, 2017
  4. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,082
    Is there a way to access Unity's packed UVs for lightmaps generated by enlighten?
     
  5. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    167
  6. P1st3ll1

    P1st3ll1

    Joined:
    Dec 13, 2012
    Posts:
    69
    Actually, when I enable the deferred mode in the shader settings, it disables all Outline options in the main node.
    I'm not good at all on writing my own shaders =/
     
  7. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    I think that's because the way the SF outline works is by running a second pass with a vertex modifier and such, and deferred needs a 'single pass' with set keywords (albedo, metal, roughness, etc).

    You might be able to hack this in manually. for the object you want outlined, set it to use an additional material. Keep Mat1 as the normal Standard shader (or whatever). In this "Mat2" you'll need to make a new shader, and change the vertex offset (one of the lower options in the output tree). Use a [slider] or something, multiplied by [normal direction], and plug that into vertex offset. Then set albedo, roughness, normal, etc as usual. In the shader settings options, under lighting or geometry or blending or something, change backface culling to frontface culling.

    Disclaimer, I haven't tried it, have no idea if this'll actually work, or if it'll spaz out with UnityDeferred, or whatever, but give it a go and hopefully it won't bork anything.
     
  8. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Maybe outline is a forward thing, like transparency. That shouldn't stop you from being able to use it with a deferred camera, I think. But the best thing is to do up a simple outline shader and test it, so you can see if / how it works.

    If you're looking for more options on outlining, a nifty new free asset popped up in the store today, and it looks like it even handles hard corners, like on a cube (a chronic problem with outliners). Here's a link.
     
    Last edited: Jan 13, 2017
    Martin_H likes this.
  9. LittleRainGames

    LittleRainGames

    Joined:
    Apr 7, 2016
    Posts:
    97
    Is shader forge capable of making Unity Terrain Shaders? If not where would I go about learning how to make terrain shaders. I do have shader forge, I don't think its possible but just want to clarify.

    Another thing I'm wondering, what kind of parallax mapping is it? Normal, steep/relief, parallax occlusion? If its normal does anyone know how to make it the latter kind?
     
    Last edited: Jan 14, 2017
  10. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    I have made a terrain shader, but it wasn't something that showed the best of Shader Forge. To be fair, that's more to do with how Unity handles terrain height, normals, binormals and tangents that any fault on SF's part.

    You should check the wiki for parallax mapping. I have seen more advanced versions online, and I think they're on the wiki, but a quick google should help you find out.
     
  11. Alex_4x

    Alex_4x

    Joined:
    Feb 2, 2014
    Posts:
    21
  12. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    167
    Your texture, probably in clamp mode, change it to repeat.
     
    Martin_H likes this.
  13. Alex_4x

    Alex_4x

    Joined:
    Feb 2, 2014
    Posts:
    21
    Big Thanks! It's work!


    How i can make UV coordinates like this:
     
  14. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    connect the multiply node to Frac
     
  15. Alex_4x

    Alex_4x

    Joined:
    Feb 2, 2014
    Posts:
    21
    Ok. Thanks! I connect "Multiply" to "Frac", but show some artifacts.

     
  16. LittleRainGames

    LittleRainGames

    Joined:
    Apr 7, 2016
    Posts:
    97
    Is there any documentation on how to make a terrain shader with shader forge?

    I was looking on the wiki and didn't see it, I haven't checked in a while though. Same with google. But I'll give it another go, thanks.

    Edit: Yes the parallax mapping link on the wiki is read and the page is non existent.
     
  17. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    That, from memory, is a result of bilinear filtering (or aniso filtering, I forget). Basically, one pixel has the UV coords of 1,1 or nearabouts, and the one next to it has coords of 0,0 or something, and in order to accurately blend between those two coordinates, it has to look backward over the entire texture, and will pick a basically random pixel along that line.

    Try changing the texture to point and/or 0 mip-maps, see if those help.

    Though, to be honest, I don't see why you'd need the frac. It might look better in Shader Forge, but introduces problems elsewhere, so why not leave it out?
     
  18. ethanwgross

    ethanwgross

    Joined:
    Jun 25, 2014
    Posts:
    83
    Is anyone else having an issue with ShaderForge not showing a scrollbar on the side panel when the Properties drawer is enabled? This is quite annoying to say the least because it prevents you from being able to arrange the properties if you have more than like 8 or 9 of them in the list. Using a Mac on Unity 5.5.0f3 -- ShaderForge v1.32 Does anyone else share this frustration?
     

    Attached Files:

  19. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    can you make the readymate template so we just drop the texture?

    like snow, metalic, mud, wet, customizable skyboxes etc?
     
  20. Alex_4x

    Alex_4x

    Joined:
    Feb 2, 2014
    Posts:
    21
    Hello. I'm try to expand model and use "Vertex Offset"
    How i can use normal for adjacent sides for calculate mean vector?
     
  21. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Not as such

    Unity's cube is basically just 4 quads placed next to each other in a cube shape. You can replicate the results by creating 6 unity quads and making said cube shape, the exact same thing will happen.
     
  22. Alex_4x

    Alex_4x

    Joined:
    Feb 2, 2014
    Posts:
    21
    Thank you for your answers
    I have a question again.
    I tried to make fish-eye effect, like all properly transferred within the meaning of, but there is a strange effect. I thought it was rezutat that coordinates are less than 0 or greater than 1, but with such a test the effect still remains. This does not prevent, or I suppose the obvious mistake?


    UV check for min 0, max 1
     
  23. doku3d

    doku3d

    Joined:
    Jan 23, 2017
    Posts:
    2
    Anyone else?

    Just updated both Unity and Shader Forge and noticed that specular highlights are incorrect across all of my shaders. Here's a comparison of the base SF PBR shader and the Unity Standard Shader, both with smoothness/roughness set to 0.7. The reflection appears to be correct, but at this value the specular highlight has completely disappeared.

     
  24. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155
    Hi Fishypants,


    Can you share the shader you developed ?
     
  25. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Looks really cool man. Did you use the depth blend node to make a transition between the beach and underwater ?
     
  26. masarunuma

    masarunuma

    Joined:
    Sep 23, 2016
    Posts:
    2
    Hey guys, I'm having an issue where I click to "Open shader in Shader Forge" or I go to "Window >> Shader Forge" and immediately after the shader forge window pops up, it closes itself. I'm not sure if this is a Unity thing or a shader forge thing, but it's killing me. I'm using Unity 5.5.0p4 and running the latest shader forge on a Windows machine
     
    steffrock likes this.
  27. shrapnel92

    shrapnel92

    Joined:
    May 17, 2014
    Posts:
    10
    I have the same problem, Win10 Unity 5.5.0f3. I get a NullReferenceException:
    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. ShaderForge.SF_Editor.OnDestroy ()
    3. UnityEditor.EditorWindow:Close()
    4. ShaderForge.SF_Editor:Update()
    5. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
     
    steffrock likes this.
  28. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Do some UV Math they said. It'll only be a little bit they said. For reference, this is about 10-15% of the uv management for an animal. For each skin, it uses all 4 channels of a rendertexture, each tiled in a 2x2 grid, so effectively 16 masks. The ultra-shader that spits out (another) RT (which is used to actually render ingame) is about 4 screens deep for colour and vector4 parameters.

    some_UV_math.png
     
    red2blue likes this.
  29. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    When I add the two normal maps and enable the "Perturbed"checkbox in Normal Direction as shown in the picture below I get many errors.......

    Any Ideas?
     
  30. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Please Help!!.......
     
  31. doku3d

    doku3d

    Joined:
    Jan 23, 2017
    Posts:
    2
    Can anyone confirm that specular highlights are working correctly with v1.32 on Unity 5.5? It's as if the specular roughness/gloss range is calculated incorrectly, with the specular highlights only visible right at the end of the scale ( > 0.8 )
     
  32. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    I don't have enough knowledge to help you, but I think you should copy the error notifications and post them so people can see what you are talking about.
     
    steffrock likes this.
  33. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Working on a terrain shader for a tropical island. You just put in any mesh which doesn't need UVs, splatmaps, flowmaps or anything and it automatically paints it depending on the height/angle.

     
    Lex4art, FPires, Fab4 and 1 other person like this.
  34. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Also made another thing where you can shape the terrain with mouse like a zbrush tool. It automatically reveals trees, rocks and grass where they are needed. It's all realtime and it gets the normals from height so it's also possible to modify and animate the terrain heightmap inside Shader forge.

     
    Valak, kerrmedia, DigitalAdam and 4 others like this.
  35. retmia

    retmia

    Joined:
    May 31, 2013
    Posts:
    25
    Hello there,

    All my shaders are breaking one by one on my project (Unity 5.5.0 & SF 1.33) when I compile them.
    It appears that the problem is related to the Deferred Render Pass Lighting option.
    Has anyone noticed that already ? Am I the Only One ? Is a fix planned ?

    SF_Bug.png

    Here is the error coming with it :

    Shader error in 'Shader Forge/NewShader-deffered': undeclared identifier 'surfaceReduction' at line 154 (on d3d11)

    Compiling Vertex program with SHADOWS_DEPTH LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP

    Please Help !
    Kind Regards,
    Romain.
     
  36. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Is this using the new version of SF that was released on Feb 4?

    (EDIT: Oh, I see it is ... you noted SF v1.33.)
     
  37. retmia

    retmia

    Joined:
    May 31, 2013
    Posts:
    25
    I pushed the tests a little.
    I created a brand new project, imported Shader Forge only, created a cube, a new SF shader brought a pair of textures, set my shader to deferred in lighting tab ... and it was ok ... until I selected my cube in the scene view ...

    I must not be the only one ... ? I can't understand.

    undeclared identifier 'surfaceReduction'
    Compiling Vertex program with SHADOWS_DEPTH LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA

    I'll try to reinstall Unity.

    SF_Bug_02.png
     
  38. retmia

    retmia

    Joined:
    May 31, 2013
    Posts:
    25
    Well well, so after I discovered that selection had to do something with the problem, I deactivated the new outline selection that came with Unity 5.5 in the Gizmos ... to use the legacy one ... and it's no longer crashing my shaders.
    Plus after that I turned back to the old one, now it repaired the new ... Computer mysteries ... Sorry for spamming the forum. Maybe it can help someone someday.

    Kind Regards,
     
    hopeful likes this.
  39. LittleRainGames

    LittleRainGames

    Joined:
    Apr 7, 2016
    Posts:
    97
    There is a setting to double the glossiness or something, try unchecking it.
     
  40. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Here's a quick shader-doodle inspired by this gif.

    shader in action:
    SF_IFL_BraidedLinesCircle.gif

    shader node graph:
    SF_IFL_BraidedLinesCircle.jpg

    a variation by playing with the properties:
    SF_IFL_BraidedLinesCircle2.gif
     
  41. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    And here's a description (with node graphs) that I wrote up for achieving stylized water like in Wind Waker. Originally asked about on the SF forums by @N1warhead

     
    ElectroMantis likes this.
  42. plokkum

    plokkum

    Joined:
    May 28, 2013
    Posts:
    90
    I'm trying to come up with a shader that creates a 'shockwave' effect which spreads accross a fairly complex 3D mesh. Its starting point should be a dynamic world position where the object gets hit.

    I've been trying and trying, but can't come up with a solution. If anyone can help me get in the right direction for just spreading a mask starting at a world position, that would be really great!
     
  43. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    @plokkum

    SF_IFL_3DShockwave_Ex1.gif

    SF_IFL_3DShockwaveNodeGraph.jpg

    I don't have much time right now to explain it all, but don't hesitate to ask about specific parts if you don't get something.
     
    Last edited: Feb 15, 2017
    Baldinoboy and plokkum like this.
  44. Alex_4x

    Alex_4x

    Joined:
    Feb 2, 2014
    Posts:
    21
    Hello! I have one question.
    I want to use UV offset in fullscreen shader for a small copy of the screen - like a highlight in a drop on the glass. If shader take the color of one pixel which gets offset - it is not very great. Whether it is possible to use instead MainTex MipMap texture to get the "average" value? Or MainTex not have MipMap textures?
     
  45. plokkum

    plokkum

    Joined:
    May 28, 2013
    Posts:
    90
    Yes, like that @IFL :)
     
    IFL likes this.
  46. shuncoro

    shuncoro

    Joined:
    Jul 30, 2015
    Posts:
    3
    IFL likes this.
  47. plokkum

    plokkum

    Joined:
    May 28, 2013
    Posts:
    90
    While I already posted another question on the last page, here is another one. Please excuse me :)

    I've created a custom-lit shader that generates a gradient and slightly dithers it, since the overall scene is very dark.
    However, every light object that is casting its light onto the surface creates a square plane around it that lights op the underlying pixels. Please take a look at the picture.

    The scene is in VR and is very dark, as it's supposed to. I cranked up the levels on the attached picture.

    Does anybody know what causes this? The effect is very noticeable in VR.

    shaderforge.jpg
     

    Attached Files:

    IFL likes this.
  48. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    I don't think the scene color has a mipmap. If you're wanting to average the color of an area of the screen, use multiple Scene Color nodes with each having different very-slightly-offset UVs. Add those together and divide by the number of Scene Color nodes you used for an average of that area. It's not as good as a mipmap, and it's kind of expensive on mobile, but it works.

    I'm pretty sure that it is not implemented, but you can get close by calculating the smoothed position of the "DX11 Displacement" for the Main node yourself.

    See my updated previous post for your promised node graph.
    I hate that square-lighting stuff - I used to get it a lot when I did custom lighting. I think the solution was to make sure every calculation in the custom lighting node branch could be applied for each light. Basically, don't do anything that you don't want added once per light. Also, I never figured out why it was a square/rectangle or where in the math it came from, but I didn't really look that hard.
     
    plokkum likes this.
  49. plokkum

    plokkum

    Joined:
    May 28, 2013
    Posts:
    90
    Thanks a lot @IFL, that's really helpful! I appreciate you taking the time.

    As for my lighting issue, I figured it out. I applied light attenuation after combining the light and texture values.
     
    IFL likes this.