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

Strumpy Shader Editor [Now Open Source]

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

  1. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    Ok, idea on previews.

    Why don't - for indie users, at least - you just update on a built-in sphere, when the user hits update? Indie users might not have Render Textures or the GL commands, but since this is specifically to author shaders, who cares?

    Granted, this is easily done by an indie end-user, with a minor amount of work, but I am a game programmer, and am extremely lazy, thus making this "in-scene shader update" a good idea.
     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Beta 3.2
    Small upgrade - blend support / bug fixes mostly

    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.1 from your project. All of the shader editor files have been moved around and tidied up and it is important to have a clean work area. Back up / move any graphs you would like to keep before deleting SSE 3.1.

    Please back up all of your graph files before upgrading. Graphs from Strumpy Shader Editor 3.1 should be compatible with 3.2 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
    Blending Support:

    If you click on the master pixel node you will note that there is a section for blending. If you do not enable transpaency (the transparency button) you will have access to custom blending. Just remember to put anything you want custom blended into the transparent queue! (Default blend mode is One / Zero)

    ColorMask Support:
    If you click on the master pixel node you will note that there is a section for colormasking. Simple select the channels you wish to have masked and they will be (default is all channels output).

    New Nodes
    • Full Mesh UV1/2 (Has all 4 components of the UV available)

    Bug Fixes
    • Fix matrix node to not cause crash
    • Fix crash on changing graph while connecting nodes
    • Fix misc crashes caused by render texture getting in odd state

    Roadmap
    Beta 3.3 - 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!

    Download 3.2a Instead :D
     
    Last edited: Jan 10, 2011
  3. loken

    loken

    Joined:
    Mar 25, 2009
    Posts:
    109
    Was literally working on a project with 3.1 today and thought, "Would be nice to have some blend modes."

    Obviously you overheard my thoughts and released this one just for me. Thanks mate!
     
  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Perfect timing! I was looking for a 3.x compatible replacement for the "Planet Shader" in the wiki, and it looks like Clamp's tutorial + SSE might get me pretty close. Thanks! :)
     
  5. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I'm using SSE for the first time and am following Clamp's new Planet Shader tutorial and have hit my first (minor) issue. I'm at step 4 and after saving my graph I get "inconsistent line errors" for both TempShader.shader and MyNewShader.shader.
     
  6. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    They are just warnings, not errors. Ignore them.
     
  7. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Right, knew that. Just reporting it so stramit can fix this in the future. Incidentally, I'm almost done with the tutorial and have to say I'm really enjoying SSE. :)

    Edit: Finished the Planet Tutorial (awesome tut by the way) and have some questions / issues:

    1. For some reason, the finished tutorial doesn't like skyboxes. If I add a skybox to the main camera, the planet disappears and all that I see is the skybox. Can someone give me some direction on how to fix this?

    2. I'm loving the resulting shader, but can someone give me a hint on how to add a slider to adjust the cloud's opacity? I want to reduce its effect.

    3. Even on my big 22" screen I started to loose room as I built this shader in SSE. Is there a "zoom" function to zoom out and see the entire shader design?

    I'm a bit late to the party only having tried SSE for the first time today, but have to say that this is a fantastic tool and amazingly complete and stable for a "beta" version. Very well done!

    Edit2: One more question on the Planet Shader tutorial:

    4. I'm finding that objects using a Unity standard shader (ie. the standard diffuse shader) are not culled by the planet shader, but instead, show right through. But if the object has no material definition, then the object is culled. Must be something in the planet shader that needs to be changed, so any help on how to fix this?
     
    Last edited: Jan 9, 2011
  8. loken

    loken

    Joined:
    Mar 25, 2009
    Posts:
    109
    Small (Fairly Simple?) request. Ability to set Fog mode on the shader.

    Pretty easy to just set it in the exported shader, but might be nice to just have a button so I don't have to add it every time I reexport.

    edit:

    Actually, it'd be cool to be able to set other fog parameters such as density and color too, if thats possible.
     
    Last edited: Jan 9, 2011
  9. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Yep, I am going to add a pre-commit hook to svn to just magically make it work properly this week (will automatically convert them all the be \n)
     
  10. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    I'll put that in the next beta.
     
  11. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Hey BigKahuna,

    I am happy that you are enjoying the shader editor, I didn't write the planet tutorial and can't say exactly what might be wront but if you post your .sgraph file I will have a look. :D

    This looks to be a queue / depth write / transparency(?) issue. Make sure that on the master node you have write depth enabled.

    I'm guessing that you constructed an input somewhere in the shader for the clouds. What you will want to do it add a multiply to this input where one input is a 'range' input and the other the cloud color. You might want to just do this to alpha this can be done by using masks and adds.

    It's a to-do. I'm trying to get 'feature complete' at the moment instead of adding UI features but I do understand how much nicer this would make things. I'll either be adding this or a 'mini-map' you can use to pan with.

    :D Thanks!
     
  12. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Thanks for the quick reply and offer to help. I double checked and the depth toggle is turned on. I'll also give your other suggestion a try. Here's the graph which I believe is exactly as described in the tutorial (in a zip file):

    View attachment $PlanetShader.zip
     
  13. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Regarding the depth queue issue, I'm beginning to wonder if it might be a Unity bug / issue. The shader seems to work in the editor when I use Unity objects in the background and also works initially with my own objects in the background. But when I build a stand alone player and the scripts are re-compiled, the shader then seems to have this issue and the planet seems to get the queue wrong.
     
  14. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I have this strange issue now where i am using my shader and the model looks like it is drawn inside out... here are my settings...

    Settings: SM 3.0 (On), ASP (On), Transparency (Off), Ignore Projectors (On), Additive Blending (Off), Write Depth (On)
    Cull: Off
    Mask: All On
    ZTest: <=
    Blend Settings: Source Blend (One) Dest Blend (Zero)
    Queue: Geometry

    So what do I have to change here to get my shader back to normal...? thank you
     
  15. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,008
    In unity3d window version 3.1, warning message is displayed. (SSE 3.2)
    "There are inconsistent line endings in the "xxxxxxxxxxxxx script". Some are Mac OS X (UNIX) and some are Windows.

    both of tempshader and exported shader.
     
  16. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Hrmm, try playing with the 'cull' value. Turn it to back, see if this fixes the issue, then turn it back to off. (Could you PM me the .sgraph file and I will have a look).
     
  17. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    You can ignore line ending issues, I'm fixing the template for next release... the fun of working on both OSX and windows.
     
  18. vrayshadow

    vrayshadow

    Joined:
    Jan 10, 2011
    Posts:
    2
    Hi Neptune_imaging~

    i got same too problem. Check Queue option 'Geometry -> Transparent' then resolved.

    why not defualt queue optins is geomatry?

    it is bug?
     
    Last edited: Jan 11, 2011
  19. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    I made a mistake, forgot to check in a fix to a bug and it slipped though to release....
     
  20. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Important Bug Fix / Fog support

    There was an issue discovered with the last build where shaders would not properly set their depth write state. This has been fixed. In penance, I have added fog override support.

    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.1 from your project. All of the shader editor files have been moved around and tidied up and it is important to have a clean work area. Back up / move any graphs you would like to keep before deleting SSE 3.1.

    Please back up all of your graph files before upgrading. Graphs from Strumpy Shader Editor 3.1 should be compatible with 3.2 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
    Fog Override Support:
    Master node now supports Fog override settings. You can override he fog mode, fog color, and fog density.

    Bug Fixes
    • Serious issue with depth not being written to the shader file properly.

    Roadmap
    Beta 3.3 - 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!
     

    Attached Files:

  21. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    HI there how can i convert/make my shaders work for both PC/mac and iPhone.

    When i tries to generate my app for iPhone all my materials appear black.

    thanks in advance
    rahul
     
  22. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @stramit - That fixed it, awesome! Thanks! :)

    Ok, now I'm trying to do two more things:

    First, I'd like to modify the shader so that the "Fallback" works properly. Currently the shader is supposed to fallback to a "Diffuse" shader. But if I test this in the editor by setting SM 2.0 emulation, it doesn't work (the object disappears). How do I fix this? (Dooh! :p I just re-read your release notes and see that this is coming later.) Edit: I just double checked the shader docs and apparently it should work but doesn't. Any idea why?

    Second, I still want to add a slider to the cloud's alpha so I can control the cloud density from script. I tried a couple things but didn't get the result I was looking for. How do I do this?

    Many thanks again! :)
     
    Last edited: Jan 10, 2011
  23. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    It's cool... you could just download my original sgraph and you will see what i am talking about...
     
  24. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458

    This is cool... :) it's fixed :)... i will release the next version of my shader soon... with gloss mask support...
     
  25. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    For fallback to work properly you need to make sure that the inputs to your shader have the same names as in the fallback shader. For example the diffuse shader (from memory) has an input called _Color. You need to make sure that your shader has matching inputs. Because when it falls back it needs to know the names of the inputs to use.

    I'm not at home at the moment so I can't do up a screenshot now. If anyone else wants to feel free. Otherwise... I'll have a look tonight for you!
     
  26. vrayshadow

    vrayshadow

    Joined:
    Jan 10, 2011
    Posts:
    2
    Fastest Bug Fix!! Thank you^^. Very Nice Tool!!
     
  27. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Hey everyone, for those using Unity (Free), you can see your shader details if you just hit the export button... it is updating for me in real time when i hit the button... i am working on a second version of my shaders for me to share... enjoy...
     
  28. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Hey everyone, this is the shader that I am putting together for all of my models... I am still trying to tweak it so i can just use this shader just for everything... i don't know how it will run so I hope you will will test it and let me know what you think. I will also do a video of it in action (using Unity free)

    Here are some quick notes:

    Diffuse Map: Plug in your Colour Map here

    Normal Map: Plug in your Normal Map here (Must be a tangent space)

    Emission: Plug in your emission texture (I have it set to use the Alpha in my shader, but I may change it so that you can make an alpha channel in your diffuse texture to save on performance)

    Emission Colour: Allows you to set the colour of the glow.

    Emission Strength: I don't have Unity Pro but this will set the strength of the emission based on it's texture. I think it will glow if you overdrive the value. This is a float value.

    Specular Map: Plug in your spec map here (this is not the spec map we are used to). This is used to tighten the highlights on the model.

    Highlight Tightness: This is used to shrink or widen the highlight on your model.

    Gloss Map: This is your main specular texture. This will work together with the "Specular Map" and create an interesting effect on your models. IMPORTANT: I would recommend using this and your spec map together. Removing the Gloss Map will disable the specular map!

    Gloss Strength: This will drive the strength of your Gloss Map. Useful for making things nice and shiny. :) Use above .2 for any effect. 0 will disable it.

    Gloss Masking: This is useful if you only want to affect certain parts of your model... I have it set to alpha so you will have to make an alpha channel in your Gloss map to save on performance

    Masking Strength: This will allow you to change the value of the masking on your surface... 0 will enable masking, and any above will start to dim the masking effect.

    Enjoy!
     

    Attached Files:

  29. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    hey ! This looks awesome ! i'll download this and have a look. I don't know shader coding but maybe you could use the alpha channel of the main texture or the specular one too so that it optimize the rendering. thanks for sharing.
     
  30. Tinfoilfez

    Tinfoilfez

    Joined:
    Dec 9, 2009
    Posts:
    14
    We had this issue as well, and setting render settings in Unity to OpenGL 2.0 fixed it. Hope that helps.
     
  31. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Thanks dude, glad you like it... I am still trying to optimise the shader for performance but I made the specular and other things separate considering that i like to use coloured specular maps... and i wanted full control... I will continue to develop this shader... I'm also making one for the eyes as well... :)
     
  32. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    Hey looks great! congrats on getting more comments then any sticky threads in the showcase section :)
     
  33. noradninja

    noradninja

    Joined:
    Nov 12, 2007
    Posts:
    420
    You mean graphics emulation? Because even when you compile for iPhone, everything is black, I have tried all manner of configurations for build settings to no avail.
     
  34. thellama

    thellama

    Joined:
    Mar 25, 2010
    Posts:
    360
    @Neptune_Imaging awesome shader, I'm inspired to make my own now.
     
    Last edited: Jan 13, 2011
  35. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Thanks man... I need to create some examples and share the new graph... i also made one specifically for eyes :)
     
  36. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Anyone make a good transparent glass yet?
     
  37. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    What you need is:
    1. A 3GS generation or later device. iPhone 3G or 2nd gen itouch won't work
    2. set the build settings to armv7 and not modify the AppController (ie don't set the define for OPENGLES 20 to 0!)
    3. ensure that you only use nodes that work at all (this should commonly show up in the editor with an error already)
    4. ensure that you don't overdo it as you are rather limited on the instruction number but even more registers and interpolators
     
  38. noradninja

    noradninja

    Joined:
    Nov 12, 2007
    Posts:
    420
    Allright:

    1. Device is a 4th Generation iPod Touch 8GB (with the Facetime cameras). I can build using the built in Unity shaders (example- BumpSpecLightmap) and as long as I set the Target Platform to Universal (ARM6 and ARM7) in the Player Settings, I am good. If, however, I try to use a shader generated with SSE, everything is rendered black (like it is in the Editor if you dont turn on OpenGLES 2.0 emulation).
    2. I dont alter the output from Unity except to explicitly define arm7 as the build target; we dont bother with anything older as our stuff requires the pixel shader hardware.
    3. I am pretty sure what I am using is fine, maybe you could look it over real quick:



    I mean, the worst node in there is the fresnel calculation; everything else is simple math.

    Should result in this, its how things look in the Editor (with OpenGLES 2 emulation on of course):



    4. Shader only has 24 ALU's and 3 Textures; it is based on the Rim Light sgraph that came with SSE. Not sure where the failure point is here, but I will say that nothing I have compiled out of SSE displays correctly on my 4G iPT, which indicates to me more work to be done on SSE's side of things to properly support iOS (which has been talked to death earlier in the thread). If I am making a mistake somewhere or anyone here has gotten things to work properly on iPT4/iPhone4/iPad, please let me know.
     
  39. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I want to take a crack at that but I don't think Unity 3 (non pro) can do refractions without certain buffers... it begs the question, if i could create refraction using SSE, I've already finished the cornea shader for character eyes (no refraction for performance reasons)... and one i can get a pro license, I would love to added a reflection buffer to my shader to get real time reflections.
     
  40. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    Refraction would require renter to texture functionality so that's pro only.
     
  41. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    I found a bug a while ago and never reported it. The picture explains itself.

    It will not render properly when I open the window. This only occurs on my laptop which has an Intel 945GM graphics chip. My Geforce GT 240 card on my desktop has not had this issue. I had this issues happen one other time in Unity on my laptop and that was with the Terrain Toolkit but as soon as I clicked in the window the text corrected itself. With this it seems there is nothing I can do to get it to render the screen properly.

    The screenshot below is of the default set up in the shader editor after it was freshly installed on my machine. (I just reinstalled Windows and Unity to the laptop, so its the first time ever the plug in has been installed on this copy of Unity/Windows)
     

    Attached Files:

  42. thellama

    thellama

    Joined:
    Mar 25, 2010
    Posts:
    360
    @Neptune_Imaging it would be awesome if you shared your graph. I would love to learn more about specular setups. I have my own but I would love to see what you've done. I can't figure out how to get the color to pass through from a color spec-map.
     
  43. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    hey llama...i will definitely upload the new graph... i wanted to embed the emission thru a diffuse texture but i kept the emission as a separate texture
     
  44. noradninja

    noradninja

    Joined:
    Nov 12, 2007
    Posts:
    420
    How do I do a conditional? LIke an if statement.
     
  45. thellama

    thellama

    Joined:
    Mar 25, 2010
    Posts:
    360
    Thanks Neptune, that would be very helpful.

    cheers,
     
  46. caitlyn

    caitlyn

    Joined:
    Jun 20, 2008
    Posts:
    402
  47. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Here is Version 2 of the shader graph... i wanted to have the maximum quality on my models, but until i can actually test this shader in a game ready environment, I will just make it look nice... enjoy all
     

    Attached Files:

  48. AdanRodriguez

    AdanRodriguez

    Joined:
    Jan 15, 2011
    Posts:
    1
    ICE for UNITY?, lol, dude nice tool! really handy
     
  49. Bezzy

    Bezzy

    Joined:
    Apr 1, 2009
    Posts:
    75
    I'm using this editor very, very happily, and have to thank you for showing how easy it is to get node editor style editors going: it's been an inspiration for many other things!

    I have a feature request:
    When clicking on the preview, and being shown a list of configurable values, there's a "Reset Inputs to Defaults" button. It would be quite helpful for iteration time to be able to have the opposite of this, just under: i.e. "Set Defaults to Detail Window's Values". That way I wouldn't have to keep remembering the values and going back into each input node, one at a time.

    I hope this isn't too time consuming to do, because it would certainly save me a bit of time.
     
  50. DiegoC

    DiegoC

    Joined:
    Jan 14, 2011
    Posts:
    36
    Hi
    How I change the Map Channel in a texture, please?