Search Unity

Shader Forge - A visual, node-based shader editor

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

  1. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Anyone know how to get rid of the blue tint?

    I also need to use a height map and AO map, but I don't know where or how to hook them up.
     
  2. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Sounds like you want to implement texture splatting with the added ability to sample all your textures from a single atlas - http://acegikmo.com/shaderforge/wiki/index.php?title=Texture_Splatting

    Using the new UV Tile node you should be able to sample all 4 sub-textures and splat them according to your Color mask:
    http://forum.unity3d.com/threads/sh...sed-shader-editor.222049/page-86#post-2256676

    Just as in this example repeat the process 4 times to sample the 4 textures from your Atlas.
    After that use the splatting technique above.
     
    Last edited: Sep 27, 2015
  3. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    While I'm waiting for someone to get back to me on my shader problem, does anyone know if it is possible to achieve relief mapping or parallax occlusion mapping (POM) in Shader Forge?
     
  4. Laurens-Paladin-Studios

    Laurens-Paladin-Studios

    Joined:
    Apr 25, 2015
    Posts:
    54
    Thanks for the notification, i am looking forward to the update. I did also notice some weird Lightprobe issues in unity 5.2. so i suspect Unity is going to be working on fixing lighting from their side too.
     
  5. DiRoll

    DiRoll

    Joined:
    Jan 5, 2014
    Posts:
    32
    Yes, but I dont get how to implement it.
    I have a procedurally generated mesh and I assign UV coordinates to it.
    As a result I get image I've posted above.
    But how I could pass indexes of tiles for Uv Tile to splat them?

    It is hard to me to understand this stuff...
     
  6. CremaGames

    CremaGames

    Joined:
    Mar 5, 2014
    Posts:
    59
    We're loving Shader Forge here in CremaGames. We love it so much we decided to honor it making a meme



    Here's the detail of the shader in case anyone is curious. It's our first PBR shader created with Shader Forge so any comments, improvements or optimizations are highly appreciated

     
  7. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620


    Basically like this... both techniques combined. There are more advanced ways to do texture splatting, but I have trouble understanding what exactly you want.
     

    Attached Files:

  8. DiRoll

    DiRoll

    Joined:
    Jan 5, 2014
    Posts:
    32
    That's it! But how i pass tile number value for UV tile node for each tile of my map?
     
  9. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    You can turn the variable into a global variable (right click the node). You can then set its value via script.
    Or you could "misuse" the vertex colors of your procedural mesh to encode the ID. Where there is a hardcoded ID now there could be a formula that Looks up the ID from vertex Color.
    If that's what you asked...
     
  10. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Very interessing way i try expérimente too for bypass the trouble on mobile where texture mixing finish by make square
    here if i understand DiRoll talking about how make tiling on it after this
    and in my test this not look working result the same technical isue with gain on little 3 draw call for texture
     
  11. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
  12. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    :( result same
    i have hope is bypass this square Attack





     
  13. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    I have a very simple unlit shader built with SF that looks fine on most devices (and on PC) but on some devices (Android ) the shader appears as flat un textured grey.. How can I fix this?
     
  14. GDC86

    GDC86

    Joined:
    Sep 8, 2015
    Posts:
    3
    I'm trying to multiply the dissolve effect from the gradient map part 3 lesson onto another (emissive) map, as my material has glowing bits.

    When I attempt to pipe this multiply into the shader core, the material error pinks.

    I'm guessing I need to somehow convert the lesson 3 dissolve technique back into a 0-1 square space normal map before I can multiply these things together, but I have no idea how to go about this. Can I get some help please?

    (Also wondering why normal blue isn't .5, .5, 1 and is instead 0, 0, 1 )
     
    Last edited: Sep 29, 2015
  15. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,825
    I would like to see some pictures comparing the Unity 5 standard shader vs Shader Forge.
    I use the Unity 5 standard shader for: diffuse color, RGB file, and normal map only
    I dont care about emissions or reflections. I really don't know anything about shaders at this point.
    So can shader forge produce better visuals when compared to the Unity 5 shader?
    Can you post a couple of pictures so I can better see what Shader Forge can do with RGB file, diffuse, and normal maps? The
    Diffuse Ambient Light and Diffuse Ambient Occlusion looks like it could be useful.
    Thanks.
     
  16. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    What error are you getting, and how does the node tree look?
    Normal maps in textures are packed into the 0 to 1 range, whereas when they are sampled in a shader it always unpacks to the -1 to 1 range. This is so that the normal can point in any direction, and to simplify the mathematics for where it's applied.
    Shader Forge doesn't have a built-in PBR that's "better" than Unity's. It does however match Unity's PBR as closely as possible.
     
  17. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    92
    Hey, Acegikmo! Was wondering what happend to reflections in 5.2? I read you r on it, any eta?
     
    Last edited: Sep 30, 2015
  18. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Just fixed it - update should release within the next few hours
     
    crudeMe likes this.
  19. GDC86

    GDC86

    Joined:
    Sep 8, 2015
    Posts:
    3

    The note about normal maps converting to -1~1 would be a great one to put into the wiki. For artists coming in with no deeper knowledge, that's a gotcha that would probably stumble a lot of attempting to work from a pure art backround.

    Here's the tree.

    Capture2.png

    So the blue chain functions as expected, and also drives changes in blending for normal, spec, gloss, etc, with LERPs and normal blends. All of that is function.

    Trouble is, my base object has emissives. If I try to add them in via the pink chain, and then pipe the result into the emissive node of the material itself, the shaderforge sphere goes error pink.

    I can LERP blend anything procedural, no error pink, but the second I try to blend with a map data based tree of nodes, it goes back to error pink.
     
  20. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    Hi,
    I think I found a bug in Shader forge 1.9x...
    I can only fix it by entering the variable local in the function. But whenever I open shader forge, the error is back.

    UNity debug:
    Shader error in 'Shader Forge/NewShader15': undeclared identifier 'objPos' at line 130 (on d3d11)

    code:
    void displacement (inout VertexInput v){
    float3 node_7296 = (mul(_Object2World, v.vertex).rgb-objPos.rgb);
    float2 node_2483 = lerp(node_7296.rg,node_7296.bg,_node_3329);
    float2 node_5321 = lerp(node_2483,(node_2483*(v.normal.b*-1.0+2.0)),_node_8978);
    float4 _tessheight_var = tex2Dlod(_tessheight,float4(TRANSFORM_TEX(node_5321, _tessheight),0.0,0));
    v.vertex.xyz += (v.normal*_tessdepth*_tessheight_var.r);
    }
     
  21. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Can you make an isolated case to reproduce the issue with as few nodes as possible in a new shader?
     
  22. Laurens-Paladin-Studios

    Laurens-Paladin-Studios

    Joined:
    Apr 25, 2015
    Posts:
    54
    And it seems the fog setting are not causing any issues anymore either. It's great that we can rely on this asset, keep up the great work.
     
    Acegikmo likes this.
  23. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Forgot to post this yesterday!

    New in Shader Forge 1.20:
    • Added node: Smoothstep
    • Added node: DDXY - a summed DDX and DDY (known as fwidth in code)
    • You can now rotate the lights in the 3D preview by dragging the right mouse button
    • Billboard shaders are now affected by object scale
    • Textures assigned in a shader are now treated as default values in its materials
    • Fixed a bug where reflection probe sampling broke in Unity 5.2
    • Fixed a bug where Lerp and Inverse Lerp sometimes had the incorrect component count output
    • Fixed a bug where large textures loaded very slowly when assigned in nodes
     
    IFL and DMeville like this.
  24. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    In addition, 1.21 may have a massive editor performance boost soon, if my experiment works out :)
    Seems promising so far!
     
    IFL, hopeful, SunnySunshine and 2 others like this.
  25. Deleted User

    Deleted User

    Guest

    GPU based editor?
     
  26. doraaman

    doraaman

    Joined:
    Oct 2, 2015
    Posts:
    2
    Im new in SF
    ihave a question about how make soft edge . upload_2015-10-3_0-12-56.png
    upload_2015-10-3_10-10-17.png
    I used this method but it didn‘t work upload_2015-10-3_0-12-2.png
    upload_2015-10-3_10-17-19.png
     
    Last edited: Oct 3, 2015
  27. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @doraaman Create another multiply node which multiplies the texture alpha by the vertex normal alpha, and put that into the opacity input of the main node?
     
  28. doraaman

    doraaman

    Joined:
    Oct 2, 2015
    Posts:
    2
    DMeville where is the vertex normal ? :(
     
  29. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Just wondering if anyone has got a solution to this issue yet.
    I am getting to the point where this issue is really bugging me as everything in my scene looks to have a blue tint.
     
  30. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    I just tested it, and the *slight* visual differences are not really worth the effort to fix. It's not too blue for me - it's actually less blue. I used SF's example textures, with a modified version of the cloudy one plugged into the ambient occlusion slots. The difference between my SF shader and yours is that I matched the channels 1:1 with the Standard Shader. It isn't necessary to have the exact channels, but it is necessary to have the exact data if you want to make a fair comparison. In your case, you'd need multiple swazzled images that differ between the Standard Shader and the SF version. Also, Roughness = 1 - Smoothness.

    SF_vsStdShad.jpg
    SF_vsStdShad.gif
     
    Last edited: Oct 3, 2015
  31. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    I don't speak meme, but I think that you should try to attach the Depth Blend output to the Multiply before Emission, just to see what happens. o_O
     
    DMeville likes this.
  32. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Thanks so much for the image, the blue channel from the Metallic map was causing the issue, with it just sampling the red, it looks MUCH better.

    The last issues are that I need to use a height map (in the same way the standard shader does preferably).
    And I also would prefer to be able to control the normal, height and oclusion strengths, the way I am going it at the moment just turns those channels black which obviously doesn't work.
     
  33. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Height is usually layered parallax, which is just terrible in a node environment. Requires either huge chunks repeated in your graph, the Code node, or DX11 tessellation.
    For normal strength, component mask to just the RG, multiply it by the strength, and append the Blue back on that.
    For occlusion, multiply it by the Strength and then add 1-Strength to it.
     
  34. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    A while ago I mentioned fading the edges of a material for a particle effect, but never worked out how to use the depth blend.
    Can someone show me an example of this, I have tried several different things, none of which seem to work.
     
  35. PolyToots

    PolyToots

    Joined:
    Mar 15, 2014
    Posts:
    20
    Can anyone here explain how they'd go about creating this type of water shader?:



    I know it looks very simple, and there's no reflection (which is another hurdle I'll avoid for now), but I just can't wrap my head around things like the automatic "edge foam". The closest I've gotten is with a depth node in the opacity slot, but it's not quite the same, plus it always renders out black.

    You also can't tell from just a static image, but there's refraction happening under the surface here too. I cannot get refraction working properly for the life of me. It always just refracts everything, even objects above/in-front of the surface. Is this normal?

    The highlights/waves (2 or more blended normal maps with animated offset) and the colour are about the only things I understand.

    plz send halp.
     
  36. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504

    Edge foam - look up intersection blending and soft particles. Basically, you compare the depth of the (water) with the depth of the (res of the world). As the distance between those two gets smaller, you blend in the foam texture/color. I think the Depth Blend node is what you may be looking for. Plug it into emissive instead of opcaity so you can understand it.

    Refraction will do that. UNLESS you make your own custom refraction mask that only renders things below the water to a texture, and you distort that.
     
    PolyToots likes this.
  37. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Oops, I meant vertex colour alpha! Sorry :)

    The problem lies with the fact that opacity isn't done for you automagically. When you multiply the texture RGB with the vertex color RGB, it's just doing a multiply through those three channels, nothing with opacity! So you have to do that yourself by multiplying the texture alpha by the vertex color alpha and plugging that into the opacity main input. Hope that helps!
     
  38. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
  39. ShadowCory

    ShadowCory

    Joined:
    Sep 2, 2015
    Posts:
    1
    Is there a customer support address for Shader Forge? I have a question about updates to accounts and emails.
     
  40. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Guessing you found it, since I got your mail :)
     
  41. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    IFL, FPires, crudeMe and 2 others like this.
  42. Steven

    Steven

    Joined:
    Dec 23, 2009
    Posts:
    43
    Hey everyone, just wondering if anyone else is having issues getting past version 1.18? In a browser the asset store shows 1.2, but once it opens in the engine it reverts back to 1.18.

    Anyone know what asset store black magic wizardry I need to get up and running?
     
  43. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Any version past 1.8 requires Unity 5.2 at minimum. Check if this is the case with your installation and report back if so.
     
    Acegikmo likes this.
  44. Steven

    Steven

    Joined:
    Dec 23, 2009
    Posts:
    43
    Thank you Marco Sperling, that will be the problem. Downloading a new Unity build now.
     
  45. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
  46. plasmabazooka

    plasmabazooka

    Joined:
    Mar 8, 2015
    Posts:
    70
    Sorry If the question was raised already but I could not find an answer.

    Is there a possible way to create a good water which is fading out with deep?
    Could somebody help with a link to an example?
     
  47. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Is it possible to achieve a view-based outline on an object, so if the object with the outline is partially occluded the outline draws around what is visible?

    And what causes these "shadow" artifacts in the glow?
    Temp.png
     
  48. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I'd appreciate if you posted threads over on the new forums instead, so that other people who may run into the same issue can easily find it. :)
    I'll just answer briefly here.

    There are a few things on the Shader Forge Wiki about how to do depth-blending as well as color elimination, which you might want for water.

    Having screen-space outlines isn't possible given how it works at the moment. The artifacts seem to be caused by a post effect of some sort
     
  49. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Has anyone yet found a solution for Parallax Occlusion Mapping (POM) or Relief mapping without using custom lighting?
     
  50. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    1.21 is now released!
    • Fixed a bug where PBR shaders didn't compile in OpenGL
    • Fixed a bug where the shader inspector was triggering errors on shaders with compiler errors
    • Added a link to the new forums in the menu
     
    DMeville likes this.