Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  3. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Strumpy Shader Editor [Now Open Source]

Discussion in 'Works In Progress' started by Tim-C, Aug 2, 2010.

  1. Silver

    Silver

    Joined:
    Nov 8, 2009
    Posts:
    38
    to what level is the similarity between this editor and the UDK's? I know UDK's is more complicated and advanced shader, but if i followed the tutorials for the UDK's editor sometimes i can not find the corresponding function or operation in your editor.
     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    I don't have the UDK (I'm on a mac) so I can't say. The best thing to do if you feel there is a node missing or some functionality you would like added is to post here and I'll do my best to add the functionality if it can be done / fits the design of the shader editor. My goal would be to have any UDK shader be able to be implemented in this editor.
     
  3. SophieHoulden

    SophieHoulden

    Joined:
    Mar 19, 2009
    Posts:
    19
    just want to say thanks so much for making this, I got round to playing with it today and have had ridiculous amounts of fun.

    [​IMG]
     
  4. Clamps

    Clamps

    Joined:
    Nov 7, 2009
    Posts:
    220
  5. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    Hi clamps,

    To do this you need to do an offset sample of what lies behind the object. The best way to do this in unity is by using a 'GrabPass'. Support for this feature is pending in the shader editor (as in I wrote it for beta 2 last night, and am still testing it). You should have the functionality in the next few days.
     
  6. Clamps

    Clamps

    Joined:
    Nov 7, 2009
    Posts:
    220
    Now that was a fast reply.

    Thanks stramit. I can't wait to get my hands on that.
     
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    The more people that make shaders the happier I am... graphics is such a fun place to be!
     
  8. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    Hi all,
    Congratulations Stramit for your work, you're giving us a really nice tool that will make us more productive.

    Here are some features requests that you probably thought of, but anyway :

    - Multi-Node selection like in the scene view by clicking (LMB) and dragging.

    - Duplicate a node or selection with CTRL + D.

    - Navigation (panning) in the shader graph with Middle Mouse Button. (From your last screenshot, it seems that you already take care of the navigation as there no more scrollbars ??)

    - Shortcuts in the shader graph window for creating the most used nodes (like in UDK). Like for example Middle Mouse Button down + M = Multiply node, MMB down + S = Splat node etc. I know that you've implemented the right click for the node selection panel but shortcuts is handy.

    - Container for a group of selected nodes for organisation and space saving. Example : I've got my "Über mega toon shader" that consist of 65 nodes interconnected etc, and i want to organize it by creating groups corresponding to the Diffuse part, Normals or whatever, i select the nodes that i want to group in a container, push the magic button "container" or use a shortcut :wink:. Then the magic happens, a frame is surrounding my previously selected nodes, a name for the container is editable on top on the frame, i can expand and collapse a container (that's cool yes), i can move a container by clicking on his name and dragging, duplicate save etc. This is all inspired by the Maya container feature in the Hypergrah and UDK, it's very enjoyable and productive friendly.

    Again, thank you Stramit, your work is very much appreciated.

    Best regards.
    Sam.
     
  9. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    Beta 2.1
    Multiple major feature updates and improvements. See the changelog for information.

    Contributers
    Stramit
    Texel

    [​IMG]

    Important Note:
    Due to a major refactor of the node infrastructure, old graphs are not 100% compatible with the new version. When you load a graph from the old version of the editor it should load (if it doesn't raise a bug and PM me the graph!), but the links between nodes will be removed, and the default properties of the nodes will be reset. If you have complex graphs I strongly recommend either taking a a screenshot before upgrading (so you know where the links went). The process is relatively painless, but unfortunately it is manual :(

    Documentation
    Remember to check out Texel's documentation here. It is not updated specifically for the new release yet, but it will be soon enough and the fundamentals remain the same.

    [​IMG]

    Major (user) functionality changes:
    -Nodes are now created using a right click context menu
    -Delete links by right clicking on them
    -Preview window can be dragged to rotate
    -Default mesh support (cube, sphere, capsule, cylinder, plane)
    -Preview node has a toggle-able background texture (good for transparency)
    -Grab pass support - see the example Distortion shader
    *Check the release notes for more detailed info*

    Release Notes
    -Rework node system to use id's instead of names / have separate display names.
    - Bezier curves for node channels.
    -Delete key to delete nodes.
    -Add function node (backend)
    -Swizzle node
    -Cull / texkill / clip support
    -Ability to set more render flags
    -Right click context menu for adding nodes
    -UV2 support
    -Refactor shader temporary files to live in a more reasonable location
    -Depth biased alpha support (you will need to ensure that your camera is configured to write depth / normals)
    -Default mesh's now available in preview
    -Refactor node interfaces
    -Update preview node to work by mousedrag
    -Editor area significantly improved
    -Multiple input nodes of the same type can share names (only one will be added to the shader)
    -Trim spaces from input node names so that shader compile will not break
    -Scale node width based on display name
    -Vertex shader support via the 'struct node' added. Position modification is still pending
    -Matrix support (you will need to pass in matrices via script, just like you always had to)
    -Simple reflection node added / World normal added
    -Raw mesh UV input added (use this if you do not want to use too many vertex interpolators)
    -Improve tex nodes to only contribute to the shader if their output is used
    -Grabpass support added (see the distortion example shader)
    -Add normalized [0,1] screen position node
    -Right click to delete node links
    -Option to display a background on the preview node. Useful for distortion / transparency effects.
    -Middle mouse button to scroll
    -Misc example graphs added
    -Misc bug fixes

    There are whole heap of other things that are too small to mention here also...

    [​IMG]

    I say jump in and have a go. As always feedback / bug reports is always welcome. I am sure a few bugs slipped through.
     

    Attached Files:

  10. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    Thank you for the kind words Sam. Some of these features are in Beta 2, and some are not. There are some great ideas there for Beta 3! I'll make sure I have a close look and see which will work and not work but there is definitely a subset that will be included in the next major release.
     
  11. maxfax2009

    maxfax2009

    Joined:
    Feb 4, 2009
    Posts:
    410
    Great work stramit :) you rock!
     
  12. zebishop

    zebishop

    Joined:
    Jun 17, 2010
    Posts:
    2
    Many thanks to you for giving the unity community this great tool, it's really awesome.
     
  13. Silver

    Silver

    Joined:
    Nov 8, 2009
    Posts:
    38
    Really cant find enough words to thank you :D
    amazing new stuff added.
     
  14. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    stramit wrote:
    You made my day ! Thanks.


    One more request by the way :
    Adding a confirmation box when pushing the "new graph" button, as i'm sure i'm not the only one who had lost his work by accident missing the "update shader" button :roll:.

    Sam.
     
  15. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    214
    Cool stuff indeed!

    How is this tool going to be licensed though? Free, FOSS, commercial?
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,223
    Untiy should pay this dude and support the visual shader editor. Making this editor standart to Unity3. ^^
    Keep the good work dude, pretty awesome!
     
  17. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,248
    Agreed.
     
  18. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    645
    I second that! :)
     
  19. tigershan

    tigershan

    Joined:
    Jul 29, 2010
    Posts:
    72
    This is a great tool. I am not sure what I did wrong with 4 RGBA splat map, some reason I am having trouble splat fourth channel, maybe I didn't specify the splat(xyzw) values correctly. But anyways, here is the 2 splat using alpha with bumpmap and specular map, thought I did give something back using this great tool
     

    Attached Files:

  20. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    It's currently free, but not open source. I don't have any plans to charge for the tool currently, but if I lost my job / something bad happened in my life this could change.
     
  21. loken

    loken

    Joined:
    Mar 25, 2009
    Posts:
    109
    Float4 Input Node seems broken?

    I get a parsing error from the console whenever I try to use it.

    Initially discovered this when trying to recreate the Double Vision shader from the tutorial.
     
  22. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    This is fixed. The release has been bumped to 2.1 and can be found here.
     
  23. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    With the number of texture samplers you are using it is possible that (because you are using the base type) that there are too many vertex interpolates going from the vertex shader to the fragment shader (you are only aloud 8 in SM2.0 and 10 in SM3.0). Try changing the shader model to SM3.0 this should get you 2 more channels straight up. if you still need more instead of using the implicit material UV like you are now use the mesh UV input for all the sampler inputs. This will only add one interpolator from the vertex shader.
     
  24. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    Hi Stramit,

    - Whenever i check the "Draw Background" box, the preview mesh disappear. It seems that the background image is indeed in the foreground.

    - I don't seem to have a simple specular node to work and have influence on the mesh, i tried plug in a spec image alone and a spec image multiply by a Float Const. Am i missing something ?


    Best regards.
    Sam.
     
  25. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    did you use the above shown path for specular with SpecularMap -> Tex2D -> Specular input on surf shader when it didn't work?
     
  26. JPasek

    JPasek

    Joined:
    May 14, 2009
    Posts:
    8
    Hi Stramit

    I can't seem to see any previews. I have this error in my console:

    [EDIT]

    Creating a brand new project and importing the package seemed to fix the problem. Such are the woes of betas I suppose.

    Cheers
     
  27. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44

    Hi Dreamora,

    i used sampler2D > Text2D > RGBA instead of alpha because i'm using a colored specular map, and the same setup multiplied by a constant float and no result.

    Does the specular setup works ok for you ?

    Sam.
     
  28. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    what do you mean with rgba instead of alpha?
    as you see in the image a few posts up as an example you would do neither, you would push the output of the tex2d into the specular input of the surface shader system.

    how much a multiply with a float is going to help or what impact it has likely depends on what you multiply exactly etc
     
  29. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    If you 're refering to the TigerShan post, you can see that he's outputting the alpha channel from his tex2D, but as i said i'm outputting RGBA as i'm using colored map. And of course, my node is plugged in the surface shader lol !

    How would you implement a SpecPower ?

    Sam.
     
  30. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    Specular power is being handled by Specular, where the Specular Color is being handled by gloss (Whereas, traditionally, it is the other way around)

    [​IMG]

    The editor calculates the specular exponent based on the half input from specular, then multiplies it by the half3 color from gloss. Bear in mind that it's also scaling by 128, as opposed to the more standard 64.
    Code (csharp):
    1. float3 spec = pow (nh, s.Specular*128.0) * s.Gloss;
    This all being in contrast to the builtin Unity lighting models, which only support constant specular colors.
     
  31. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    Were you in an iPhone / android project? The ability to create render textures gets disabled. I have a check in to see if render textures are supported, but it looks like it still comes back as true if your hardware supports it but your projects settings do not. I will have to investigate this issue more closely.

    That is very odd, the background preview mesh is being drawn in the queue Background-999 (so queue 1!). Is anyone else seeing this?

    SamSam, did Texel's post clear up your troubles? If not please post a screenshot of your graph, it makes it much easier to help you out!
     
  32. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    Yep, I agree that the way the editor id doing it is 'not correct' but it was done this way to maintain consistency with the unity built in shaders.

    From lighting.gcing
    Code (csharp):
    1.  
    2. float spec = pow (nh, s.Specular*128.0) * s.Gloss;
    3.  
    Maybe I should just change it to be 'correct' in the next release? It might cut down some confusion, but then it might also add some...
     
  33. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    Thank you for the explanation Texel.

    Sam.
     
  34. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    Texel explanation help me to understand the way specular is handled by unity. I'm not an shader expert, i 'm learning and have little experience with Unreal shader/material editor that i try to replicate in your shader editor.

    Sam.
     
  35. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    Cool! It's good you are having a go and learning to do shaders! Don't hesitate to ask questions even if it's just stuff like 'how do I do x', and post graphs when you need help. I'll be happy to help (and I'm sure Texel will as well)!
     
  36. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    506

    great going, great improvements.
    thanks
    rahu
     
  37. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    In an effort to improve the readability of the graphs (and to make the new documentation easier to follow), I've implemented comments!

    [​IMG]

    (Click for a larger more complex example)

    Should be included in the next beta release (which stramit claimed should within the next two days) pending any problems. (aswell as a few fixes/usability improvements)

    I'm not quite set on how they are working/placement, if anyone has any suggestions they would be more then welcome.
     
  38. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    This is a really nice addition to an already brilliant system.
     
  39. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    Forgot about filling SamSam's request:

    [​IMG]
     
  40. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    Yes indeed... the number of times i've hit 'new' instead of 'update'... a lifesaver!
     
  41. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    1,939
    Sweet work Texel! I really like the comments, they make the graphs much more usable and help people know what is going on with a given shader!
     
  42. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    Since U3 beta5 at very least, render textures work fine with iPhone Pro.
    Non pro might potentially get them disabled (but that should be the case on the desktop too as RT were mentioned to remain a Pro only feature)
     
  43. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    Hi all,

    I'm trying to get my head around the multitude of nodes and seem to be getting swamped! Lol!

    I'm trying to create a TV Static effect. I have a few textures of black and white noise but am unsure how to actually create the effect I'm after.

    I realise this is not the place to request individual shader assistance, but if someone could help out with implementation via here or PM that would be great.

    Thanks in advance,
    Matt.
     
  44. dolphin boy

    dolphin boy

    Joined:
    Nov 11, 2008
    Posts:
    29
    INCREDIBLE!!

    I love it
     
  45. capnbubs

    capnbubs

    Joined:
    Jan 26, 2009
    Posts:
    85
    I'm trying to add normal mapping to the triplanar shader, but I'm having problems because the normal map is reversed on the opposite side of the uv projection. This is leading to the surface being hit from the wrong direction on half of the object.

    Please does anybody have any ideas on how I can get around this?
     
  46. Waz

    Waz

    Joined:
    May 1, 2010
    Posts:
    245
    Wow! This tool brings Shader "programming" to all of us!

    Could I ask that instead of having Save and Load, and the various warning dialogs they entail, would it not fit better (if possible) to just create the assets based on the shader name, and fully automate the saving process?

    I understand the shader itself takes time to generate, but the graph saving and loading should be automatable - in the same way that when you modify a Material asset there is no manual "Save" and "Load" step (yet the .mat file is updated as-needed).

    Totally awesome without this though!
     
  47. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,090
    THIS IS AMAZING! Just watched your video! It's perfect! I can't say I could imagine a shader editor that fits the Unity feel and keeps its intuitive workflow better than you did. I can't wait to get my hands on it when Unity 3 is launched! Great work!
     
  48. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    [​IMG]

    I the event it isn't clear, the subtract node contains the blend weights, with the backfaces being flipped.

    Click the image for the graph of another implementation of Triplanar texturing I did, with blend biasing and normal mapping, though it has your same issue. (Including the step/subtracts would fix that though)

    The easiest way I've found of doing it is to just layer the noise texture over itself, creating "different enough" UV's by offsetting with largely scaled values of time (As pictured)

    [​IMG]

    While this is the simpler solution (and could be simplified further using UV-pan nodes, thinking about it), it suffers from visibly repeating noise patterns.

    There is another alternate approach, less dependent on frame times, that uses indirection:

    [​IMG]

    The latter is less dependent on framerate, but requires an additional texture/texture read (though to be honest it looks better)

    Both examples are linked to from the images.
     
  49. laurie

    laurie

    Joined:
    Aug 31, 2009
    Posts:
    638
    *smile* what better justification for the addition of node comments could there be? It's now easier to explain how to achieve shader effects by posting a screen-shot of a commented shader graph than it is to write the explanation long-hand ;-)

    Can't wait to get my hands on a copy of U3 and give this a try.
     
  50. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    Texel, many thanks for the graphs, it helps with the learning.

    This truly is a brilliant tool!

    Best Regards,
    Matt.