Search Unity

Shader Forge - A visual, node-based shader editor

Discussion in 'Works In Progress - Archive' started by Acegikmo, Jul 20, 2013.

Thread Status:
Not open for further replies.
  1. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Fantastic. I'll be buying this the absolute minute it hits the asset store then. This is definitely going to fill a huge void in the node based shader environment on the asset store. I get the feeling this is going to make you a pretty decent amount of money.
     
  2. Mikael-Persson

    Mikael-Persson

    Joined:
    Jul 14, 2011
    Posts:
    29
    Hmm.. The thing is right now I've got the sides of the cube sharing UV space. Where only two sides are mapped and the rest are using these UV coords. So straight UV offset won't work. But as you are saying world coords, is it possible to sample the mesh in world space and tell that coordinate to use a specific texture?
     
  3. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    Hey I have a feature request, I'm not sure if it's possible to implement but it'd be a great feature if you could.

    I'd like the ability to turn off different maps and features of a shader per material, for example if I had a diffuse with normal map. I'd like the ability per material to disable the normal map pass completely to gain the extra performance. I've seen this shown off 'somewhere' in Unity but I can't remember where.
     
  4. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    It's not clear, has this been release or is it available in beta? I hear some people talking about support issues, others about when it will be released? If there is a beta available, how can I get it, thanks.
     
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Some people got into the alpha over on Polycount, but there'll be a paid beta coming out in a couple weeks apparently.
     
  6. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    You can use the world position node and extract the Y and Z coords (Or others) as UVs for a panning mask, and pass in the panning direction as a Vector3 (On connection) and pass in a float value that updates over time (While it should animate)


    It's not really possible to do that per-material, as it will compile different shaders regardless. It's not to gain extra performance, it's a time saver in terms of work needed. It's usually used for shaders that you want to be very similar, but want to remove/add just a single feature.
    It might come in a post-release update, but there are no plans for it at the moment!
     
  7. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    So, I suppose this is the first official set of videos of Shader Forge in action :)
    I was at a Unity event yesterday and gave an improvised talk on Shader Forge, and showcased a bit how it worked, which you guys might find interesting!





     
  8. Mikael-Persson

    Mikael-Persson

    Joined:
    Jul 14, 2011
    Posts:
    29
    Thanks for the additional explanation! I'll get my hands dirty now and hopefully we'll solve it.

    Funny coincidence that your youtube demo touches upon what I'm trying to achieve!
     
    Last edited: Dec 12, 2013
  9. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,081
    HI Acegikmo,

    Apologies if this has been asked in the thread before, but how optimal will the shaders be once constructed? Strumpy was a capable editor but produced some unoptimized stuff, especially when run on mobile devices.
     
  10. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    It depends on how you create your shaders and how advanced they are, but it should be fine in general as long as they're unlit or use a very simple lighting model :)
    The biggest drawback is not being able to control what is done per-vertex and what is done per-fragment, but I'm hoping to do a post-release update addressing that.
     
  11. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    The no-light demo scene sold me. Really really great stuff.
     
  12. Ravart

    Ravart

    Joined:
    Mar 9, 2011
    Posts:
    42
    Is RAMP with a texture possible? Do you have an example`? Cheers, great project!
     
  13. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,081
    How close in relationship is SF to UDK's editor? Could tutorials and principles in UDK be easily transferred to use in SF?
     
  14. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    I can't speak from experience, but it seems to have (roughly) the same nodes and same node behaviour as UDK's material editor does, including important things like light direction.
     
  15. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294


    It should behave similarly, but with some minor differences. For instance, Vectors in UDK are all in Tangent space I believe, whereas in SF they are all in world space, unless used in the Normal input, in which case it's in tangent space.

    I've planned to make a video on the differences between the UDK mat ed and Shader Forge later :)
     
  16. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Would it be possible to use object space normal maps with Shader Forge?
     
  17. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Currently there's no way of selecting which normal type to use. It is possible to do it using the custom lighting, but that's a bit of a hassle :)
    If you're on the alpha/beta, you can add a request on UserEcho
     
  18. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    How do you get in on the alpha/beta?
     
  19. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Signups have sadly been closed simply because it's going to release in a few weeks :)
    I'll add your request to UserEcho, you can later vote on it once it goes public!
     
  20. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    Would it be possible to create a radiel fog shader ANd image effect shaders using Shader Forge?
     
  21. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    SF doesn't have many options available for reading from the depth buffer, which is quite limiting when it comes to radial volume fog.

    However, it is a planned feature, and so is post-FX shader creation in SF :)
     
  22. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    For those who missed it on the previous page:

     
  23. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    This will be really awesome, especially being able to make post-FX shaders later down the road.
     
  24. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    I don't see the custom lighting entry on the master node, did you remove it? the light nodes are still there. I was trying to make a custom baked ambient occlusion shader, turn the ambient light off and use the ambient occlusion map as a sort of "light" map, and the light being controlled by the ambient light node. I made the shader but now I'm wondering where custom lighting has been hidden/moved to
     
    Last edited: Dec 13, 2013
  25. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    If you set the shader to unlit, emissive will act somewhat like a custom light node, but I will have to change that in the future, because it's a bit unintuitive. Perhaps change labels :)
     
  26. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    Ah see I would have done that and that would normally work, however I also want to be able to light up dark areas with a flashlight and dynamic light sources. For that we need a Custom Lighting thing. you had it in earlier versions of Shader Forge but it seems to have been removed
     
  27. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    That would still work. There is a custom light shader in the example package, one of the first two material examples in the row of spheres :)
     
  28. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    edit: fixed first issue. I've managed to have the shader lit, and it's all working as it should but my normal maps don't work and make the lighting all glitchy. Is this a known bug?

    edit: it looks like Shader Forge has issues with normal maps on meshes that utilise the second UV channel. This is a bug


    Here is the shader in question
     
    Last edited: Dec 13, 2013
  29. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    If you could keep "Emission" separate from "Custom Lighting" it would be great.
    It would make editing more intuitive to control them both separately I think.
    Putting more thoughts into this while I am typing I think when you do an Unlit shader the Diffuse slot should more or less equal the "Custom Lighting" node.
    If you plug pure colors in there - well you get an Unlit shader.
    If you however create your own lighting calculations and plug them into the Diffuse - well you get custom lighting.
    Plus Emission on top if needed.
     
  30. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Your "Normal" Texture 2D node is probably not marked as a normal map texture internally. You need to assign a normal map texture to it in the shader to flag it :)

    (This behaviour has been improved in 0.15 by the way, as of 0.15 there's a checkbox to select if it should be a normal map or not)
     
  31. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    when u release this tool?
     
  32. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    The beta will go live on the asset store as a pre-release in about two weeks / a month!
     
  33. Naxum

    Naxum

    Joined:
    Nov 21, 2012
    Posts:
    4
    Hello! I've been using Shader Forge for a while now, absolutely love it and will totally be purchasing a copy once it goes public!

    I'm not really certain where to ask questions about just making shaders, so I guess I'll put it here.

    I found someone's shader code online that moves an objects vertices downwards depending on screen depth to emulate being on a cylindrical world like Animal Crossing.

    How could I emulate something like this in Shader Forge?
    I found the Transform node that uses MVP, but not positive how to set vertex positions like is done here.

    Code I want to emulate:
    Code (csharp):
    1. Output vert(Input v)
    2. {
    3.     Output result;
    4.     result.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    5.     result.vertex.y -= result.vertex.z * result.vertex.z *_Offset;
    6.     result.texCoord = v.texCoord;
    7.     return result;
    8. }
     
  34. MettleRobot

    MettleRobot

    Joined:
    Nov 5, 2013
    Posts:
    3
    I followed along with the Rock/Moss shader example at the end of the presentation in those videos. Very useful info in there. But it stopped before explaining the normal map part.

    I've got normal maps on there blending, but I'd like it to use the rock normal map to break up the straight line transition from one texture to another. The same way a normal map effects the look of Fresnel. Is this possible?

    I made a mockup in 3ds max of what I was hoping for.
     

    Attached Files:

  35. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Here's an example for a planet-like surface!
    If you want a cylindrical one, you can simply use the X or Z outputs from the View Pos and World Pos nodes, instead of XYZ :)




    Check the box that says "Perturbed" in the normal direction node :)
     
  36. MettleRobot

    MettleRobot

    Joined:
    Nov 5, 2013
    Posts:
    3
    Awesome, thanks. I did try that earlier but it broke the shader. So I turned it off again and didn't look back. Didn't realize that's what perturbed meant.

    I back tracked and figured out it wasn't working because I was blending two normal maps using the same normal direction process. It works if I add a second set of Normal Direction/Comp Mask/Clamp 0-1/Round nodes with Perturbed switched off.

    I've attached the end result, I'm really happy with Shader Forge :D
     

    Attached Files:

  37. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Looks great!
    Also, Beta 0.15 should release in a few hours :)
     
  38. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Very cool grass effect there on top of stone.
     
  39. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    Does that mean i can get my hands on it already or is this for people who applied to a beta program already and i didn't notice? I am looking forward to purchase it when i t comes out... I am asking because i need to test a few things and need a custom shader for it and the shader guru on the team is to busy to bother with my idea. Also i don't want to mess with old versions of unity and Strumpys shader editor.

    I'm pretty sure Shaderforge will be a big success on the assetstore, i can already see you on the Bahamas drinking cocktails ;)
     
  40. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    It means that those who have already signed up for alpha/beta will get it.
    However, it will be the last private test version before the first public pre-release on the asset store :)

    Glad you're excited about it!

    Also, "on the Bahamas drinking cocktails"?
    Pft, I'd rather stay indoors working on an indie game, Shader Forge, or my next Unity extension full-time ;)
     
  41. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Beta 0.15 is now finally out for all the testers! This is the last private test version before going live on the asset store with the pre-release :)

    It is now time to focus 100% on bugfixing and polish, before it goes live, to make sure it's as tight as possible!

    Massive changelog:

    • You can now connect to Outline Width and Outline Color to make a simple toon shader (Does not work with convex hard edges)
    • The transform node is now much more intuitive. The new version has two dropdowns, From and To, where you can select World, Local, Tangent or View. Note that your old shaders using the transform node will either break or be reset.
    • New hotkeys to use with selected nodes:
    • - Ctrl+D (Duplicate)
    • - Ctrl+C (Copy)
    • - Ctrl+V (Paste) (Also works cross-shader, so you can open a new shader and paste in there)
    • - Ctrl+X (Cut)
    • You can now comment on nodes by right-clicking on them and selecting "Edit Comment"
    • You can now right-click on nodes both in the node area and the browser, to go directly to their online documentation
    • Added node: Scene Color (Can be used to get the background color or for manual refraction)
    • Shader Forge will now use the tiling and offset specified in the material
    • The material inspector now has buttons to open the shader in SF, open the CG shader, and open the compiled shader
    • A scrollbar is now added to the shader settings / property window when it overextends
    • The component mask node should now be foolproof (As in, if you connect a Vector2 you shouldn't be able to select the B and A channels etc)
    • You can now specify per-shader fog overrides for Fog Mode, Fog Color, Fog Density and Fog Near/Far range
    • A preset for Screen blending has been added (This will break your old shaders using Multiplicative or Custom blending)
    • The camera can now be moved with middle mouse button in addition to the regular camera movement system
    • Texture nodes will now be drawn with transparency only when they are marked as using the alpha channel for transparency
    • The Time node now has an icon
    • Texture2D nodes now have a dropdown to select one of the built-in default colors, when no texture is assiged: White, Gray, Black or Bump (Flat normal, for normal maps)
    • Texture2D nodes now have a checkbox to select whether or not it's a normal map. This will be assigned automatically when assigning textures, otherwise it needs to be checked manually
    • Added a frame limiter (At roughly 40 fps) to prevent Shader Forge from eating all the CPU power it can get
    • You can now do arithmetic between nodes of different component counts (For example, multiplying a Vector2 with a Vector4)
    • You can no longer delete nodes with backspace, this is now done with ctrl/command+backspace, or the delete key
    • Shader Forge will now tell you to update if opened in a Unity version older than 4.2
    • There is now a checkbox for remapping gloss from linear [0-1] to base-2 exponential [1-2048]. This used to be enabled only for PBL previously, it is now on by default for all shaders
    • Fixed a bug where additional light sources ignored fog
    • Fixed a bug where the default values for Value properties didn't save
    • Fixed a bug where fog was displayed incorrectly when using multiple lights
    • Fixed a bug where you couldn't use colors as specularity when using the PBL lighting mode
    • Fixed a bug where arithmetic nodes were outputting the incorrect vector type when linking pending outputs (before the input nodes were assigned an output type)
    • Fixed a bug where the Desaturate node looked as if it was outputting a Vector3 rather than a Vector1/Value
     
  42. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    Loving some of those changes, I'd still like to see a Custom Lighting master node though. Otherwise great work! :)
     
  43. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    i keep throwing my credit card at the screen.. nothing is happening.
     
  44. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Hahah. Agreed.
     
  45. SOULSSAGA

    SOULSSAGA

    Joined:
    May 6, 2012
    Posts:
    69
    hi Acegikmo !

    MAN - Is it possible to setup a REALTIME REFLECTION Shader with SHADERFORGE ?

    ... I was almost able to do it with the Refraction Node ... Inverting the Refraction dir ... with cam pos...

    MAN ! Now that we have the
    Scene Color Node and SCreen Blending ...

    Is it somehow Possible to make the REALTIME REflection Trick ?

    If you can do it / can you please post The screenshot of the nodes setup ?


    THANKS MILLIONS !



    SOULS

     
  46. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    The cut, copy, paste, duplicate doesn't work for me in the new 0.15 version. Also, was it intentional to stop the delete key from deleting connections? I discovered backspace does it now (might have all along). This is on PC.
     
  47. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
  48. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    I've found a shadow related bug

    There seems to be a dark fringe on edges of shadowed areas, it only appears where the light would 'leak around' in the earlier versions of Shader Forge, here is the bug and my shader that can be used to reproduce the steps

     
  49. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I'm guessing you need to set your dot( N, L ) to Positive instead of Standard.
    (Although I'm a bit confused as for why you're using the PBL lighting as if it was custom lighting)
     
  50. Chaoss

    Chaoss

    Joined:
    Jul 8, 2011
    Posts:
    327
    Aha that fixed it, easy thing to miss. I've had to use PBL because otherwise the light appears really blown out and doesn't darken properly and just looks generally really messed up
     
    Last edited: Dec 18, 2013
Thread Status:
Not open for further replies.