Search Unity

Shader Forge - A visual, node-based shader editor

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

  1. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Update your Unity ?
     
  2. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    Shameless Self promotion:



    I tried to recreate Batmans cape and cowl rain effect from arkham knight I think it looks pretty good but it would look even better if cubemap and specular were equaly sharp/blurry at the same roughness value D:
     
    Ga2Z, Deleted User and hopeful like this.
  3. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    That looks super cool. Awesome work! Would love to know how you did it :)
     
  4. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    hopeful likes this.
  5. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    Last edited: Jan 9, 2016
    mr_pitz, KWaldt, GamerPET and 4 others like this.
  6. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Thanks for posting that, it works and looks really great! Gives me some ideas for the future too.
     
    env_warby and Deleted User like this.
  7. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    hello!
    Does one know how to create a magnify or pinch effect using a perlin noise texture (or any other noisy blurry White black texture) on UVs?
     
  8. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    Real quick I just want to say thanks to Cactus and Jesus for both taking a S*** ton of their time to lead me in the right direction!

    I'm slooowwwly starting to get the hang of it.

    There's only one thing right now I'm stuck with.

    Right now, I've been able to replace the hard shadows with textures, using just a placeholder screen hatch texture and I've plugged that into the Emission input.

    My problem now is because I've plugged those nodes into the Emission tab, it doesn't factor in lighting.
    So for example, it just overlaps over the texture and lowers the emission/alpha of those textures based on lighting rather than adjusting the alpha of the texture based on the light intensity and position.

    Here's just a quick screen cap of the scene, material sphere and nodes.


    I know I'm doing something wrong but I'm unsure exactly WHERE I'd need to adjust.
    All I know is that I'll have to move all of the shading texture nodes back somewhere into the Custom Lighting path.
    Any thoughts?
     
  9. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I think we're going to have to see bigger pictures ... :)
     
  10. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    Oh God, I thought they would've just embedded properly. Woops!
    I'll fix that up right now.



     
  11. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    Look into the custom lighting examples on the shader forge wiki. The tips I gave you applied to the diffuse (albedo) part of that lighting graph, but that's actually not a limitation, just a reccomendation. You can either do separate funky stuff to the diffuse and specular (I recommend this because if gives you nice control over the highlights), or you can do it after they're added together.

    For everyone here, I would really, really recommend getting familiar with the n.l (and the specular) term and what you can do with it.
     
  12. fengshuifever

    fengshuifever

    Joined:
    Nov 28, 2013
    Posts:
    15
    Oh right! I'm gonna have to get a bit familiar with specularity in general.
    When you say n.l term, is that the dot product between the normal direction and light direction? (That what I thought you were talking about)

    Edit : I forgot to ask, would I have to try the same method through Custom Lighting to get the effect or is the solution elsewhere?
     
    Last edited: Jan 10, 2016
  13. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    I'm getting a problem. Whenever I make an Object-Space Triplanar shader, if I turn on Tessellation I get an error:

    Shader error in 'Shader Forge/ChillEntityTriplanar': undeclared identifier 'objPos' at line 170 (on d3d11)
     
  14. gfunk

    gfunk

    Joined:
    Mar 17, 2015
    Posts:
    23
    Hey, IFL, very nice work on the hair shader. Could you perhaps share some tips or even the node tree for this material, cause I'm having a hard time getting the transparent hair strands to work correctly. Thanks for any input on this!
     
  15. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    I'm trying to get a shader that outputs vertex colors on a mesh and pretty much ignores lighting. However so I don't end up with just a color blob I want to darken the colors slightly by normal dir. The idea is to be showing a mesh with its vertex color with fairly uniform lighting. I also have an outline.



    Here's what I have so far (Forward/Unlit shader) and this is in a scene with no lights and no post fx and all green vertex colors so I'm not sure where the red is coming from.


    Any suggestions for improvements?
     
  16. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @Fuzzy_Slippers I think the red is coming from the normal directions. Maybe you could try running the normals through a Desaturate node to just get a greyscale version to act as the lighting or something.
     
  17. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    is there a way to set "importance" of one of the normal direction angles in an alpha blende shader, so you will always see just the top of a cube, instead of the bottom backface, seeing the cube from above(the shader is double sided) ???
     
  18. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Awesome this worked perfectly. I fed that into a color lerp and it is doing exactly what I want. Cheers!
     
    DMeville likes this.
  19. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    I can remember that I had a this very same bug too. I ended up, copy paste that code on given linenumber in a code block and then it worked.
     
  20. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    I wanted to learn about shaders. So I bought Shader Forge. I just imported the asset for the first time and looked around it, the documentation, and the website.

    Phenomenal !

    I am going to learn so much from this Shader LABORATORY!

    OK.I just went a little fan boi, but I feel much better now. Please excuse me while I go back to class at Shader University.
     
    DMeville and Acegikmo like this.
  21. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Whooow! Amazing. This is exactly what I wanted. I'm not 100% familiar with shaders yet so I'm looking forward to implement this. Do you think it's possible to upload the water_droplets texture?

    I'm going to get my boss to buy the plugin. I wanted to get it last month when it was on sale but the other boss wasn't around for the approval :(

    Thank You!
     
  22. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    The droplets come from the particles, the texture shown in the picture is just to preview in the shader.
     
  23. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    So basically I'm only dependent on the Shader Forge... no other assets are required for me to do that?

    I need something similar... only that is not placed on the camera, is placed on the window of a train.


    Need to make some moving droplets there.
     
  24. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Well, you'd probably want to change the shader to have some kind of refraction and probably tweak the particle systems to act more like they're hitting the window of a moving object.

    His shader is not placed on the camera.
     
  25. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Ah I get it now. He placed his shader on the camera so we can see it in the Scene Editor.
     
  26. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    No, the camera is for the render texture that produces the rain effect from the particle systems. He put the render texture output on a quad.
     
  27. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Is there a way to get the accurate displaced normals when using DX11 displacement ? Seems as it doesn't modify the mesh normals and the plane normals remain flat.
     
  28. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Somewhat, it usually involves multi-sampling your heightmap to calculate a normal from it. But this is something you generally do beforehand in a normal map, unless it's entirely procedural.
    More info: http://acegikmo.com/shaderforge/wiki/index.php?title=Normal_Reconstruction
     
    Cactus_on_Fire likes this.
  29. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
  30. Deleted User

    Deleted User

    Guest

    I want to visualise point cloud on Android device (OPENGL 2.0 ES). Unfortunately, this solution:

    mesh.SetIndices(indecies, MeshTopology.Points,0);

    doesn't work on Android. Also DirectX 11 solution Graphics.DrawProcedural will not work of course.
    I thought about converting XYZ vertex positions into RGB texture values and loading these values into shader. Then, transform these world positions into view and rendering in screen space. I also thought about manually create model, view and perspective matrices to rendering vertices in real time 3d scene, but this task is not easy.
    Maybe someone can give me idea how create point cloud using only fragment shaders (to work on Android)?


    For example how to render single white vertex (world absolute is 0,0,0) in black background ???
     
  31. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    hey, im trying to do a terrain shader, but when i put normal map to it all lighting gets weird, and yes i have checked the "bump map" bool on the texture input, and also i put a correct normal map to test it, but anyway all lighting in the terrain gets very weird and messed up :( any help?
     
  32. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    I thought Unity Terrain shaders were always borked; that they had to do some funky normal recalculations on the fly because of the dynamic nature of the heightmap-based system (adding in polys here and there).

    I might be mistaken, but there's probably not a huge amount you can do about that. Until Unity sets up terrain shaders for custom shader code (are there scripts or snippets out there that can do this?) I don't think you're going to get particularly good results.

    One thing you can try (and I'm just throwing this out there) is to get a heightmap as an input, and do some normal reconstruction to get the normals. With a 16-bit, I believe the Height = R + (G/256). Then do reconstructed normals on that, and plug that into the normal map input for the shader. I don't even know if SF will accept a 16-bit heightmap as an input, you may need to take it into PS and spit it out as a RGB image with the R and G channels done that way (again, no idea if that'll work).
     
  33. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    What do you mean, exactly? I'm still having this problem, if you can give me some help I would appreciate very much so.
     
  34. Alexarah

    Alexarah

    Joined:
    May 1, 2014
    Posts:
    110
    Hi Acegikmo is it possible to make a toon shader that looks anime based? Basically like the Naruto Ninja Storm game series. If so how would this be done because I'm looking into buying Shader Forge here soon.
     
  35. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @Alexarah Should be pretty easy to reproduce in SF, looks like a pretty basic toon shader, just on some really nicely created models/normal maps.
     
  36. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    How do I open the Node Browser?
     
  37. Deleted User

    Deleted User

    Guest

    Hey everyone quick question... emission input vs custom lighting input? They seem to do the same thing? Is there any speed advantage in using one more than the other? I'm using emission for now. Hoping there isn't some "Gatcha" down the road, where I'll regret that I didn't use Custom Lighting input instead.
     
  38. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    Custom lightning is supposed to use for a real custom shading setup, while emission is used for just make materials lighten up.
     
  39. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    how do you smooth the results from the ddx / ddy trick? The edges are all hard.
     
  40. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    AWESOME @Cactus_on_Fire could you post the node-tree :eek: ?
     
  41. jermaineatl

    jermaineatl

    Joined:
    May 4, 2014
    Posts:
    9
    Hey guys so i was trying to find a way to have my outline lit using my lights in the scene, but not changing the entire model. I tried to add the light direction/light color nodes , but no effect. Anyone know how to achieve the effect?
     
  42. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    127
    Hello there!

    I'm currently working on a custom lighting shader, and I'm stuck on the shadows. Is there a way to blur the shadow pass?
    I don't mind the quality that much, something like the mip levels on a texture would be fine (but I can't use the shadows as the TEX input in the texture2D node, can I?), I just need some more halftones to work with for the desired effect.
    Does anyone have an idea?

    Best Regards,
    Kristina Waldt
     
  43. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,426
  44. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    the particle system and the camera only yield a black an d white texture that shader converts that to a normal map ( and uses the black and white version as roughness ... the shader itself goes on any object that is supposed to be wet !? like those cubes and spheres in my demo ... i dont understand the question really ...
     
  45. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,426
    Sorry, worded badly.
    I don't know what slots to put things in.
    Where does the RenderTexture go, and what are the other slots?
     
  46. jermaineatl

    jermaineatl

    Joined:
    May 4, 2014
    Posts:
    9
    So i found a shader(Image on the left) that was similar to the one i was trying to create so i tried to replicate it as close as possible(image on the right) but still no lucky. Any advice on what i could do to add to get it closer to the image on the left. Im still a shader noob, but any help would be appreciated :) There were alot of parameters on the shader i had found so if you'd want to see those as well i could screen cap it.
     

    Attached Files:

  47. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi, any idea how to make a fluffy ball? Use script to simulate each hair is toooooooo expensive :eek:
     
  48. jermaineatl

    jermaineatl

    Joined:
    May 4, 2014
    Posts:
    9
    depends on what type of fluff. is it like cotton or another material?
     
  49. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,426
    I know it's not a Shader Forge solution, but you should check out Unity Japan's extension for NVidia's Hairworks library.
    For the last several months they have been working on incorporating NVidia's hair/fur solution into Unity.

    It runs pretty smoothly considering the effect, not sure if it is what you are looking for, but well worth a look ;)
    Here
     
    Cactus_on_Fire likes this.
  50. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    holy hell...

     
    jermaineatl and DMeville like this.