Search Unity

Strumpy Shader Editor [Now Open Source]

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

  1. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Oh that's normal as far as I know, you wouldn't want a default texture set in the shader, you'd have to always carry that texture with the shader into every project its used if that were the case.

    Setting textures inside SSE is really just for the preview's sake. To set textures properly you need to make a material to use the shader as you normally would, and do it there as you would for any shader/material.
     
  2. Spinland

    Spinland

    Joined:
    Jan 13, 2011
    Posts:
    77
    Ah, okay, the light has dawned. So it's not enough for the shader to be dragged onto the material, I have to go in after and attach the texture in the materials editor in the regular Unity panel.

    Okay, live and learn.

    Question for you, now: I have a really nice shader defined based on the rim shader that came with the Editor. I'd now like to make the whole object partially transparent so things inside it show through, but I can't find the correct functions or settings I'm supposed to use for transparency. Is this something that has to be done using an alpha channel texture, or can I simply assign a transparency function to the diffuse somehow (or none of the above)?

    Thanks again!
     
  3. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    It's up to you. First you have to set the shader as transparent and for it to appear in the queue so it's rendered last over geometry. From there you can use a range or a texture an alpha a color. I'd have to go mess with it to see for sure, don't remember off hand exactly how it's done.

    Edit: Ok yeah, the rest is just to set the blendmode, then whatever is controlling the alpha will control the transparency.


    rename the file extension to .sgraph it wouldn't let me upload it unless I changed it to .txt.
     

    Attached Files:

    Last edited: Mar 16, 2011
  4. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    So did anyone explain how to make emission affect lightmap?

    Also what's the difference between clip and alpha?
     
    Last edited: Mar 17, 2011
  5. smiljan66

    smiljan66

    Joined:
    Jun 9, 2010
    Posts:
    610
    i i want to increase the normal bump value im using shader fusion im wander if i know some one has do the same wiht this strumph but to work you will only have to increase the red and blue values or geen too?
     
    Last edited: Mar 17, 2011
  6. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    ShaderFusion has it's own thread, you might have better luck asking Shaderfusion questions in there. But yeah, all three should be modified.
     
  7. smiljan66

    smiljan66

    Joined:
    Jun 9, 2010
    Posts:
    610
    thanks
     
  8. smiljan66

    smiljan66

    Joined:
    Jun 9, 2010
    Posts:
    610
    Last edited: Mar 17, 2011
  9. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    That's the one, was made by the author so it's as official as you're gonna get.
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Oh my god, what have I done.
     
  11. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Can't figure out how to make my object transparent using a transparency map.
     
  12. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Spinland - what was said is correct. For everything apart from the texture the values will be input into the shader, but we didn't want to couple preview texture with material as it makes the shaders less portable, it will use what you set as the 'default' property. I might remove the texture button on non pro to stop some confusion.
     
  13. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    -Sample the texture and input the channel you are using for transparency into the alpha input.
    -In settings go to blending
    -Turn on 'custom' blending
    -set source to srcalpha
    -set destination to oneminussrcalpha

    This will give you standard alpha blending. You can mess with the blend settings to get 'more awesome' combinations! Next release I will probably pre-configure some defaults.
     
  14. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    I'll put together an example at some stage over the weekend.
     
  15. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    I get
    Error no matter how many textures I use if I also have this in my graph.

    Even if i have only this, no other textures or anything, I still get the error.
     
  16. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    It's due to using the world reflection node it adds like 3 interpolators due to requiring the TBN matrix, in settings change the shader model to 3.0 if you require normal mapped reflections. But if 'simple' reflections are okay then use the 'Vertex Reflection' node.

    If you require normal mapped reflection I fully recommend using Mesh UV's instead of texture UV's and it will also really limit what you can do in the shader because of limitations in shader model 2 and 3. That is, if you stat doing things marginally complex you will still run out of interpolators in SM3.0 as well :( It's frustrating but nothing can really be done :(
     
    Last edited: Mar 17, 2011
  17. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    You should really get a wiki for this project.
    Would be very useful and users could contribute in an organized matter.
     
    Last edited: Mar 18, 2011
  18. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    So just how would you go about doing the whole snow coverage type blending thing? I think I'm on the right track with worldnormals and splitting it up to only appear on a certain axis etc. but seem to be getting the blending effect above and below at the same time, which doesn't look right heh.
     
  19. smiljan66

    smiljan66

    Joined:
    Jun 9, 2010
    Posts:
    610
    wrong image i have to reopen and show a interesting graph of skin shader some one gave me
     
    Last edited: Mar 18, 2011
  20. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Use a dot product with the direction that you want the snow to be in and then saturate. If they are in the same direction the value from the dot product will be > 0 otherwise it will be below. You can use this value to input into a lerp to determine the amount of blending to use.


    In this example I'm using a y value 1 to see how 'upwards' the normal is.
     
    Last edited: Mar 18, 2011
  21. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Awesome!! Thank you, worked perfectly! :D :D :D


    Oh and just to be annoying (sowwy!), don't suppose you know how the builtin shaders manage to use the specular effect inside the alpha do you? It seems like it should be easy but haven't yet been able to get the actual end result to be used (the actual bright specular effect). Is it something to do with the lighting graph or vertex one? Those two seem pretty alien to me.
     
  22. Chaoss@Perdition

    Chaoss@Perdition

    Joined:
    Mar 10, 2011
    Posts:
    37
    It looks great, but theres some features that you've messed up

    First UV2 does not work, it just gives the material a rainbow appearence, and second the preview mesh is always black, and you cannot preview the shader with textures on it, I used that a lot and now it's gone.

    edit: never mind fixed problem 1
     
    Last edited: Mar 19, 2011
  23. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    UV2 works, your object needs a second UV to be able to use it though.

    Preview works but is only available on the Pro version of Unity, add temporary textures from the input window to see them in the preview, but as stated further up the page these aren't saved with the shader for obvious reasons.
     
  24. Chaoss@Perdition

    Chaoss@Perdition

    Joined:
    Mar 10, 2011
    Posts:
    37
    OK thanks I got it working, except my shader is now bright pink wih an error "Shader error in 'Buildings\Standard': Too many texture interpolators would be used for ForwardBase pass at line 33"
     
  25. Chaoss@Perdition

    Chaoss@Perdition

    Joined:
    Mar 10, 2011
    Posts:
    37
    Got that problem fixed, needed to be shader model 3 (not 2). But i'm stuck on how to add specularity to a diffuse texture
     
  26. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    What do you mean by 'add specularity to a diffuse texture'? SSE is quite flexible so you can specify specularity how you want. You can use a full texture or you can use a color input or whatever you want. The trick is that if you are specifying a specular input (which is a color) you also need to specify a gloss input. The gloss determines the falloff of the specularity.

    You should have a look at some of the included example shaders, they will be able to teach you a lot about how to use the shader editor and many of the questions you have asked should be answered pretty quickly with some examination.
     
  27. GameLvr

    GameLvr

    Joined:
    Mar 22, 2009
    Posts:
    115
    hi guys,

    I'm trying to repair my shaders made before the Unity 3.2 release and can't find the MeshUV component from Inputs for specifying UV channel

    any idea what we should be using/doing instead?
     
  28. ayanami0

    ayanami0

    Joined:
    Feb 22, 2011
    Posts:
    8
    Finally found time to play around with 4.0b So far everything is working really well! Awesome work! Love the preview window! Love the speed! Love the corrected gloss naming! Love the UI

    There's a few things I would love the preview window be modified though:
    1. Please set the Near Z value of the preview window to 0.0001 or some value close to zero to prevent parts of preview object that are close to camera being clipped off
    2. as 2dfxman1 mentioned.. Please add the ability to assign pan and zoom to other mouse buttons, depending on the users.. some people used to max some people used to maya, etc But heck I should be happy to have any ;)
    3. the option to flip rotation direction, as right now dragging mouse button up and down rotates preview object up and down respectively, but dragging mouse to left and to right rotates preview object right and left respectively. Its just a minor wish as compared to 1 and 2, but its just abit confusing and not intuitive.

    As for new copy and paste. Is it possible to make copying nodes from one sgraph file to another also copies properties? It threw me off abit when I tried to quickly copy some of my old templates to form a new graph, and found out that they created many "not configured/Not Connected to valid Porperty" errors.

    I would also love to eventually see a feature for right clicking on the node to select the entire upstream nodes/ or down stream nodes.

    BTW, is ramp lighting example deferred compatible?

    This is truly a great upgrade!
    James
     
    Last edited: Mar 19, 2011
  29. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey stramit, I am still kinda stumped on this manual blending thing that you told me about... do you think you can show a quick demonstration of how to set this up... all I want in my shader now is for it to see black and white values from 0-255 cleanly... like for example for doing hair... and making sure you can get the soft look to it

    Thanks a bunch :)
     
  30. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Seems to be for me (though lightmaps don't play nice with it, from what I've seen so far).
     
  31. Chaoss@Perdition

    Chaoss@Perdition

    Joined:
    Mar 10, 2011
    Posts:
    37
    I've managed to complete my building shader, it has windows that can light up at night (a slider), shiny windows, an AO map and now slight specularity. Can a script control that slider to 'slide up' for night (using a real time sky)?
     
  32. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    It should be able to, how.. is a question probably answered in the scripting references. But I think yeah it's entirely possible. Maybe check out the bundled Water effects that come with Unity? The pro water one uses a script to handle the reflections from what I remember, so yeah I don't see why you wouldn't be able to do it. Shouldn't even be "that" hard to do either.

    Edit:
    http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=material

    Yup, entirely possible! :)


    The post below holds the correct answer :)
     
    Last edited: Mar 19, 2011
  33. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
  34. Chaoss@Perdition

    Chaoss@Perdition

    Joined:
    Mar 10, 2011
    Posts:
    37
    ah ok thanks, i was expecting a bleak 'no' lol, glad it can be done
     
  35. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Nah, those replies are reserved for the "lets make an MMO" and "can we have shadows in Unity free?" threads. :)
     
  36. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Could you elaborate a bit more? What version of the editor were the shaders made on? If you load a shader in created version +1 then save then keep doing that until you are at the current version it should be okay. When 1.0 comes out we will start looking at 'cully backwards compatability' but for the current rapid development it gets messy and compex far too quickly.
     
  37. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Hey James,

    The new preview window we have is pretty extensible. For 4.0a we really just wanted to get it in and working properly. Moving forward we will iterate on it and improve the functionality, adding zoom and pan and other features like that ;)

    The Ramp lighting example is deferred compatible but not lightmap compatible. This is because lightmaps are applied internally by unity and you don't get access to that code. You would need to bake 'ramp lighting' light maps which I don't believe it is possible to do in unity currently (if you used your own lightmapper and shaders though you could do it)
     
  38. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    Alternatively you can go into photoshop and posterize the section of your lightmap that corresponds to your object.
     
  39. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Good morning everyone from Boston,

    After playing with SSE 4.0, I truly love how fast it is to create a shader using this powerful editor. And as a result I would love to share my newer version of my NI Shader.

    New Shader Features:

    Additive Gloss (Texture): With this feature, you can use a mask (black and white of varying ranges) to define shinier areas of your model. With no texture, this will turn off...

    Additive Strength: Changing this value will make the shine stronger, such as for shiny latex.

    Additive Spread: This will also change the way the highlight will falloff. (added this as a preventative measure)


    Next on the list:

    -- Fully controllable Transparency Blending
     

    Attached Files:

  40. Robbilie2

    Robbilie2

    Joined:
    Aug 4, 2010
    Posts:
    262
    awesome project ;)
     
  41. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    633
    Congrats for SSE 4.0 MASSIVE thanks for your work, it's like you have the source license.
    Any chance we see SEE opening surface shaders AND then constructs a graph based on them after parsing the instructions and then allow us to edit them from SSE. I'm really shy to ask you that, the SSE itself is a huge piece of add-on for unity. ♥♥♥
     
  42. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    That would be an amazingly complex and difficult thing to do. Very cool, but trying to parse whatever random stuff someone (like me) throws into a shader and fit it into the available nodes would be a serious challenge.
     
  43. Baardo

    Baardo

    Joined:
    May 9, 2010
    Posts:
    98
    I recently downloaded it and cant stop messing around with it. Love this tool. Except it seems to occasionally crash Unity.

    Oh but I'm curious as to how to do 2 things.
    Currently I modified the Rim Lighting graph that comes with the program so that it can have spec normal and diffuse maps. I noticed that the rim lighting runs along the normals of the geometry and not the new ones of the normal map (hope I phrased this right) In other words it lights it as if it were smooth in areas where the normal map is supposed to make it rough. Is there anyway to make it so the normal map effects the rim lighting?

    And the second is I'm trying to do some form of faked SSS not sure how to do this, (I think I've seen it done with ramp lighting?) Anyone have any suggestions for methods on that?
     
  44. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    For the first one, using the worldreflection with the normal input seems to work (from what I remember). For the second, I suppose something with emission would work for faking SSS and as you say ramp lighting too.
     
  45. Baardo

    Baardo

    Joined:
    May 9, 2010
    Posts:
    98
    Thing is I don't know how to do ramp lighting, the ramp lighting graph that comes with the download only has a color node (obviously pretty new to the program) and the exported shader is kind of messed up.

    oh and I fixed the first problem, didn't bother looking for a normal input on the fresnal node. :p
     
    Last edited: Mar 20, 2011
  46. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Earlier in the thread the author posted a video on how to do the ramp lighting. But I admit the lighting and vertex graphs don't seem as well understood as the pixel one.
     
  47. Baardo

    Baardo

    Joined:
    May 9, 2010
    Posts:
    98
    Just looked through the topic and couldn't find said video... Mind pointing me in the right direction? :p
     
  48. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    http://vimeo.com/20994055 it was in the beta4 announcement post. Also there's a ramplighting example that comes with SSE.
     
    Last edited: Mar 20, 2011
  49. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Need some tutorials on creating proper transparency(the one op told me for some reasons hid everything behind it, not just the object it was applied to. Also need a tut on creating refractions and other cool stuff.
    I would create tuts but sadly my knowledge in shaders or SSE are 0.
     
  50. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    There's a transparency example graph included (Distortion), take out the bits you don't need, leaves a basic transparent shader. just remember to check the settings menus and adjust those when making shaders, especially transparent ones, or they'll end up opaque.