Search Unity

Strumpy Shader Editor [Now Open Source]

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

  1. thomaslilja

    thomaslilja

    Joined:
    Nov 11, 2010
    Posts:
    9
  2. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
  3. EhsanNeo

    EhsanNeo

    Joined:
    Aug 22, 2012
    Posts:
    17
    Guys no one knows about my problem ?

    I really need to solve it .

    STARMIT PLZ HEEEEEEEEEEELP
     
  4. stiltskin

    stiltskin

    Joined:
    Feb 27, 2010
    Posts:
    95
    hey guys!

    I'm working on a shader to be used by particles because I want a transparent, soft particle that are also lit by the directional - which Unity does not supply for some reason. My only problem is that I can't seem to get the particles to not cast shadows. i have Ignore projectors turned on, but it's not making any difference.

    Is there a way of doing this?

    Thanks!
     
  5. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    work with unity4?
     
  6. stiltskin

    stiltskin

    Joined:
    Feb 27, 2010
    Posts:
    95
    if you're replying to me, no. I have 3.5.5
     
  7. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    I just back back into SSE after being away from it for almost a year and found a weird glitch on my machine. Whenever I open up the SEE window in Unity my CPU usage for Unity.exe*32 jumps up to 20-30% without me even doing anything.

    I am running Unity 3.5.5f3 "free" on Windows 7 Pro x64 on a Phenom II X4 3.5Ghz. I noticed that when I click on any menu in Unity(SSE or Main Editor Window) my cpu usage will drop back to 0%. Oddly enough, pressing play on my very basic scene drops the CPU usage down from 20% to 10% if the SSE window is left open.

    Anyone else have this trouble? I only noticed because my fan's revved up and stayed up only when using SSE.

    I did reinstall unity and SSE and nothing fixed it. Is SSE supposed to use so much CPU power when idle? Or is this related to the fact that the free version can't render the real time view of the shader in progress? Any help/advice would be appreciated.
     
  8. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    ok
     
  9. stiltskin

    stiltskin

    Joined:
    Feb 27, 2010
    Posts:
    95
    Pretty sure that's the preview window. When that window is open on my machine, the perfs tank. Try closing it to see if it helps at all.
     
  10. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    Hmm, I had thought I missed something but I don't have a preview window at all and the problem still exists. I only have the graph window. I even went into the SSE assets and tried renaming/deleting the StrumpyPreviewWindow.cs file which didn't break anything or fix the issue. I have since reinstalled SSE and it still has the same problem.

    I am using SSE 4.0.
     
  11. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    I have been working on advancing my shader that used 20% cpu and now my CPU jumps up to 50% usage while using SSE. 20% I thought I could deal with but the editor using 50% of 3.5Ghz quad core? Something is not right. Anyone else ever have this issue? Any ideas on how to resolve this? I tried uninstalling and reinstalling Unity and SSE, neither worked.
     
  12. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    Vert,
    Well, when I use quiet a number of nodes it really starts to lag a lot. But I'm talking now about a really huge number of nodes. Tough for a 3rd model shader this number of nodes still does not reach out to limitations of available number of instructions, so this is a limitation to build a really complex effects.
    Also, holding opened SSE window along with testing a game scene leads to strange behavior of statistic display. The number of VBO total, in this case, tends to grow rapidly, even tough the memory usage and overall performance doesn't change so much. And yes, this tend to happen only if SSE window is opened.
     
  13. Alismuffin

    Alismuffin

    Joined:
    Oct 3, 2011
    Posts:
    100
    Thanks for this excellent free plugin!
    Exactly what I was looking for

    Here's my shader I created with it (Using a free source model and textures)

    It takes Diffuse, Normal, Specular, Emmision and glow maps, has adjustable normal depth and gloss factor

     
  14. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    Demnus,

    I figured with a lot of nodes it would matter, but just a simple diffuse shader with no frills, just a single texture uses 20% of my CPU. Attached (right click and view the image(~1920x1080 image)is a screen of the graph I am working with that uses between 38-48% CPU just having the shader editor window open. If I open any menu in Unity or play test the CPU usage drops to expected normal lower levels as I stated in my previous posts. I do not keep SSE window open while play testing my game but only did so to see if the CPU changed, which it does. As shown in the screen shot I am just in the main editor window and have opened the SSE window to work and get 45% CPU usage doing nothing else.

    The shader I am working on is a detail shader. This shader allows a base color to be set and then uses an alpha to decide how much of the detail texture will be shown on top of the base color. (not sure if that's the order it renders, but its the idea I used to approach the problem). Think of something like Halo's armor color chooser, but instead of having a set number of colors, you can enter RGB values or use a color picker to customize an objects color ingame. That was the end goal. To keep details, but allow color choice without the color being baked into the texture.

    So anyway, this is what I am working on and getting such large performance hits with the SSE window open. Just looking to see if anyone else has had similar issues. This doesn't seem normal or expected. Since I am using Unity free I have no preview window. To me it looks as if I am just placing nodes on screen, but 2 cores at 3.5GHZ are chugging away at almost full power to allow me to do this.

    Side note: if anyone finds this graph useful, please go ahead and use it or learn from it. And if you find something horribly wrong with it let me know, as I would like to take this concept shader and turn it into something that can be used in a game. Really I just wanted a proof of concept shader. I will be redesigning this to optimize the number of textures used, nodes required etc for my final product. This is very much so a W.I.P.
     

    Attached Files:

    Last edited: Sep 2, 2012
  15. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    Vert,
    It appears that I'm to have this issue with 50% cpu load. Just never checked this before.
    It may be caused by redrawing cycle of SSE window. It can be active even when we're doing nothing with it.

    My specular reflection shader. With controllable contrast of reflection.
     
  16. stiltskin

    stiltskin

    Joined:
    Feb 27, 2010
    Posts:
    95
    Hey guys,

    does anyone know how I can tell SSE to reuse the same frame buffer grab for multiple instances of an object that have distortion? I'm making tile-able river pieces but at the connection I can see the edge of the frame bleeding into my grab. I assume it's because each mesh is doing it's own grab. It's either that, or I need to find some way of making sure the grab filters out what ever is above it in world space - it may also be the edge of the screen causing that. Any ideas? Thanks!
     
  17. Dubious-Drewski

    Dubious-Drewski

    Joined:
    Aug 19, 2012
    Posts:
    51
    I am so excited to see such a utility exists, but I am having trouble simply trying to follow along in the documentation.

    Page 2
    "Click the box on the left of the color node (it's output) to start drawing a connection, and place it on the Albedo input of the Master node."
    - There's no such thing. There's nothing called "Albedo" anywhere on the interface. What does this mean?

    "With this, you can now hit “Update Shader” and have the preview display reflect your new shader"
    -There is no "Update Shader" button anywhere on the interface. What's going on?

    I'd love to use this utility, and in my excitement I was about to donate (Because it looks well deserved), but now I'm just frustrated, and I begin to wonder how confusing the rest of the documentation will be.

    Any help?
     
  18. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    Documentation are just outdated now.
    I believe Albedo of master node now is a diffuse input.
    Update shader is a button of preview window, which isn't available on Free version of Unity. You should just Export your shader and see it takes effect in your scene.
    Also there is number of changes in nodes. At least it's a relief that the nodes has pop-up descriptions inside the editor itself, so you wont be lost too much.
     
  19. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Wow, you just saved me a ton of trouble... I've been trying to do a blurry reflection too... how long did it take you to solve it?
     
  20. stiltskin

    stiltskin

    Joined:
    Feb 27, 2010
    Posts:
    95

    confirming. Albedo is the technical term for diffuse. He just changed in recent versions to make it more user friendly. A diffuse texture is what typically is used in the Albedo pass.
     
    Last edited: Sep 2, 2012
  21. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Nice setup man... I've been trying to get blurry reflections too... but it is has been very painful to do...
     
  22. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    For now it's not blurry ^^ It's contrasted. Brighter bright areas, darker dark areas... Also it's done with some desaturation. The idea was that it will lead to fake HDR look. And I think it does. As long as I don't have Unity Pro. ^^

    But when you mentioned about blurry reflection I thought about it.
    Well it's possible to blur the image with bilinear algorithm or even Gaussian(just google it). The algorithms seams to me pretty implementable with SSE. But there is a problem there. You must sample the texture multiple times with offset. That means we should have the access to UV of cubemap. But it's controlled with some built in algorithms involving normals. Well we can offset the normal maps but it will lead to blurry normals which is undesired.
    So the only way to do so is to recreate cubemap by ourselves instead of using the built in one. And this looks for me to be quiet a contraption.
     
  23. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Drat...well I guess I will deal...
     
  24. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Hi,

    In your extension it says "Features include: In editor preview (Pro only)". I have been chatting with someone and they say that you are now using the advanced rendering hack to workaround limitations with RenderTextures in the editor.

    Does this mean that your in editor previews now work with non-pro?

    Cheers
     
  25. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    I am using the latest version of Unity free and I can confirm the preview window is not present in SSE 4. All you will see is the node editor.
     
  26. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey guys, is anyone here working in Linear Colour space in Unity Pro? I have been encountering these very weird issues with my texture maps, particularly colour banding and odd behaviour with the rendering and I want to ask if there is a way to make sure that the shaders we create will automatically correct themselves to work in Linear Colour space... thanks
     
  27. anadin

    anadin

    Joined:
    Oct 28, 2005
    Posts:
    98
    We did some fiddling with this, if you are using Photoshop check you have the RGB profiles embedded.

    You can also look in the advanced area of texture importer and play with the bypass sRGB sampling but it might just be compression - maybe fiddle with those? the difference you should see with linear vs gamma is not being able to get the same colour between your editing app and in game, they textures will either appear lighter or darker not normally a banding problem
     
  28. Zen-Davis

    Zen-Davis

    Joined:
    Aug 14, 2009
    Posts:
    285
    Is this software dead?
     
  29. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Are there any more example-graphs than delivered with package available?
    Want to make a simple cubemap-shader.....

    Also would like to know if it´s dead, too. Last Update was done march 24, 2011
     
    Last edited: Sep 6, 2012
  30. jwinn

    jwinn

    Joined:
    Sep 1, 2012
    Posts:
    88
    I was just wondering this myself, while trying to decide whether to use ShaderLab or Strumpy's tool. I found this tidbit from a Gamasutra Article from Sept 2011:

    "We now have people full time whose job is to find content out there and get it on the store," he noted. Three tool success stories he pointed out were uScript, a graphical scripting language "designed by some of the guys who had a hand in Unreal Kismet," RAGEspline, a "really high quality" 2D vector graphics tool, and Strumpy Shader Editor, a tool made by a former 2K Australia BioShock developer that is "so awesome we had to go out and hire him," said Francis.

    I have a feeling that a visual shader editor will be available in a Future version of Unity. I don't see it listed for Unity 4, so maybe the release after that? I'd be interested to hear more on the subject.
     
  31. eikons

    eikons

    Joined:
    Sep 16, 2012
    Posts:
    1
    I'm having a problem - I'm new to Unity so forgive me if it's something really obvious.

    I imported a model and a bunch of textures. I made a shader with Strumpy's, saved it, made a material and applied it - then applied this to my model in game.

    The material works fine in the shader preview, but renders black ingame and in unity's own little preview sphere.




    Any ideas?


    EDIT: Nevermind I fixed it. Turns out it was a problem with exporting, my bad.

    Still not getting Alpha mapping to work though - any special advice on that?
     
    Last edited: Sep 17, 2012
  32. larvantholos

    larvantholos

    Joined:
    Oct 29, 2009
    Posts:
    668
    Its not dead. Stramit still updates it, and its fairly stable without any major bugs right now. There is an issue with it working in 4 (when I last checked) but Stramit said in the beta forum he'd patch it sometime after unite.
     
  33. LeonardKDev

    LeonardKDev

    Joined:
    Sep 17, 2012
    Posts:
    2
    Hello, can i batch materials with shader that i create with Strumpy Shader Editor?
    Thanks.
     
  34. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    You are going to need a Splatalpha plugged into the Alpha input... then plug a subtract into the vector part of the Splat alpha, and then plug a Float const into the subtract. You can also plug the alpha from the diffuse texture into a lerp. And for your normal map, I would not use Unpack normal for this... a regular Tex2dNormal should be sufficient
     
  35. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Hey Neptune, are you still looking for blurry reflections?

    You should use texCUBEbias (_CubeMap, float4(worldRefl, _CubeMapRoughness)) instead of the usual texCube. You need to activate MipMaps on your CubeMap in order for it to work.

    Here's an example of a Diffuse Specular Normal Reflective shader with working Cubemap roughness. I don't know if it is possible to do it in Strumpy, but you can still adapt your shader code after.

    Code (csharp):
    1. Shader "Parabole/Reflective/DSNR_SpecAlpha" {
    2. Properties {
    3.  
    4.         _Color ("Base Color", Color) = (1,1,1,1)
    5.         _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
    6.         _Shininess ("Specular Shininess", Float) = 0.078125
    7.         _SpecStrength ("Gloss Strength", Float) = 1
    8.     _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
    9.  
    10.         _CubeMapColor ("Reflection Color", Color) = (1,1,1,1)
    11.         _CubeMapRoughness ("Reflection Roughness", Float) = 0
    12.         _CubeMapStrength ("Reflection Strength", Float) = 1
    13.     _CubeMap ("Reflection", Cube) = "" { TexGen CubeReflect }
    14.  
    15.     _NormalMap ("Normal", 2D) = "bump" {}
    16. }
    17.  
    18. SubShader {
    19.     Tags { "RenderType"="Opaque"}
    20.     LOD 400
    21.    
    22. CGPROGRAM
    23. #pragma surface surf BlinnPhong fullforwardshadows
    24. #pragma target 3.0
    25.  
    26. sampler2D _MainTex;
    27. sampler2D _NormalMap;
    28. samplerCUBE _CubeMap;
    29.  
    30. fixed4 _Color;
    31. fixed4 _CubeMapColor;
    32.  
    33. float _CubeMapStrength;
    34. float _CubeMapRoughness;
    35.  
    36. float _SpecStrength;
    37. half _Shininess;
    38.  
    39.  
    40. struct Input {
    41.     float2 uv_MainTex;
    42.     float3 worldRefl;
    43.     float3 viewDir;
    44.     INTERNAL_DATA
    45.        
    46. };
    47.  
    48. void surf (Input IN, inout SurfaceOutput o) {
    49.  
    50.     fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
    51.     o.Normal = UnpackNormal(tex2D(_NormalMap, IN.uv_MainTex));
    52.     o.Albedo = tex.rgb * _Color.rgb;
    53.    
    54.     o.Gloss = tex.a * _SpecStrength;
    55.    
    56.     o.Specular = _Shininess;
    57.    
    58.     float3 worldRefl = WorldReflectionVector (IN, o.Normal);
    59.     fixed4 reflcol = texCUBEbias (_CubeMap, float4(worldRefl, _CubeMapRoughness));
    60.    
    61.     o.Emission =  reflcol.rgb * _CubeMapColor *_CubeMapStrength;
    62.  
    63.  
    64. }
    65. ENDCG
    66. }
    67.  
    68. FallBack "Specular"
    69. }
    70.  
     
  36. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    This is going to be a tough one... I would have to literally deconstruct my graph to make it work... and I am not a coder :(. Also I am using a script that does real time reflections...
     
    Last edited: Sep 18, 2012
  37. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    A helping hand for God's sake.
    Missing bump effect after the lightmap baking.... What should I do?????

    THANKS!!!!!
     
  38. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Are you using Unity Pro?
     
  39. anadin

    anadin

    Joined:
    Oct 28, 2005
    Posts:
    98
    Have you got 'Disable Forward Add' ticked in settings?
     
  40. Alizarin

    Alizarin

    Joined:
    Sep 21, 2012
    Posts:
    4
    Hey Strumpy, how do I Dot the ViewDirection with the LightDirection? Can I access LightDirection in strumpy? Thanks for the help.
     
  41. Lobinux

    Lobinux

    Joined:
    Sep 29, 2012
    Posts:
    2
    I have a question, how I can create an outline with strumpy shader editor?
     
  42. Alizarin

    Alizarin

    Joined:
    Sep 21, 2012
    Posts:
    4
    I would try rendering the back facing polygons (cull the front ones). Render them a solid color, say bright pink. And in your vertex shader, offset them along their normals, just a little ways to give your outline some thickness. Then render your original object on top of that. I would expect that to give you a nice pink outline. Not perfect, but its similar to what Blender does when you select an object.
     
  43. Alizarin

    Alizarin

    Joined:
    Sep 21, 2012
    Posts:
    4
  44. njackson4190

    njackson4190

    Joined:
    May 11, 2012
    Posts:
    8
    Is there a way to use the 2nd uv channel of a mesh. I saw the Full Mesh UV2 Node but I don't think that is what I am looking for. I am trying to impliment an input for a lightmap texture into one of my shaders that I am making.

    Thanks
     
  45. EhsanNeo

    EhsanNeo

    Joined:
    Aug 22, 2012
    Posts:
    17
    I think SSE does not support Light Dir .

    I need it too ! damn
     
  46. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    Within a day of my first time using it (and I'm new to shaders) I was able to make a shader that worked for me. Kudos to Strumpy.

    Now all I have left is one word for you : fmod
     
    Last edited: Oct 4, 2012
  47. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    Hello everyone,

    I'm still new to shaders so please excuse the following questions.

    1) I am using a texture's Alpha channel [0,1] as a lookup to a color ramp; in other words, I'm using it as the UV to another texture that contains the actual color I want to use. What I'm confused about is how does a single component value like Alpha map to a double-component value like UV? I am able to pipe the Alpha output of a Tex2D to the UV input of another Tex2D and all works well, but I'm wondering how is it mapping one value to an input that requires 2 values : U and V.

    2) It turns out that I need more than the possible 256 colors that the Alpha channel gives me, so I want to steal a bit from the Red channel to give me a total of 512 values. How do I extract the Red component from the RGBA of a Tex2D and use that as the V, and how do pipe the Alpha channel to the U? The Text2D UV doesn't allow me to pipe values to the individual U and V components. I don't see any way of taking components from different areas and either feeding them discretely to individual components or piecing them together to form a bigger piece that can be assigned.

    Many thanks!

    Anthony

    edit : never mind, I think I figured it out... everything is treated as either a 4-byte float single value or a 4-byte float with individual component values. To get what I want, I need to use a combination of functions, especially splats and masks.

    edit2 : ok, i'm lost. I need to isolate the low-order bit of the Red component and for the life of me I can't figure it out. I've attempted to multiply the Red value by 128 in order to shift its bits left 7 times and get the low-order bit alone, but that doesn't work. I've tried multiplying against a Float4 [128/255, 0, 0, 0], Float4 [128, 0, 0, 0], and a Float [128] , but no dice. It's not doing what I expect at all, because if I multiply by 256 or 512 it doesn't clear up like an 8-bit value should when you do x << 8. In other words, I expect it to zero out, but it's definitely not zero. Any thoughts?

    edit3 : stupid is as stupid does. it's a vector, so the length gets bigger. i need to use frac.
     
    Last edited: Oct 4, 2012
  48. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    Does anyone happen to know why Tex2D's Alpha outputs a vector with both X and Y set? I mean, Alpha is a value between 0..255, so only one needs filling... what does the other have? I would think either X would be set or it would Splat it out internally so that X, Y, Z, and W have the same Alpha value.

    Currently I need to Mask the Alpha output to let only the X through.

    Anyone?
     
    Last edited: Oct 4, 2012
  49. CThersipposK

    CThersipposK

    Joined:
    Oct 6, 2012
    Posts:
    1
    Hello there. I am new to strumpy and I would like to ask a question. I am trying to make a shader (like diffuse) but I want each face to have a little shading on it's edges. Is it even possible? Can I shade in a way each face slightly different? Even if the faces are parallel?

    One more question: is srumy editor giong to be updated? I think vertex section should be updated.

    Thank you very much.
     
  50. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    I have a custom shader I made in Strumpy but would like for it to ignore lighting; in other words, act like Unity's Unlit shader. Anyone know how I can achieve this?

    .