Strumpy Shader Editor [Now Open Source]

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

  1. Aron

    Aron

    Member

    Joined:
    Oct 6, 2010
    Messages:
    54
    Hmm, I correct myself, it's actually JUST culling materials with transparency, and a few others for no observable reason.
     
    Last edited: Mar 29, 2011
  2. chkkll

    chkkll

    Member

    Joined:
    Jul 20, 2010
    Messages:
    40
    i feel like im being ignored lol....
     
  3. Frank Oz

    Frank Oz

    New Member

    Joined:
    Oct 13, 2010
    Messages:
    1,564
    ..Did someone hear something?


    No really tho, ignored with what? What was the question?
     
  4. chkkll

    chkkll

    Member

    Joined:
    Jul 20, 2010
    Messages:
    40
    i hopelessly try to add an outline shader pass in strumpy editor like in built in toon basic outline. but i fail to do so.. i also tried to add outline pass through the compiled shader by hand (i mean pasting lol), it shows right in the material preview window but it does not show up on editor window or in any build.... if u have any knowledge about it and feel like sharing i'd be gratefull... thanks for the attention
     
  5. Aron

    Aron

    Member

    Joined:
    Oct 6, 2010
    Messages:
    54
  6. AcidArrow

    AcidArrow

    Member

    Joined:
    May 20, 2010
    Messages:
    1,332
  7. 2dfxman1

    2dfxman1

    New Member

    Joined:
    Oct 6, 2010
    Messages:
    1,065
    Mind telling how to distort the bg?
     
  8. alewinn

    alewinn

    New Member

    Joined:
    Nov 8, 2009
    Messages:
    181
    Hi !

    Maybe this has been already answered but is there a way to access x and y textures coordinates for a 2D sampler ?
    Is ther a way to do median filter or any other matrix operation with Strumpy Shader Editor ?
    Anyway, the shader editor is totally awsome !
     
  9. AcidArrow

    AcidArrow

    Member

    Joined:
    May 20, 2010
    Messages:
    1,332
    You would have to use render textures or grabpass to do it, not really sure if it's possible with SSE alone.
     
  10. 2dfxman1

    2dfxman1

    New Member

    Joined:
    Oct 6, 2010
    Messages:
    1,065
    Well you can grabpass, but what to do with it?
     
  11. AcidArrow

    AcidArrow

    Member

    Joined:
    May 20, 2010
    Messages:
    1,332
    Before applying it to the uvs, you offset the coords according to the normals.

    At least that's my understanding from studying the stained glass shader a bit :

    I'm not being vague on purpose, but I'm not an expert on either SSE or shaders and I didn't attempt to implement this in one of my shaders yet. Hopefully someone more knowledgeable will post some more concrete info.
     
  12. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
  13. morris

    morris

    New Member

    Joined:
    Mar 2, 2011
    Messages:
    7
    Hi, I have a problem. I'm trying to build a water shader. Similar to Unity's built-in Reflective Bumped Specular using the SSE. I want to have two lerped normal map to randomize the water effect. I want these two normal maps (01 and 02) to scroll in different directions using 4 components of a float4 vector: ( x_speed01 , y speed01 , x_speed02, y_speed02 )

    I got the first texture to pan properly using the X and Y component of my float4 vector but plugging in the Z and W always break my shader. Here is my graph. Am I doing something wrong? Using the Splat and Mask modules didn't seem to help either. here is my graph if anyone can enlighten me:

    [​IMG]
     
  14. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    Hi everyone.

    I have been incredibly busy the past 5 days, but I have set aside a few hours tonight to go through all the questions that have been posted. Should have responses to queries in about 10 hours ;)
     
  15. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
    I'd like to know if you think it would be possible to add background "post-it" to better structure the graphs and be able to move every node inside that post-it at once...? This is not a request of course, just thought it would be a nice addition if it was possible.
     
    Last edited: Mar 29, 2011
  16. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    This is a bug, I will fix this for next release :D
     
  17. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    They are still in the planning stage due to me being immensely busy. The plan is:
    1. Shader Editor introduction
    2. Pixel Graph - What all the inputs do
    3. Blending / Transparency
    4. Vertex Shaders
    5. Lighting Graph
     
  18. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    Would you be able to pm me this shader and graph file so I can have a look? I would like to check your blend and queue settings.

    Make sure that you are in the transparent queue, your blending is set to src alpha / one minus src alpha, and you are not writing to the depth buffer.
     
  19. Frank Oz

    Frank Oz

    New Member

    Joined:
    Oct 13, 2010
    Messages:
    1,564
    Really looking forward to the info on the Vertex and Lighting graphs. I can see the lighting graph being highly useful once i understand it better, and can actually get some kind of result out of it, lol.

    In the meantime, could the vertex graph be used in the following way. A plant with a number of leaves, each one with a different vertex color painted on it, and those colors used to control the amount of swaying. Or a flag for faking the effect of slight wind, things like that?
     
  20. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
  21. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    I've put together a small set of demo's that show how some of the things in SSE can be done. Link is at the bottom of this post, each demo addresses a specific question so I'll go through them one by one.

    I didn't have a problem with this, have a look at the example included in this post:
    AlphaGlow, if you move the slider the alpha, and glow change. The sphere on the left takes the alpha directly from the slider, the sphere on the right from the red channel in the supplied textures. It works as I would expect it to.

    Glow post process
    [​IMG]
    Alpha scene view
    [​IMG]

    For this to work you need to follow the conventions as proscribed by unity. There is documentation on how to do it here:
    http://unity3d.com/support/documentation/Components/class-LightMapping.html
    Search for the 'Material Properties' section.

    For this to work properly you need to name your shader, and your shader variables to match what unity expects.

    Lightmapped surface, notice the radiosity from the emissive texture
    [​IMG]

    In the download I have also included an emissive lightmap example (LMEmission). Notice that the shader name contains 'Self-Illumin', and the properties 'Main Color', 'Main Texture' and 'Emission' these are needed for beast to pick them up properly.

    Outlines are a very tricky beast, and there are a lot of ways to do them. The toon rendering example from unity uses multiple passes which are not supported by SSE due to using surface shaders. The best thing to do is to use a modified frenel shader using the view angle to make edges turn black as they face away from you. This looks acceptable for the most part. I have included an example called Outline in the download.

    Simple Fresnel based outline
    [​IMG]

    Yep it is ;) SSE supports distortion and grab pass and all that nice stuff. I have included the example 'Distortion' that shows how to do this.

    Distortion shader, has motion as well, play the scene to see
    [​IMG]

    If you grab the 'uv' output you can put it into a split and do whatever you like with it. Matrix operations are quite limited in SSE as they are not first party citizens in unity shaderlab like samplers and colors ect. If you look at the UV manipulation sample you will see how to manipulate the UV's from a sampler.

    Hi Morris,
    This is a pretty simple thing to do. You are not manipulating your UV's quite right. If you check out the ''TexturePan' example in the demo's it will show you how to do this. It should be noted, that for your case it's actually easier to not use the UV pan node and to the pan manually (pan is better for 1d panning). This is what I do in the example.
    Also when you say 'break your shader' do you mean that the editor breaks or that it looks wrong? If the editor breaks this is a bug and I need to fix it so more info would be nice.

    Two overlayed textures panning... looks better in motion
    [​IMG]
     

    Attached Files:

  22. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    This is something I have wanted to add for a long time... I have not had the time to program it though. It is possible, and I should do it.
     
  23. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
    Thanks I'll hope you'll enjoy it. As far as my suggestion, being a heavy NUKE user, it was something I always loved to do, to keep things organized and clean. Keep doing your best, SSE is by far the most critical great plugin for unity in my opinion ^^ !
     
  24. morris

    morris

    New Member

    Joined:
    Mar 2, 2011
    Messages:
    7
    It doesn't crash SSE if that's what you mean. It just defaults to the pink material. (Same as when you write broken code). Thanks for the demo and the quick reply, going to have a go at it and keep you posted!
     
  25. 2dfxman1

    2dfxman1

    New Member

    Joined:
    Oct 6, 2010
    Messages:
    1,065
    Whoa you rock stramit. Thanks for examples.

    Also a feature request:
    Ability to open multiple graphs at the same time. Nothing critical, but would be nice if I could open two or more graphs at the same time.

    Not sure if answered before, but can this do lens shaders?
     
    Last edited: Mar 29, 2011
  26. Zogg

    Zogg

    Member

    Joined:
    Mar 28, 2009
    Messages:
    147
    I've a very strange problem with this shader. I downloaded your package, loaded the "Distortion" scene and everything was fine. Then I created a similar shader with some modifications, but the distorted image was upside down. So I reloaded your demo but suddenly the distorted image of your shader was upside down, too. Even when I restart the computer, create a wholly new project, then re-download and import your package, the distorted image is upside down :

    [​IMG]

    Does anyone know how to fix this problem ?
     
  27. Neptune_Imaging

    Neptune_Imaging

    Member

    Joined:
    Jan 5, 2010
    Messages:
    2,702
    Those are some awesome examples stramit...I am still learning how to use Manual blending so i can add layers of damage on my objects based on contact... will you be able to demonstrate that?
     
  28. bigkahuna

    bigkahuna

    Member

    Joined:
    Apr 30, 2006
    Messages:
    5,423
    @zogg - Looks suspiciously like an old anti-aliasing caused issue we had with Unity 2.6. Probably not related, but try changing the quality settings in your editor to see if that makes a difference? Also try deferred vs. forward rendering?
     
  29. Frank Oz

    Frank Oz

    New Member

    Joined:
    Oct 13, 2010
    Messages:
    1,564
    Are you using forward rendering and AA?


    Edit: bigkahuna beat me by seconds! :p
     
  30. Zogg

    Zogg

    Member

    Joined:
    Mar 28, 2009
    Messages:
    147
    Actually I was using forward rendering - switched to deferred rendering, that corrects the problem. Thanks!

    Btw, stramit, thanks for the great examples! :D
     
  31. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
    Just a thought here, if you're not yet using vertex painting on your models maybe you could paint vertices based on collision contact via scripting (with different strength of color for more damage maybe) and in SSE create a shader that is able to answer to that vertex color by blending the regular model maps with a "damaged" map.

    You could even create several "damaged" maps and distribute them on the RGBA channels of your models for more detail and precision.
     
  32. Neptune_Imaging

    Neptune_Imaging

    Member

    Joined:
    Jan 5, 2010
    Messages:
    2,702
    I think stramit and few others told me that before...i am working on a model now and it has tangents for normal mapping...i've never used vertex painting before and my shader will have three extra inputs for diffuse/NM/Spec/Gloss for each damage texture and yes, those damage textures will have alphas to seamlessly blend it in... (the default alphas are only 8bit...i am using 32-bit textures)

    I am also not a programmer, so i have to learn how to do that :)
     
  33. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
    If you already have the damage textures I would be glad to help. But if you're really not a programmer you'll have to be at least in order to call a function doing what I suggested you. I can help only if you let me put the graphs and source code here in the forums, that's the only condition (Also I must have the damage textures you intend to use to be as close as possible of your working "conditions", and tell me what channels you use for your main models...).
     
  34. Neptune_Imaging

    Neptune_Imaging

    Member

    Joined:
    Jan 5, 2010
    Messages:
    2,702
    I'll see what i can do... i am working on an alt costume for a model...I will post my first WIP thread here soon. (I come from a CG background so vertex painting and real time stuff is still new to me...)

    EDIT: I will be using the Diffuse/Normal/Spec/Falloff channels of my shader to layer on my damage textures
     
    Last edited: Mar 29, 2011
  35. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
    Well actually I come from a CG background too, I've been working with unity for 6 months now. I'll wait for the WIP, of course you can contact me if you wish a vertex-painted Damage script/shader.
     
  36. Neptune_Imaging

    Neptune_Imaging

    Member

    Joined:
    Jan 5, 2010
    Messages:
    2,702

    Will that work with my custom shader? I also use SSE, and i am looking at your Vertex painting offset shader video...neat stuff :). I mainly want to use this on character models, (my shader is kinda performance heavy but won't know until i test it). And I am using Unity (non-pro)
     
  37. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
    Yeah as I told you I can actually dynamically in scripting see wich vertex is being touched when a collision occurs, paint the vertices with for exemple a red color, set the strength of the color to be the force in which the model was touched, and in SSE bind this color to a texture map which behaves correctly to the normal maps and so on. If you saw my video/shader, you also saw that I can basically BLEND colors too wich can give pretty good results say you want to have damage + blood, and want the blood to be reflective etc. As I did it for my shader theorically it isn't really that hard so. ^^
     
  38. Neptune_Imaging

    Neptune_Imaging

    Member

    Joined:
    Jan 5, 2010
    Messages:
    2,702
    Sweet man...i will definitely keep you posted... I still need to learn how to code :)... my WIP will come soon :)
     
  39. Shibito

    Shibito

    New Member

    Joined:
    Jul 28, 2010
    Messages:
    34
    No problem, glad I can help. And sorry for deviating your thread Stramit !
     
  40. chkkll

    chkkll

    Member

    Joined:
    Jul 20, 2010
    Messages:
    40
    see im still ignored lol...
     
  41. Frank Oz

    Frank Oz

    New Member

    Joined:
    Oct 13, 2010
    Messages:
    1,564
    Well he said he'd be answering and doing demo versions for all those who asked questions, but it'll take him a while. So hang in there, he might have something in the works for you? For my part, I didn't know how to fix your problem, or what was wrong with it, actually I didn't quite understand at all, just I get the impression toon shaders are some other kind of animal and people always seem to have comparability problems with them.
     
  42. chkkll

    chkkll

    Member

    Joined:
    Jul 20, 2010
    Messages:
    40
    hahaha i loved the part toon shader being an animal... i dont have any problem with it actually.. i dont know how to achive toon outline with his shader editor...
     
  43. Frank Oz

    Frank Oz

    New Member

    Joined:
    Oct 13, 2010
    Messages:
    1,564
    Off the top of my head, something to do with fresnel or ramp lighting but based on view distance might do it. But again, I'm really aren't sure. The lighting and vertex side of things are all a bit mystical to me, like a girls bra when I was at school, I knew they existed, I knew what they did, but I'd be damned if I knew how to operate them..
     
  44. morris

    morris

    New Member

    Joined:
    Mar 2, 2011
    Messages:
    7
    Hi Stramit,

    I had a go at your UV pan example and was able to get my shader to work. Thanks a lot.

    I have an SSE question. I tried installing version Beta 4.0 but I can't get the preview window to work. It just appears pink. Could this be because we are using an older version of Unity? We are currently using 3.0.0f5. I know there some large descrepencies in shaders between 3.0 and 3.2. Anyways looks like we might be switching to 3.2 soon so I will try again and keep you posted!

    This is the error message that shows up in the compiler:

     
  45. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    Can you send me the graph that makes the pink material... that should not happen so there is a bug I need to fix there.
     
  46. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    For Beta 4 you need unity 3.2/3.3 a lot of the shader API stuff has changed internally.
     
  47. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    Bah! I completely forgot you wanted this. Sorry man, I'll do that tonight!
     
  48. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    Ah, the old DX and AA issue. I know how to fix this and it will be in Beta4.1 (it's caused by annoying dx antialiasing settings).
     
  49. Tim C

    Tim C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Messages:
    1,474
    Outline shader? It's in the demo pack, you should have read the post fully!
     
  50. Neptune_Imaging

    Neptune_Imaging

    Member

    Joined:
    Jan 5, 2010
    Messages:
    2,702
    ur the man...