Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Shader Forge - A visual, node-based shader editor

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

  1. Morfeuskiev

    Morfeuskiev

    Joined:
    Oct 10, 2013
    Posts:
    122
    Last edited: Sep 17, 2015
  2. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @Morfeuskiev I already replied to you; Please read my explanation again! http://forum.unity3d.com/threads/sh...sed-shader-editor.222049/page-88#post-2273633

    This is not a bug, SF works fine with opacity and refraction together. You're assuming that just because you plug something into the opacity input that the refraction should be multiplied by the alpha, but that is not how it works (because in many cases you don't want it to). Add a lerp(Vec3(0,0,1), refractionNormals, alpha) and plug that into refraction rather than just plugging in your straight refractionNormals.

    Edit: Here's a graph - http://i.imgur.com/1chF6Ur.png
    Edit#2: And here's a gif - http://i.imgur.com/pTbcWyC.gif
     
    Last edited: Sep 17, 2015
  3. Morfeuskiev

    Morfeuskiev

    Joined:
    Oct 10, 2013
    Posts:
    122
    Last edited: Sep 17, 2015
  4. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @Morfeuskiev Is "Per-object refraction" on in the blending tab? I get similar results to your gif when it is not, but looks fine when it's enabled :)

    Edit: I lied. It works fine when it's on a quad, but still breaks when it's put on a particle system. Must be an issue with the particle system doing something. Hmm
     
  5. Morfeuskiev

    Morfeuskiev

    Joined:
    Oct 10, 2013
    Posts:
    122
    DMeville likes this.
  6. Dvonio

    Dvonio

    Joined:
    Oct 15, 2013
    Posts:
    20
    Hey Acegikmo Does Shader forge use GGX or Blinn-Phong for the Metallic/Roughness PBR settings?

    I cant seem to find any information about it, thanks!
     
    hopeful likes this.
  7. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    154
    Can we simulate or use Flow Maps like in the Flow asset in the Unity Asset Store ?
     
  8. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
  9. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    154
    Thanks DMeville !
     
    DMeville likes this.
  10. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    The non-GGX one
     
  11. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,624
    Is GGX a possibility with ShaderForge?
     
  12. Dvonio

    Dvonio

    Joined:
    Oct 15, 2013
    Posts:
    20
  13. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
  14. Dvonio

    Dvonio

    Joined:
    Oct 15, 2013
    Posts:
    20
    I would love it, if you can have some time to look into it, we are using Shader Forge in our game and we are using PBR and to match substance painter well, ggx helps a lot. thanks <3!
     
    hopeful likes this.
  15. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    422
    HI there! How i can realise dynamic blood effect on the floors, walls, armor, weapon with SF ?
    Thanks, i'am noob in this article.
     
  16. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    hello again...
    does someone know to get this?

    I want the negative X and negative Z normals of a Normal Dir node. And would like to have that as a mask and control the smoothness transition. I am trying to create a triplanar tessellation shader that works correct on tessellation. But the ABS node is making al positive and therefore the tessellation goes inwards on the negative normals.
    regards! Tom
     
  17. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Hey. I am getting "You have nodes with conflicting variable names. Please rename one of the node_2001 nodes" error in the console. I do not understand why. I was just following your triplanar setup on the wiki.

    SF 1.19
    Unity 5.20

    upload_2015-9-19_20-57-46.png
     
  18. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,745
    This is a long-standing bug, iirc. You have to manually add texture2d nodes instead of copy/pasting them
     
  19. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    there is a setting where you can toggle show variables and then edit the variable
     
  20. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Ahh. I thought that bug got squashed a while back. I had seen it before but I not for a long time.
     
  21. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Any way to create projector shader please ?
    and info about sky and post-effect are welcome thank's
     
  22. Rob-Madden

    Rob-Madden

    Joined:
    Sep 20, 2015
    Posts:
    10
    Hi all, having some problems with a refraction shader I am trying to build and hoped someone could help. The refraction works as expected for objects behind the refractive object but objects in front of the refractive object are also causing refractive effects. Does anyone know why this would be the case?

    Here are some screens:

    RefractionScene01.png RefractionScene02.png

    I have highllighted the problem areas that I would like to eliminate. Is this expected behaviour or have I done something silly with my shader?

    Thanks,

    Rob
     
  23. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    That is expected behaviour since SF is implementing a simplified version of refraction shading.
    Eliminating these artifacts requires the creation of a mask based on the depth of pixels currently rendered (the refracting geometry) and those already on screen (cube in your case).
    That mask could then be used to kill the refraction effect in places where it would look odd.
     
  24. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    That sounds really interesting, @Marco Sperling, I didn't know a solution to this problem existed.
    Do you happen to have any examples of the actual implementation?
     
  25. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
  26. Rob-Madden

    Rob-Madden

    Joined:
    Sep 20, 2015
    Posts:
    10
    Thanks very much for the info Marco. I'm pretty knew to shader work though; is a refraction mask as detailed in your link achievable within SF? Does anyone have any recommendations for an implementation?

    Cheers
     
  27. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    It is quite complicated to do with a node based approach. Honestly I don't know if it can be done in SF alone.
    Optimal solution would be if SF supported this mask natively. You can take a look at the water4 shader that ships with the standart assets from Unity. If I remember correctly it features such a masked refraction. You could copy the relevant lines of code into your shader after you are done editing it in SF.
     
  28. wingcutangel

    wingcutangel

    Joined:
    Jan 14, 2013
    Posts:
    6
    I'm having a problem with SF. As of unity 5.2 all reflection probe reflections disappeared or appear incorrectly (very blurry and looking like a texture with bad UVs). Anyone else has this problem?
     
  29. JoeW97

    JoeW97

    Joined:
    Nov 3, 2013
    Posts:
    56
    Hi
    Is there a recreation of the Standard Unity5 shader available for SF?
    Most often, I just want to modify or extend this a little, rather than starting a new shader from scratch.
    It would be great if someone's made this and willing to share! :)

    Thanks

    Steve
     
  30. GDC86

    GDC86

    Joined:
    Sep 8, 2015
    Posts:
    3
    Issue.PNG I've built my own refraction with parallax, screen color, and such like things. The trouble is that this only uses the geometry and ignores the normal maps. I have been able to add some extra distortion from tweaking the UV results with some greyscale add-ins.

    What I want is for this to be done using the geometry plus the normal map. How would I go about converting the model normals into a style of normals that the parallax UVs can use?

    I'm not doing this via the refraction input because I need to use this in a stepped emissive LERP.
     
  31. Laurens-Paladin-Studios

    Laurens-Paladin-Studios

    Joined:
    Apr 25, 2015
    Posts:
    54
    Hi there,

    I'm getting errors when using vertex colors since i updated shaderforge to 1.19. I am working in Unity 5.2.0f3. To reproduce, create a Lit PBS shaderforge default shader and add a simple vertex color input somewhere in the shader... like so:



    As soon as i add the vertex input to the shader and compile i get this error:

    Edit: Also it seems to be something related to fog setting: if I enable fog in the scene it will start giving me the error and when i disable fog in the shader it will also stop giving me the error... is fog somehow related to vertex colors?
     
    Last edited: Sep 22, 2015
  32. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Can we get access to lightmaps (and light probes data) in custom lighting shaders? It would be nice to be able to create otherwise completely unlit shaders but get all the Information needed to light the scene via lightmap data.
     
    IFL likes this.
  33. Laurens-Paladin-Studios

    Laurens-Paladin-Studios

    Joined:
    Apr 25, 2015
    Posts:
    54
    Hi Wingcutangle, I too have problems with reflections actually, but it took me quite some time to see that there was something wrong:
    Cubemap reflections look like they have been baked on the geometry that should be reflecting and don't update when camera moves.



    I hope this is the same thing you encountered?
     
    crudeMe likes this.
  34. wingcutangel

    wingcutangel

    Joined:
    Jan 14, 2013
    Posts:
    6
    This is exactly what I noticed. Even in the SF window the reflections don't move but instead stay static on the model. Any idea for a fix?
     
  35. edufurla

    edufurla

    Joined:
    Mar 7, 2014
    Posts:
    19
    Hi. I wondering if is possible make a chroma key effect in SF.
    Is it possible use a webcam texture inside a shader make with SF?
    I am using AVPROLIVECAMERA asset and works fine with Unity standard materials, but when I try use SF shaders nothing happens.
     
  36. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    how can I get the skybox from default unity 5 into my custom shader? (custom lightning)
    How does it work with reflection probes anyway? That option is always disabled, no matter what type of shader I am creating.
    Even better; how can I plug TimeOfDay skybox into my custom shader?
    Regards!
     
  37. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Some can help for make decals
    i use Channel blend for remove alpha from texture
     
  38. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    You can get close by choosing PBR lighting in the side panel.

    Are you looking for the Normal Dir node with Perturbed checked?

    I'm still on 5.1 so I can't check, but unless you're using a Forward camera, I'd switch to deferred given the outputs you're using.:)

    Like @DeadNinja posted here?

    I don't think that projectors are supported in SF. I think you have to go into the shader code. I could be wrong though.
     
    DMeville likes this.
  39. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Does anyone know how to reproduce the standard shader in ShaderForge?
    I use the Standard shader for most of my environment but need to add an interactable object glow/outline to some objects but don't want to sacrifice the look they have at the moment using all the maps.
     
  40. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    I may misunderstand, but that seems REALLY easy with SF.
    Create a new PBR shader. Choose Forward or Deferred. Plug in your maps.
    Glow - use the emission. Outline - use the outline. Outline Glow - use the glow color.
     
  41. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    The issue with this is that I use the alpha of the Metallic MAP as a roughness channel.
    Also, the outline I am looking for is not like a glow, but more of a uniform and tight outline which I can trigger with script.
     
  42. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    ... can you connect the alpha channel to the Metallic slot on SF's main node.....?
    Base the outline distance on the world-position distance to the camera multiplied by a property (range of 0.0 to 0.06?). Set the property via script. If you're wanting per-object outlines instead of per-material outlines, shader-logic isn't the way to go, at least not in my opinion.
     
  43. Laurens-Paladin-Studios

    Laurens-Paladin-Studios

    Joined:
    Apr 25, 2015
    Posts:
    54
    We are aiming to make PBS work on Mobile. In this case forward rendering would be the only option for now. The fact is though, reflections probes are not working for shaderforge in Unity 5.2
     
    crudeMe likes this.
  44. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    After a little bit of tinkering, I have managed to get a little further with recreating the Standard shader in Shader Forge, but need a little help getting the visuals right.

    In the image below, my standard shader is on the left, and the default Unity one is on the right.
    They are using the same textures more or less, but mine has a grey/blue tint.
    The roughness specularity on mine seems too harsh.
    I also don't know where to plug in my height map.

    I have attached the shader to this post.

    P.S. The roughness is in the alpha channel of my metallic map of my texture, hence why my gloss map is on the alpha channel of roughness.

    screen_1920x1080_2015-09-26_22-42-44.png
    screen_1920x1080_2015-09-26_22-43-06.png
    screen_1920x1080_2015-09-26_22-43-14.png
     

    Attached Files:

  45. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Does anyone know how to add an enum to a shader that changes the variables?
     
  46. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    Looks like 5.2 changed quite a lot - I'll look at fixing the things that broke during this week ahead - though I'm not sure when it will be done as I'll be quite busy with a few other things during that time as well.
     
    crudeMe likes this.
  47. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,293
    That's not supported yet

    Possibly, though there are quite a lot of bugs to look at for the coming update, and lightmapping is, well, complicated.
    Access to the data is one thing, but actually reading it properly and applying it properly is the tricky part.
     
  48. DiRoll

    DiRoll

    Joined:
    Jan 5, 2014
    Posts:
    32
    Hi! I have a tile map something like this

    How could I make a seamless/smooth transition between tiles?
     
  49. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    @DiRoll how about adding more tiles?
    Example: Sand with grass rim to the left, sand with grass rim to the top, sand with grass rim to the right, sand with grass rim to the left and the top, sand with grass rim to the top and the right... you get the idea?
    What you have there is a very, very basic tileset. Most tilesets have textures or models for many corner cases.

    I'm in no hurry. Just thought that this would be a nice feature.
     
  50. DiRoll

    DiRoll

    Joined:
    Jan 5, 2014
    Posts:
    32
    Yes I know that I can do this using more tiles, but I need to do this in shader. I have a tiled texture containing grass, sand, water and other tiles. I pass numbers of tiles (with UV Tile node) that I want to blend(from 1 to 4 tiles) and mask texture to shader.