Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. 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. bloobie

    bloobie

    Joined:
    Apr 1, 2010
    Posts:
    13
    hi there

    the shader editor is very cool
    but i have a problem
    i want to create a cut out shader with a specular map and without backface culling
    and the cut out doenst work
    i tried it like this : http://screencast.com/t/iienASBx2DGm but i doenst work (i use png files)
    and the specularity works but the effect is very weak

    maybe someone can help
     
  2. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    647
    For a cut out shader you need to put the transparency into the clip channel.
     
  3. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Yep see the example shader 'clip.sgraph'
     
  4. bloobie

    bloobie

    Joined:
    Apr 1, 2010
    Posts:
    13
    many thx Zomby138 and stramit

    the cut out works fine
    but know i have the problem that the backface culling is on
    in the Master is set it off but its on
    http://screencast.com/t/Tuwu4HIr2

    an idea ?

    many thx
     
  5. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    647
    For me, setting backface culling off works fine.

    So it definitely can work.
     
  6. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    523
    Hi any one here interested in sharing there material created in shader editor with community and improve the program, by making more and more functionality in it.
     
  7. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,083
    Good idea.. i was thinking about that too.
    @stramit : maybe you can put every completed shader/graph file that been posted here on first page (well that if you don't mind)
     
  8. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,855
    Hey everyone, just wanted to share my shader graph that i have been putting together so I can use it for my models... and this one is an all purpose shader...for, well everything. I am still trying to add to it so i can have stuff like mappable reflections on models using alphas but i don't have a pro licence... :( anyway, here is the graph... enjoy.

    and happy thanksgiving...and hopefully someone can expand the use of it...
     

    Attached Files:

  9. Etana

    Etana

    Joined:
    Nov 26, 2010
    Posts:
    3
    Would it be possible to add support for material input? This would reduce complexity of some shaders alot, for example this here, Instead of using FirstTexD and FirstTexN I could just add one material input node with same(?) outputs as master node has as inputs.

    Here is screenshot of blender's nodes with virtually same functionality than what I have in that unity node screenshot, except the curves of course. Curves would be nice addition to SSE ;)

    Also why multiply, subtract and other similar operations does not have arg3 like lerp does? It would make those nodes a bit more useful.:cool:
     
  10. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Beta 3.1
    We debated calling this Beta 4.0... just because of how much goodness has been packed into this release. Massive performance improvements, massive usability updates, prettier nodes, bug fixes, undo / redo support, cut / paste. Enjoy.



    Contributers
    Stramit
    Texel

    Documentation
    Remember to check out Texel's documentation here.
    Planet tutorial by Clamps here

    From Clamps' Planet Tutorial


    Donation
    This project is free for all members of the community. If you are a big studio, or really enjoy using the Shader Editor and would like to donate towards the project we would really appreciate that, the cost of software purchases needed to make this has added up. You can donate via paypal by clicking here.

    Download
    Click the link at the bottom this this post to download.

    Upgrading Notes
    Before upgrading please remove Strumpy Shader Editor 3.0 from your project. Some of the shader editor files have been moved around and it is important to have a clean work area. Back up / move any graphs you would like to keep before deleting SSE 3.0.

    Please back up all of your graph files before upgrading. Graphs from Strumpy Shader Editor 3.0 should be compatible with 3.1 with no modification. If this is not the case contact us immediately either via this thread or PM. Please include a copy of the graph. We do not foresee any issues though.

    Features
    Usability Improvements:
    Fix some bugs with export / export as / load / load as. Works as expected now
    Selection box support
    Copy / Paste
    Node duplicate
    Select all
    Make inputs / outputs easier to click on
    Undo / Redo support
    • Alt + z / Alt + Shift + z - Undo / Redo
    • Command + c / Command + v - Copy / Paste
    • Command + d - Duplicate selection
    • Command + a - Select all

    Performance improvements:
    Graphs now cull nodes / lines that are not on screen. A pass was also done to optimize the internal performance of the graph structures.

    New Nodes
    We are implementing a range of blending nodes at the moment, they should be in next release. We just added a missed node this time.
    • UV Node for vertex shader

    Bug Fixes
    • Allow time node on multiple graphs
    • Misc windowing issues (editor should now preserve state much better)
    • Fix error with rendering queues (if you used a queue minus)
    • Added flag to now allow vertex shaders to have custom shadow pass

    Roadmap
    Beta 3.2 - 3.x
    • Advanced Lighting Sub Graph
    • Fallback Support
    • LOD Support

    Asking for help with shaders
    If you need any help with the shader editor or shaders in general ask away here. We will help where we can!

    Bugs
    It is inevitable that some bugs have slipped though the cracks for this release. If you run into any issues at all post in this thread. The more issues you report the more we can fix. We want this tool to be as usable as possible so any / all feedback is welcome!

    Some shaders from the thread:
    A water shader with distortion by rea:


    A snow shader (amount of snow changes based on normal) by Svyatoslav:
     

    Attached Files:

    Last edited: Nov 27, 2010
  11. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    418
    Hi stramit this editor is really coming along nicely, I am not sure why but the bug I submitted earlier seems to still be there, I cannot do a capital "A" for any name or input I type in the editor. I am on a Windows version and when I do a caps lock or shift + a, it does nothing, lowercase is fine however. Also is there a method for creating a shader that has transparency that can cast/receive shadows like the leaf shaders? Is using the Clip the only way to use transparency at the moment? Thanks for the help, and keep up the good work!
     
  12. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,015
    I need video tutorial.....
     
  13. noradninja

    noradninja

    Joined:
    Nov 12, 2007
    Posts:
    420
    Strumpy, thanks so much for this tool, it is highly appreciated.

    Below is the current shader graph I am working on (Bumped ColoredSpecular Emission Lightmap).

    I want to make sure the graph I have made is the right way to do this (we all know things can work and be inefficient), and I was also wondering, would my current implementation work with the Beast lightmapping, and do I need to do anything special to make the lightmaps use secondary UV's for lightmapping purposes? Everything seems to be working how I want, but I'm new to this aspect of game design...

     
  14. noradninja

    noradninja

    Joined:
    Nov 12, 2007
    Posts:
    420
    Ok...attached is the shader I made using SSE as well as my test project.

    If I build and load this on my iPod Touch 4G, it hangs at the loading screen.

    Even worse, once this happens, NO Unity apps I build (using SSE shaders or not) will run (they all hang at load) on my IPT until I restore my iPod within iTunes!

    What am I doing wrong? All I wanted to do was make a bumped shader with colored spec maps and lightmapping...
     

    Attached Files:

  15. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    We were never able to repro this issue. Can anyone else verify that this is happening for them?

    As for the cutout shaders, we have logged an issue with unity to see if they will be able to incorporate 'clip' handling into their shadow pass. We will put a workaround in the next release until there is a resolution.
     
  16. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    That's looking pretty good. It's a relatively simple graph so there isn't much you can do to improve it.
     
  17. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Not all the iDevices support SM2.0+ (touch 4 should though) and as I don't have access to a deployable iPhone I can not repro this issue and see what is going on.

    In Beta 4.0 we intend to implement full fallback and fixed function support for devices like the iPhone so that the shader editor can be utilised properly for these devices.

    Regardless of this this fact, what you are seeing should never happen. The shader editor doesn't do anything funky, it just generates a surface shader that unity compiles onto multiple platforms. You should probably raise this as a bug with unity (send the scene ect), as this is probably more in their domain then in the domain of the shader editor (could you PM me the ref# when you do this?). If there is anything that can be done in the editor to stop this I will make those changes. But there are too many unknowns for me to even guess as to what is going wrong here.
     
  18. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    418
    OK, I think I narrowed it down more, it seems to be an issue with the Unity Editor or something related to my input as I have tried to rename things in other parts of the editor and the same thing is happening. That is great to hear about the 'clip' handling being put into the shadow pass, I am looking forward to the workaround in the next release in the interim. Again thanks stramit, if I find what is going on with the input stuff I will share it here.
     
  19. WarpedAxiom

    WarpedAxiom

    Joined:
    Oct 27, 2006
    Posts:
    245
    Extremely useful and comprehensive, though I noticed the TriPlanar graph still produces the unsightly pixel lines wherever the texture repeats. I'd really love to have a working TriPlanar shader for complex terrain geometry such as caves and natural bridges.
     
  20. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    764
    I'm trying to duplicate a UDK graph again, and I can't see how to simply display the objects own vectors. In the UDK graph, its done via transforming [0, 0, 1] from Tangent to World, yet the Editor only has O2W and W2O.
     
  21. XRA

    XRA

    Joined:
    Aug 26, 2010
    Posts:
    139
    can anyone explain how to use the Time node? I was following Clamps planet tutorial for setting up UV panning, but nothing ends up panning, also the UV pan shader example graph doesn't pan things... do I need to update something in script?
     
  22. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Are you using pro or non pro? For time to work in the preview we had to implement some interesting workarounds. If you are not using pro and are looking at it in the editor (and the editor it playing), you need to use an exported shader not the editor shader cache shader.
     
  23. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Tangent to word matrix isn't defined for all shader permutations in unity so you can't rely on it being present, hence why there is no node for it. There is a world normal input node that you can use to get interpolated per pixel normal in world space. That is the equivalent of transforming [0,0,1] via the Tangent to World matrix.
     
  24. XRA

    XRA

    Joined:
    Aug 26, 2010
    Posts:
    139
    Non-Pro, It is working I just didn't realize...since I had been using the editor shader cache on a material in order to see it quickly update when launching the game, after exporting to an actual shader it works, thanks!
     
  25. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    No worries. Best non-pro work flow is to set up an exported shader and as you modify it instead of using 'update' just use 'export'. It should keep reexporting over the last 'export as' path. It's pretty quick in the end ;)

    I tested this very briefly but I believe you should also be able to have the editor 'playing' and reexport new shaders over the top and have them update (good for anything using time nodes ect).
     
  26. _-MADMAN-_

    _-MADMAN-_

    Joined:
    Nov 3, 2009
    Posts:
    40
    This plugin is awesome - thank You for sharing this! Is it free for commercial use? Do You have plans to make it commercial in future like shaderfusion? Anyway - Your plugin is much more user-friendly and better then sf.

    Regards,
    Mad
     
  27. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Thanks :D

    It's free for all types of use, and we have no plans to charge for it. If you are a commercial venture it would be nice if you could donate a few $ via the paypal link (in the shader editor menu) to say thanks, we have spent a few dollars ourselves buying all the software we needed to make the editor the best that we could.
     
    Last edited: Dec 1, 2010
  28. arohey

    arohey

    Joined:
    Oct 26, 2010
    Posts:
    2
    This is an amazing tool and couldn't have happen at a better time :) . A few of us finally have some time to get a few projects started and cant wait to use this shader editor. Its just a marvelous visual aid to shader development in unity . We will be deploying to PC but primarily targeting I Devices and while we've read that there will be extra support for I Devices in Beta 4.0 , does this mean they currently are not supported at the moment?
    Awesome work again guys and donations are a must :)
     
  29. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    I believe that iPhone 4+ supports shader model 2.0. So if you write a 2.0 shader in the editor it should work (this hasn't been tested by us very much). If you have an older model iPhone there is currently no nice fallback path available so it will not work.
     
  30. arohey

    arohey

    Joined:
    Oct 26, 2010
    Posts:
    2
    Thank you for the immediate response.. We are targeting 3GS and later ( shader model 2.0) and will do some testing in the following days to come. We will keep you posted and thnx again for the amazing tool
     
  31. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,855
    Hey stramit, is it possible to create shader that will allow to have backfaces with different colours? LIke for the inside of a jacket :)
     
  32. WarpedAxiom

    WarpedAxiom

    Joined:
    Oct 27, 2006
    Posts:
    245
    ... yeah, but what about the TriPlanar graph, you know, I'd just like to, maybe, uhm....
     
  33. pete

    pete

    Joined:
    Jul 21, 2005
    Posts:
    1,648
    Finally got around to checking out the editor. Using the November 26 package, I'm hitting a couple of bugs and I'm sure some user error :)

    Right clicking doesn't bring up the node menu for me. Ctrl+click doesn't do it either. So I haven't been able to do much. OSX 10.5.8 with a lovely mighty mouse.

    This one's a little hard to explain. If I click on a node connector and drag it to nowhere, it never goes away. Even if I close the tab and reopen it, the bezier line is still stuck to the mouse. So there's no way to cancel a connector drag.

    If I switch from pixel to vertex (or simple) while that's happening this line in NodeEditorWindow.cs:
    NodeEditor.Instance.OnGUI( );
    throws a null reference exception and the editor can't continue to function. I'd guess it needs a catch for if there's no node connected to the bezier or something.
     
  34. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    We haven't had time to have a look at whats up with those lines recently. We've been spending our time adding new features to the editor instead of fixing the issue with this demo graph. We will fix it eventually, but it's not super high on our priorities. If I get a spare hour this weekend I'll have a look and upload a fixed graph.
     
  35. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Nope :( Sorry man. If you want different colors you'll have to dupe the mesh and flip it. If you don't mind the same colors then you can turn backface culling off.
     
  36. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    Hi Pete, I've never seen or heard of these issues before with the shader editor. It really sounds like a bad install of the editor to me and some content is missing. Could you creat a new unity project and reimport the package (maybe even redownload it?) Ensure that you have everything marked as import. If that works / doesn't work can you let me know. Also if anyone else is seeing this let me know as well. I have not heard of this issue.
     
  37. pete

    pete

    Joined:
    Jul 21, 2005
    Posts:
    1,648
    Redownloaded and imported into a new project. Same results. Here's a pic of what imports. I'm not sure what more help I can give you. I don't think the middle button scrolling is working as well. Maybe my mouse just sux :) Stinks because it's a really cool project!
     

    Attached Files:

  38. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,026
    I sent you a PM pete, we'll sort this out ;)
     
  39. FatiguedArtist

    FatiguedArtist

    Joined:
    Mar 3, 2010
    Posts:
    38
    Hey, (sorry if this is a repeat question) are there any plans for multi-pass support? I recently had to code a double-pass manually for an outline shader and I feel very sorry for myself :p It would be great to whip up some more complex stuff without having to go ascii.

    Cheers
     
  40. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    @FatiguedArtist

    Unfortunately surface shaders lack actual pass semantics, so you can't have a surface shader that does multiple passes in the traditional sense.

    However, if you increase the size of the material array on the renderer, additional materials, if lacking a submesh, will redraw over the existing mesh. This means you can just assign two materials to the renderer, one for each pass, which is great for things like outline shaders or instance-reflections.

    (Unless you happen to have a better way of handling it, I'm yet to find a way that works with surface shaders in one shader file)
     
  41. FatiguedArtist

    FatiguedArtist

    Joined:
    Mar 3, 2010
    Posts:
    38
    Wicked awesome mega fast response time Texel, that's fantastic.

    Yeah I thought that might be so, as when I tried to manually specify a pass in a strumpy shader, it wouldn't work. However I managed to use a simple grabpass, which allowed me to create an outline I could use separately, and place on an object instantiation (though now I may as well just use that mat on a multi-material mesh, thanks to your advice).

    You wouldn't happen to know a way to get around the 'smoothing issues', that happen with vertex expansion, without re-writing the mesh with a different triangle array would you?
     
  42. WarpedAxiom

    WarpedAxiom

    Joined:
    Oct 27, 2006
    Posts:
    245
    I appreciate your workload. I was just inquiring. You don't need to overwork yourself on my account, but thank you kindly.
     
  43. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,855
    Awww :(...well, i am sure i won't have to worry about it... but if i dupe the mesh, i don't want the cloth sim to mess with it... but hey, still love your shader...
     
  44. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    @Neptune_Imaging:
    $RenderingBackfacesSeperately.png
    Graph

    That's the structure for forking backfaces and lighting them properly, it's fairly straightforward in that you swap things a based on the sign of the viewdirection's z-value, Just be aware your not truly detecting backfaces, but normals pointing towards the camera.
     
  45. MilesD

    MilesD

    Joined:
    Nov 18, 2010
    Posts:
    5
    Hi, I'm pretty new to this shader editor. I have played around with it though and was hoping I could help a friend get some stuff working. He needs to have a Diffuse, Specular, and Lightmap on some objects in his scene. I haven't had a chance to really sit down with him and get a lot of details but my main question is where would I add the Lightmap? I will be able to get more details Sunday if this question is to general.
     
  46. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,598
    If you use beast, you don't add them in the shaders, unity will auto add them when compiling a surface shader
     
  47. pgomid3000

    pgomid3000

    Joined:
    Aug 16, 2010
    Posts:
    19
    How can I build a mirror shader or water shader?
     
    Last edited: Dec 4, 2010
  48. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,083
    use distortion graph as a start...for reflection you can use script from here "http://www.unifycommunity.com/wiki/index.php?title=MirrorReflection2" to generate reflection. you need to add sampler2D node with "_ReflectionTex" as node name and connect the same uv node for the refraction.
     
  49. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363
    can anyone post simple example of cubemap reflective diffuse colored transparent shader to build on?.. i'm pulling off my hairs.. new stuff for me.. :)
     
  50. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,471
    Would you ever share this shader?