Search Unity

Strumpy Shader Editor [Now Open Source]

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

  1. warby

    warby

    Joined:
    Mar 23, 2009
    Posts:
    162
    here is a picture of the graph:

    http://warby.bitproll.de/projects/9999_wip/warbys_uber_shader.jpg

    here you can grab the shader and the graph file:

    http://warby.bitproll.de/misc/uber_shader_v1.zip

    there is also a "light" version included that doesnt use any normal maps in case you make a game that is more in a cartoon style like pirates of new horizons where normal-maps just look wrong. the full version clocks in at 100 instructions the light version at 58.

    if you have any questions on how to use this shader ( a lot of extra care has to be taken with every asset in maya !) just post here or send me a pm !


    if somebody has any optimization suggestions let me have it as well ! (i wanted to have the detail map and the blend mask be the alpha channel of the normal maps so i could reduce the total amount of textures used to 4 ... but unity doesnt seam to like normal maps that have alpha)
     
  2. warby

    warby

    Joined:
    Mar 23, 2009
    Posts:
    162
    btw does anybody know if/how i can scale individual channels of a texture ?! i want to only scale the alpha by 64x64 and leave the r g and b channel at 1x1 ?!
     
  3. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Thanks a lot warby!
     
  4. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Do you mean scale the uv's or scale the value? If the uv's just do two samples of the texture. One with the default uv and another with the uv multiplied by 64. Just take the a from the sample you have multiplied by 64 and the 'normal' rgb from the non multiplied sample. Make sure that you also set the wrP mode for the texture up properly in the texture settings.
     
  5. warby

    warby

    Joined:
    Mar 23, 2009
    Posts:
    162
    actually yeah that would do ... why didnt i come up with that its so obvious ^^


    has anyone noticed that objects with custom shaders dont seam to get dynamically batched by unity ? are my shaders set up wrong or is this a known behavior from unity !?
     
  6. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    I'll look into this warby. I have heard reports of it before but haven't looked into why.
     
  7. windexglow

    windexglow

    Joined:
    Jun 18, 2010
    Posts:
    378
    Is it possible to detect the edges of objects without pro? For example I want to have many shapes and styles of windows. I want the glass to have a bit of grudge along the edges - I want to make a shader that will add that little grudge line at the edge of the window model.
    example

    The place where the frame meets the glass has a bit of dirt, pant, ectect. Look at your own windows and they'll darken a tad at the edges. There are 2 main ways I can think of doing this.
    1: Add extra vertices to the glass and color them. This adds higher polygon count complexity on my end. This also isn't very configurable to the size of the window.
    2: Texture each pane of glass. Obviously the least effective.
     
  8. ayanami0

    ayanami0

    Joined:
    Feb 22, 2011
    Posts:
    8
    Dear Strumpy,
    Thanks for the awesome editor!

    I am wondering if you can give us a couple more examples on custom lighting?

    Keep up the great work!
    James
     
  9. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Custom lighting isn't in yet AFAIK.
     
  10. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    This is the way I would do it. I would paint the vertices in your 3d application and use those to blend in the grunge. You could add a slider that makes the grunge fall off over that distance (using pow) so that if you make larger windows you can scale the grunge back :D

    Thanks James!

    It's in currently and works. It uses a shaded lighting model (between deferred and forward) and is relatively 'simple'. This means though that shaders developed in SSE will look the same in both rendering modes (within a small margin of error). At some stage I intend to add an 'advanced' lighting model that will allow you to use the light vector and other 'non light prepass' constructs. The issue will be that these shaders will only work in forward mode. I am making some improvements to the custom lighting for beta 4, but it will not be advanced lighting.

    This will include a TF2 style ramp shader example :D
     
  11. Cyber_Punk

    Cyber_Punk

    Joined:
    May 15, 2010
    Posts:
    4
    Thanks Strumpy for an awesome editor seeing as no one on our Dev team atm knows to much about scripting shaders this should defiantly help I suppose this is one less con when it comes to the Unity vs. UDK debate...
     
  12. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Could someone please writte me shader for normal, diffuse and specular texture map. So shader should get input from three textures: diffuse, normal, specular. Also an addition with adjusting or correcting color over model would be nice ( like unity shaders already have).

    Please help me i really cant get that editor working.
     
  13. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I have a shader that can do that... it is a few posts back...it is called the NI_Character_Shader... I plan on add some mask channels so i can tint the character :) feel free to play with it
     
  14. ayanami0

    ayanami0

    Joined:
    Feb 22, 2011
    Posts:
    8
    @janpec
    If you can't find it, I've PMed you, I'll send one to you
     
  15. WarpedAxiom

    WarpedAxiom

    Joined:
    Oct 27, 2006
    Posts:
    245
    Is anyone else having issues with SSE 3.3a being extremely sluggish? Typing, for instance (such as comment and texture names) require 2 seconds per character. It's still usable, just very slow.
     
  16. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Thank you guys. Appretiate your help,
     
  17. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Hm i didnt get any respond from ayanami, Neptune can you give me link to your shader?
     
  18. dlshores

    dlshores

    Joined:
    Feb 16, 2011
    Posts:
    2
    I've had the same issues with the editor (and I really really want to use this!);

    I have narrowed it down to two lines; I started with the rim lighting that comes with the editor. It generates these two lines:


    float4 Fresnel0=float4( 1.0 - dot( normalize( float4(IN.viewDir, 1.0).xyz), normalize( Fresnel0_1_NoInput.xyz ) ) );
    float4 Pow0=pow(Fresnel0,_RimPower.xxxx);

    But if I change them to this it works:

    float Fresnel0=( 1.0 - dot( normalize( float4(IN.viewDir, 1.0).xyz), normalize( Fresnel0_1_NoInput.xyz ) ) );
    float Pow0=pow(Fresnel0,_RimPower.x);
     
  19. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    The only thing is, I am still adapting it to SSE 3.2 and I think i have it fixed
     
  20. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    There was an issue on extremely large graphs. If you pm me your email address I'll send you an updated dll which fixes the issue.
     
  21. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    @dlshores can you elaborate on the issue you are seeing? It has not been reported at all. Please send me some copies of the graph./ screenshots highlighting the issue so I can diagnose it. I don't actually understand what you issue is from your original post.
     
  22. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Neptune i dont need it to be fixed for sseditor 3.2 all i need is shader file.
     
  23. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Oh okay...i will be more than happy to share it again... i recently updated it
     
  24. dlshores

    dlshores

    Joined:
    Feb 16, 2011
    Posts:
    2
    Sorry, I should have mentioned I was talking about the problem XpycT was having. To recreate the problem; open Unity, create a new Shader Graph, add a multiply, a color and a float. Link the multiple to the Albedo, link the color to Arg1 of the multiply and the float to Arg2. Update the Shader and you get an error.

    $BadShader.png

    I also get error messages by loading the RimLighting Shader. Here is the generated shader file: View attachment $PlanetTest.shader

    I am runing on 64 bit windows 7 and using 3.2.0f4 version
     
  25. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Can you please contact me via some IM service? I have gmail chat and MSN? PM me the details, I need to ask some more questions about this (XpycT never responded to some PM's requesting more info).
     
  26. falkonragno

    falkonragno

    Joined:
    May 31, 2010
    Posts:
    29
    Hello everyone, hello stramit, well I have a question I downloaded last StrumpyShaderEditor-Beta-3.3b and I create a blank project, then I imported the StrumpyShaderEditor-Beta-3.3b package but when I just import it I saw this two error messages inside TempShader.shader, does any one know how to fix it, Im using win 7 x64, unity 3.2f4 last version and Nvidia 480gtx with latest drivers, player settings for Mac and PC standalone, by the way the picture posted by dlshores above show how I see the editor with an error in the sphere,
    Deferred rendering path, Last time I used was with Unity 3.0 and I remember it worked, but now I'm not sure was going on, thanks any help in advance...

    Shader error in 'ShaderEditor/EditorShaderCache': Program 'frag_surf', incorrect number of arguments to numeric-type constructor (compiling for xbox360) at line 111

    Shader error in 'ShaderEditor/EditorShaderCache': Program 'vert_surf', incorrect number of arguments to numeric-type constructor (compiling for xbox360) at line 111
     
  27. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    I've actually just been talking with some users about this. It's an issue with the 360 shader compilation path. I don't have a 360 or PS3 unity license so it's impossible for me at home to test these shader permutations. Did you recently add 360 support to your unity install? I am quite confident that I have tracked down these issues and will have a fix in beta 4.

    If there are any 360 / PS3 unity users out there that wish to use SSE can you please pm me and I will get you a pre release copy of beta 4 (it may be a bit buggy) in the next week or so.
     
  28. falkonragno

    falkonragno

    Joined:
    May 31, 2010
    Posts:
    29
    Hello Stramit, just to say thanks for your quick reply, I also want to clarify, I want to build my project for PC and Mac standalone, I create a blank and clean new project and add the package and after that I saw those error messages, my player settings is set to build for windows and mac, rendering path deferred and I dont want to compile for xbox, I think it have something to do about unity 3.2 cause I use StrumpyShaderEditor before with unity 3.0 and I did the same and it works with out any error message, I imported the latest StrumpyShaderEditor package and it works then, the only difference this time is unity 3.2 maybe some else is having the same problem, or maybe is only me? what could be wrong with my unity editor....?.. appreciate any advise..
     
  29. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    As I'm not a 360 unity user I can't say what might have changed between 3 and 3.2. I believe that unity compiles all the shader permutations for available platforms even if they are not 'active' this might be a new change for 3.2 I can't say.

    Just to confirm you do have a 360 license even if you do not currently have it active? I will have a fix for this issue asap, but it might be a few days as I need to finish Beta 4.0 before I can make another release.
     
  30. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    Any chance of this going up on the asset store so that it's easier to up date?
     
  31. Mumasboy

    Mumasboy

    Joined:
    Feb 24, 2011
    Posts:
    15
    Hi, trying to create a snow accumulation shader that automatically blends two textures based on the world Y normal and the normal map combined. At first I thought I'd cracked it, but later realised that the normal map only worked when the object was aligned correctly, i.e. if you turned the object upside down the normal map contribution was upside down. Is there a simple way of converting the unpacked normal map into world space opposed to model/tangent space?

    $snowshader_stripped.jpg

    This is a stripped down version of the shader, i.e. normal and spec removed, just the albedo part of the shader

    p.s. I am by no means a coder... just a lowly artist.
     
  32. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Neptune where is your link for shader?????
     
  33. warby

    warby

    Joined:
    Mar 23, 2009
    Posts:
    162
    i would highly suggest against that work-flow just make your self a shader like my "uber shader" (or use my uber shader) and fade between rock and snow with your vertex alpha you will have much more control over it and i promise you it will ultimately look better !
     
  34. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    The problem with that is that it's object based, not world space based. So you can't have a nice snow line or accumulation effects that can be altered at runtime.
     
  35. ayanami0

    ayanami0

    Joined:
    Feb 22, 2011
    Posts:
    8
    I don't know if I am doing it wrong or not, but apparently the Normal Unpack node in 3.3a causes my object to be lit wrong. but if I by pass the unpack node everything would look not as bad..

    @ janpec
    sorry for the late reply, I've sent you the sGraph to your mail, the shader should have coloured specMap, except that unpacking oddity. So I've also included a set of disconnected nodes with unpack version, if this problem only happens in my computer, then just replace everything that goes into the normal input with the unpack version.

    Cheers
     
  36. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    I'll have a look into that ayanami0

    Anyway, here is a screen of how Beta4 is shaping up... I'll leave all the figuring out whats going on up to you out there in internet land.

    Click To Enbiggen
     
    Last edited: Feb 24, 2011
  37. Clamps

    Clamps

    Joined:
    Nov 7, 2009
    Posts:
    220
    Hi all,

    Part of the shader I'm making requires emulating the way the standard Reflective/Diffuse shader works. Specifically I need to be able to use a colour swatch to adjust the amount of the Reflective Cubemap one can see. The way it drops down from 100% visible to fade down to black when you change the colour in the swatch.
    The problem seems to be that I don't know how to modulate the RGBA of the TexCUBE node to make it behave like that. I've tried multiply, and add, and POW... Also, apparently adding the multiplied result to the raw RGBA was supposed to work, but it didn't.
    Anyone know how to get that effect?
    (and before you ask, I can't use the default shader, as I need it to do other things too...) :)

    Ok, fixed it. Thanks to Goal in the IRC for his help.
     

    Attached Files:

    Last edited: Feb 25, 2011
  38. JasonB

    JasonB

    Joined:
    Dec 29, 2010
    Posts:
    103
    I appreciate all the work that went into this, but just as a quick bit of feedback, I've been programming for over 5 years and have done cinematic work in Lightwave for over 10, but I'm still completely lost even when using something as simple as this node-based editor. Consider that my testimonial for now... lol.

    I really think that without some intermediate or higher background in shader languages, it's impossible to grasp how to assemble a shader. The idea that with the introduction of a graph editor, artists can make their own shaders, is a very romantic and highly sought after idea, but in practice... I still can't make heads or tails of all this, and neither can any of the artists I've approached.

    Fully understanding that this is all still beta, of course! Just trying to find ways to improve the editor (for my own sake; if this ends up failing, I'll be left with no option but to use only the default Unity shaders, and that's a scary thought!).

    If this functioned more like Lightwave's node-based surface editor, I'd be overjoyed, but it would require a lot of work on your part (for instance, instead of us having to assemble an entire fresnel effect from scratch out of nodes just to create a simple visual effect, you'd have to include a kind of do-it-all fresnel node that lets us set values and maybe then includes code only for the features from it that we've decided to use, for speed's sake). Otherwise, I don't see how beginners will ever get mileage out of this. The ShaderLab/GLSL/etc. lingo, logic, and language barrier is too great for an artist (or even a 5-year programmer) to grasp how to assemble a shader to do exactly what we want it to. I don't even know where to begin with computing various values. It would help greatly if there were tooltips that taught/showed what values were being outputted by the nodes (for instance, for a View Direction node, I don't know if it's outputting a float, a Vector3, a rotation, or what, and if it is outputting say a Vector3, how do I access each individual axis of it, etc. which also means by extension I don't know what to mathematically do to the output without just slapping random operations together and hoping I get what I want). I understand that as an advanced shader programmer yourself, it might be hard to imagine why I'm having trouble with a node editor, but just the wordage used is not standard for typical programming and not intuitive.

    Lastly, I was always curious, is there some sort of software restriction that would not allow Unity Free to display shader previews or was it a conscious decision? That's one of the biggest hurdles I face right now as someone trying to learn. Having to recompile, wait a few seconds, switch back to my scene and observe my surfaced object every single time I change just one little thing. At this rate, I might grasp how shaders work by the turn of the century. :) Wish there was a better way.

    Not sure if you have any plans on making this more usable for and more directly targeted at beginners, but I would highly recommend it. I'll bet most people who want to use this in the first place have no knowledge at all of shaders or the lingo associated with it, and if you could find some way to make this accessible to these people (right now it's still pretty far out of reach for us lowly artists and game programmers), I think this could easily become a must-have add-on.
     
  39. Clamps

    Clamps

    Joined:
    Nov 7, 2009
    Posts:
    220
    Jason, I'm an artist with absolutely zero coding skills. I've been using this editor since it was released to us, and I have to say that it's made it possible for me to make shaders. You're right that the shader language is not a realistic option, but I can tell you that I've used this tool many times.

    Please don't assume I'm saying it's perfect. It's not (yet).

    You're pretty much right about how it would be better with nodes that cover some of the more common combinations. Perhaps they'll get onto that. It would make things faster.

    The thing about the free version not being able to show you the preview has to do with Unity, not this editor. (I think).

    Anyway, my point is that as a known non-coder, I can say that this tool works.
     
  40. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    The preview window uses render to texture which is a pro only feature.
     
  41. Clamps

    Clamps

    Joined:
    Nov 7, 2009
    Posts:
    220
    Aha! I knew there was something.

    Btw, I just used this tool (and some help from people who know more than I about this stuff) to make a shader that has a cubemap, 2 parallax layers, masking with an alpha and adjustable values. There's no freaking way I could have done this by hand, as I wouldn't know a function from an aubergine.
     
  42. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    From my experience this interface seems pretty similar to node-based editors in general, including Maya, VJ tools, terrain generation tools, and visual programming tools. (I haven't used any of those that much, aside from 5 minutes here and there and looking at screen shots).

    I'm not super fast, but I can code shaders just fine, and I don't consider myself to have been "programming for over 5 years." But I use this because I can get the job done faster for all but the most custom things.

    My guess is that you have the skills needed, but you're simply in that really awkward phase of learning a new tool. The phase where you feel like you're beating your head against the wall and getting nowhere really. I'd say just keep at it until you break through. Every single time I learn a technical creative tool that's what happens to me at least. It always feels awkward and painful and ghetto at first, and then eventually you get used to it and often times grow to like it.
     
    Last edited: Feb 25, 2011
  43. no204

    no204

    Joined:
    May 27, 2010
    Posts:
    7
    Hi!

    Is there any quite acceptable workaround for worldreflection at SM2? VertexReflection would be a good start, but I'd like to use this with normalmaps. I do not need the exact same good result, but a close one would be nice. I do not want a complete solution, some ideas also fit well. Thank you in advance.

    Please help.
     
  44. gfxguru

    gfxguru

    Joined:
    Jun 5, 2010
    Posts:
    107
    im new to shader editor...

    Can somebody help me to make a transparent material with reflection...

    How to use cubemaps correctly???

    please do help...
     
  45. Mumasboy

    Mumasboy

    Joined:
    Feb 24, 2011
    Posts:
    15
    Hmm not exactly what I wanted. I have already created an "Uncharted" blend shader which is all well and good, I was just trying to create a procedural snow layer shader partly as a test of the editor.. and secondly it would be useful when working with instances, e.g. rocks that can be rotated, scaled etc in Unity without having a massive library of hand blended assets. I know the results of a hand crafted asset will always beat a procedural one, but for mass use and background objects something like this would be useful.... I know it's possible, it's just whether Strumpy can do it is another thing.
     
  46. chaos1986

    chaos1986

    Joined:
    Mar 29, 2009
    Posts:
    230

    I tried this, it's sort of possible but you'll lose a lot of hair trying
     
  47. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    I remember way back you were trying to get this working in 3.x. It's still being problematic? It worked just fine in 2.6.1 as well didn't it. :(
     
  48. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    can we write a shader that can be used in active stereoscopy?
     
  49. warby

    warby

    Joined:
    Mar 23, 2009
    Posts:
    162
    ah okay yeah i wasnt 100% sure about your application. sorry that i cant help with the tangent space -> worldspace math :)
     
  50. gfxguru

    gfxguru

    Joined:
    Jun 5, 2010
    Posts:
    107
    What all things are to changed in the master node to make a shader transparent????