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. Deleted User

    Deleted User

    Guest

    Thanks. Let me know if you want any help debugging.
     
  2. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    In my custom light how can I invert the light directions? For an example, I have the specular with half view and the surface normal, now can I make the specular work on the oposite side of the normal, like hit top but shine bottom??

    Also, is there are way to do a plane always be in the oposition direction of the camera, like a particle plane.

    Thanks
     
    Last edited: Apr 23, 2014
  3. P1st3ll1

    P1st3ll1

    Joined:
    Dec 13, 2012
    Posts:
    69
    Can Forward Rendering use Camera's Depth Texture ?

    I really need this but I don't own Unity Pro...
     
  4. neroziros

    neroziros

    Joined:
    Aug 25, 2012
    Posts:
    129
    Awesome work!

    I really like the lightinghere would love to see the shader tree.
     
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    Yes, but you can't render a depth texture in Unity Free to begin with.
     
  6. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I think you could just reverse the light vector using a negate node
     
  7. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey Ace. I am working on a ocean shader. I am using the uvpan for the waves moving but can can only control the pan speed and direction in the uvpan node. Is there a way to control those setting out in the material inspector. Thanks
     
  8. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
  9. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Awesome:D. Thanks
     
  10. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Any tut for making skin shader?
     
  11. DaDarkDragon

    DaDarkDragon

    Joined:
    Jun 6, 2013
    Posts:
    115
    devang_xprt, there is a basic start to one in the examples scene also called light wrapping.
     
  12. sundance

    sundance

    Joined:
    Mar 19, 2014
    Posts:
    52
    Hi there! Need advice. I made transparent water with refraction but now i have one trouble with depth blend:
    http://tinypic.com/r/2j4d9jm/8
    Texture of depth wich generating in camera makes static alpha from geometry. And when i made refraction by depth alpha stays in place.
    How can i fix this. Please take advice if u know:)
     
  13. CTPEJIOK22

    CTPEJIOK22

    Joined:
    Sep 4, 2013
    Posts:
    85
    looks great! can you show your shader? im testing toon and ramp shading too, but results not so good.
     
  14. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Hello there, back to haunt you, i have a question that much regards Skyshop's coming features, that i've been aware of for a while but didnt realise they were coming so soon and drastically alter my direction - i'm currently developing for a competition, im being a bit ambitious but with trickery and the help of the asset store I think it's doable

    I've read that you're implementing skyshop's functionality, or have done already, and this should 'go live' in a week or so with skyshop's next update. My question is - will it be possible to recreate, should I need to, skyshop's core shaders (diffuse and specular ibl) with box correction, in shaderforge, adding tessellation to their features?

    For my grand design, several gigabytes of data as it stands is involved, i need to get that more like 100-200mb at most, my plan is to decimate the hell of any geometry and apply a coherence enhancing shock filter to the textures to simplify and stylise them so i can shrink them to a massive degree. dx9 users will just have to suck it (I know there are tessellation solutions for dx9 but don't have the time to research or implement them) but i was thinking for 'dx11 mode' I could procedurally recreate geometry detail by tessellating in a simple form for any material without a map for it (it will simply bevel the edges by x amount) or with a simple map add further information and top of this add optional noise, like perlin or fbm, calculated on the gpu, and this way the models retain their stylisation but don't look like something from the 90s (although the shading and art should hide this)

    Do you imagine this is feasible? If it is i'll be a very happy man
     
  15. LennardF

    LennardF

    Joined:
    Apr 26, 2014
    Posts:
    19
    I just released Shader Forge Extensions, which allows you to save selected nodes to a file to re-use them at any time.
     
    Last edited: Apr 26, 2014
  16. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
  17. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    Is box projected cubemap environment mapping possible with Shader Forge?
    http://forum.unity3d.com/threads/11...Box-Projection-Correction-Environment-Mapping

    also, is it possible access the 2nd UV channel? For plugging in your own baked lighting.

    I'm setting up a material that uses baked textures and then looking for various ways to implement reflections across them. At the moment I'm baking both diffuse and lighting into a complete map that works for now. But if I wanted to separate the diffuse and shadows/gi, is there a way to specify the uv channel being used in SF?

    For reflections I've gotten cubemaps to work, but I'm also looking at this BPCEM (Box Projection Cubemap Environ Mapping Test) which I got to work through the shader supplied on the forum, but I'd love to integrate it into SF. The last reflection option being SSR (screen space reflections) which I think it something outside of this package and would require another unity asset to pull off. But that should just work right over top of the SF shaders.

    $SF_basic_material_003.jpg

    crit my shader if you think there's something I've setup wrong.

    cheers
     
  18. LennardF

    LennardF

    Joined:
    Apr 26, 2014
    Posts:
    19
    Last edited: Apr 26, 2014
  19. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Is there a SF cookbook to help with special shaders like Sub-Surface Skin etc?
     
  20. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    +1 to this

    the Custom Blinn-Phong tutorial is a great step in teaching some basics of assembling a shader, https://www.youtube.com/watch?v=EjCXwV0YYdU
    But it would be fantastic to have some re creations of more favorite shaders to then pick apart, add or remove pieces as needed. I love the node system to shader creation, but as a visual artist I'm struggling to make sense of which nodes need to be used where.
     
  21. neroziros

    neroziros

    Joined:
    Aug 25, 2012
    Posts:
    129
    Last edited: Apr 27, 2014
  22. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    As long as you remember that UDK shaders are tangent space, I fully recommend you just google UDK tutorials. Most of the nodes save for a handful have the same name and are fully SF compatible.
     
  23. Deleted User

    Deleted User

    Guest

    Figured out a temporary solution for getting normal maps to work with terrain. Replace this line (note that this line is in 2 places, so replace both):
    Code (csharp):
    1. float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals
    With:
    Code (csharp):
    1. float3 normalDirection = normalize( normalLocal )); // Perturbed normals
    And the normal maps should work, though I'm not entirely sure if they're accurate or not.
     
  24. donzen

    donzen

    Joined:
    Oct 24, 2009
    Posts:
    54
    Last edited: Apr 27, 2014
  25. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    If you want to use a texture to control the glossiness, just replace the Gloss slider with a texture, connect the R channel to the multiply A input, and you should be set :)

    The posterize node is set to a rather low steps value, you might want it to be slightly higher in order to see the effects of your gloss better
     
  26. Deleted User

    Deleted User

    Guest

    Oh, looks like you also have to get the UVs from the Splat input rather than the normals for the splat tile scale parameter to work for the normals.

    i.e., replace
    Code (csharp):
    1. tex2D(_Normal0,TRANSFORM_TEX(node_#.rg, _Normal0))).rgb
    with
    Code (csharp):
    1. tex2D(_Normal0,TRANSFORM_TEX(node_#.rg, _Splat0))).rgb
    Any chance you could look into making this a bit easier to do in Shader Forge at some point, Ace?
     
    Last edited by a moderator: Apr 28, 2014
  27. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I'm currently going through a lot of personal issues, so I won't be able to update Shader Forge, nor respond to all requests for another week, possibly more. I will try to make sure I read it all, but I can't guarantee a response.

    I hope you can help each other out in the meantime, sorry for any inconvenience caused by this
     
  28. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    Good luck with everything that's going on. I hope things work out for you as best they can.
     
  29. FreakForFreedom

    FreakForFreedom

    Joined:
    Jan 22, 2013
    Posts:
    156
    I'm not sure, but I don't think it is possible. Would love to see it possible, though. :)
     
  30. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    It's "possible" but only in really hacky ways right now and it's kinda limited. You're really better off using dedicated image effects for that.
     
  31. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    is there a way to make the face normal look at camera like a particle system?
     
  32. donzen

    donzen

    Joined:
    Oct 24, 2009
    Posts:
    54
    You can use a plane and set it as child of the camera, is not the better way, but should works.
     
  33. Beep_Beep

    Beep_Beep

    Joined:
    Jul 4, 2013
    Posts:
    14
    Hello, how to make this shader?
    Thank you very much! :)
    $HowShader.jpg
     
  34. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Set lighting to custom, and the light count to single directional, and do this:

     
  35. Beep_Beep

    Beep_Beep

    Joined:
    Jul 4, 2013
    Posts:
    14
    It works! Thanks! ;)
     
  36. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    Hi i'm relatively new in shader forge, i play with the vertex animation shader given in the exemples i actually need it for a project but i wan't to modify it to expose the uv parameter of the panner node in the unity editor to choose the direction of the glow. I tryed somes thing but noting work.

    Thanks and it seem to be a really great product.
     
  37. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    This should help you get started: http://acegikmo.com/shaderforge/wiki/index.php?title=UV_Rotation_&_Panning
     
  38. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    hooo great thanks !
     
  39. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
  40. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
  41. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Deferred lighting is pretty much ready now!
    However, beta 0.33 will most likely be quite unstable when it's out, so be sure to have your version control ready :)
    I'll of course try and fix any issues as fast as possible when/if they were to pop up.

    This is a single quad using a Deferred Shader Forge shader, with 24 real-time point lights:


    There are also two new nodes, for making boolean/toggle/switch/checkbox properties. Note that these are active, not static switches, meaning that it'll process both inputs. So don't use this for optimization, use it for things you want to enable/disable in real-time.

    Mind that deferred pre-pass lighting is not a solution to all problems. While you are able to use a ton of real-time lights, you will also be much more limited in terms of lighting your shader.

    Here's a summary of what's new and how deferred affects what's possible :)


    It should definitely be out this week!
     
  42. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    That looks great! I was sorry to hear of recent troubles but it seems like it hasnt stopped you creating your usual superlative efforts, great to see this tool continually improving!

    Regarding no custom lighting in deferred, the pbr framework I use, Lux, (I have skyshop and use the tools as they are excellent but refer to Lux for the actual shading) seems to implement custom lighting for deferred by altering the internal prepass but I think these custom models get rendered in forward - the framework uses a choice of blinn phong and cook torrance as standard BDRF as standard, a particular BDRF helped with alterations to internal prepass (iirc) and I hope to implement a probably sparingly used Oren Nayar using the same method

    In this manner it was possible to get these working within the framework that supports both deferred and forward rendering with some fiddling about - Fully aware a lot of your focus must be on U5 right now as your tool could be coming increasingly essential, i was wondering if additional flexibility might be available in future (Theres really no point or rush before U5 has settled really I think), im not sure how it might be done but at some point some support of lux in future, as the only open source pbr approach and freely available pbr approach that can remain agile despite U5's oncoming self-made pbr integration, would be really great. Dont see this as a feature request or really anything other than something to ponder right now, it's just something that i'd really look forwards to.

    I've even found that as water would be rendered in forward much removed from any particular pbr implementation, shaderforge is going to give me the opportunity to write the water shader (Or shaders - mixed BRDF wet surfaces, shallow water, river water and ocean water) ive been researching as if mad for 6 months now, and very much looking forward to it, i couldnt even dream of figuring out how to do it before this so cheers for your continuing hard work
     
  43. showoff

    showoff

    Joined:
    Apr 28, 2009
    Posts:
    273
    How can I create a basic shader for unity psm on psvita. Every shader only comes out black
     
  44. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    Yes! Toggle switches :D
     
  45. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,202
    Is it possible to create a tessellation shader similar to Unity Tessellation shader, where not only can I control the edge lengths but also the smoothness? This is for a character in which I like to smooth the silhouette. Maybe I need to use the DX11 Displacement with my normal map, but I'm not sure what nodes I need to connect to achieve my desired effect. Any thoughts would be great...
     
  46. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Ooooooh I was expecting static switches to do One 4 all shaders... like Unity 5 new PBL shaders. You have planned to build static switches in the future?

    P.D: Nice new features at all, really liked the new deferred support!
     
  47. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    It would indeed be very valuable and I know for a fact that the author is aware of the request; it is really a matter of him finding the time to implement Edge Length Tessellation. Let's keep our fingers crossed! :)
     
  48. Leight

    Leight

    Joined:
    Feb 27, 2014
    Posts:
    8
    Hi!
    Firstly, thanx for amazing tool - this really helps to make unity's default eyes-bleeding graphics much more better :)
    I'd like to ask few questions:

    1) How can i use movie texture as alpha channel in my shader?
    For instance, i have premade grayscale anim texture (movie texture) and would like to use it as alpha clip.

    2) Can you advise some shader making tutorials(with theoretical part)?.Material creation always wasn't my strong side, but i need to achieve some physically accurate(as much as possible) reflective shader (somth like http://gamerliving.net/wp-content/uploads/2013/12/Forza-Motorsport-5-27.jpg ).
    For now all my attempts to make material intuitively was unsiutable quiality.
    I also tried to search for some physically based explanation(for example some formulas and constants for different materials) but found nothing suitable.
     
  49. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
  50. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    I have a Specular Map plugged into the Specular node, and while it shows the glossiness in the SF editor's preview, it does not show any amount of glossiness in the Unity editor. I've equipped the appropriate compiled shader to the mesh and made sure the Specular Map was added in the Unity editor, but to no avail. I'm not sure what the inconsistency could be.