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. jeffro11

    jeffro11

    Joined:
    Jan 7, 2010
    Posts:
    185
    Well he Unreal node has 5 outputs. RGBA, R, G, B, and lastly A. So one node that does all would be ideal instead of having an extra node cluttering up your work space. This is basically the only thing I can think of that this "should" have. I do realize this would take extra programming, it would just be nice to have.

    You are entirely right about having only individual channels being output. It would be a hassle. If everything was exposed in one node however, it would make everyone's life easier.
     
  2. porkymail

    porkymail

    Joined:
    Oct 13, 2010
    Posts:
    1
    There is an issue on my computer, no shader preview window. see screenshot> $unity.jpg

    I use Unity 3 free version on windows 7
     
  3. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    There is no preview on the free version... the best thing for now is to start a new shader... just do a diffuse, export the shader, name it and apply it to the model... that is what i have been doing when i make my shaders :)
     
  4. nalim

    nalim

    Joined:
    Apr 13, 2010
    Posts:
    118
    it looks awesome
    it is just where i searched for but i cant use it
    i got too many errors
    6 or something :(
    tell me if the errors are fixed
     
  5. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    Really great stuff, thanks for it. Been using ShaderFX a lot and this is fantastic.

    Two quick questions;

    - How do I get the light vector in as a vector node (like the view node)?
    - How do I split apart and recombine vectors (say I want .xy from one Float3 and .z from another and to combine those into a new Float3)?

    Also, is there a choice to have the equivalent of the "advanced" master shader node like ShaderFX? So we don't have to plug in each piece to it's relevant slot, we can calculate it all at once and simply plug it into ambient/each light pass/all lights at once/alpha?
     
    Last edited: Oct 18, 2010
  6. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    This probably isn't the quickest way, but you could multiply one of them by (1,1,0), multiply the other one by (0,0,1) and then add the results together.
     
  7. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    To split, we have a "Mask" node which will zero the irrelevant components to be added (Which I should actually check to see if it compiles optimally, pretty sure it does), which can then be added together again.

    For light vectors and manual lighting, those are explicitly separated with surface shaders, if you really want to access that now, there is the lighting function given in the .shader file you can modify as you see fit. A node-interface for that should make the coming release.
     
  8. LucidMovement

    LucidMovement

    Joined:
    Jun 11, 2009
    Posts:
    14
    Awesome work!! After using unreal for years I am stupidly happy to have the ability to do this stuff in unity. Thanks!


    I didn't notice a UV Rotation node anywhere, am I missing it? If it doesn't exist, that would be an awfully useful node to have.
     
  9. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    Cheers, good to know.

    I'm after a toon-shaded effect so I need the half-lambert dot product of the surface normal (including normal map) and the light vector to drive the U coord of the toon ramp texture sampler's UVs. I guess I'll write it in code until we get access to this sort of stuff in the shader editor :)
     
  10. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Is there any way I can fade between two normal map textures ? I tried Lerp but it gave errors, so I tried adding Normalise to the output, but that didn't help.

    Any way of doing this ?
     
  11. PvtHudson

    PvtHudson

    Joined:
    Oct 8, 2010
    Posts:
    20
    Hello,

    I was trying to make a shader similar to a "lightsaber", as described here: http://blenderunderground.com/forums/viewtopic.php?f=10&t=4305.
    From this screenshot http://i3.photobucket.com/albums/y65/NinjaKrow/3DBuzz/GlowMat03.jpg I built the following .sgraph, hoping to get something similar like this: http://i3.photobucket.com/albums/y65/NinjaKrow/3DBuzz/SaberGlowTest03.jpg

    $lightSaberSGraph.jpg

    And I got the following result, after applying the material to a Cylinder.

    $lightShaderSS.jpg

    Nothing close to the light saber effect that I was hoping to archieve. I tried placing a Directional Light with no luck. Whats wrong with my approach?
     
  12. jeffro11

    jeffro11

    Joined:
    Jan 7, 2010
    Posts:
    185
    Enable the Glow Image Effect. What your seeing there in the Unreal image is bloom. Enable it on your camera.
     
  13. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Can you post the graph / errors? Lerp should work.
     
  14. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Hmm, I got Lerp to work in the end, I'm not entirely sure what my problem is/was.

    I'll post again when I work out exactely how to reproduce it.
     
  15. Nikolay116

    Nikolay116

    Joined:
    Mar 21, 2010
    Posts:
    421
    wow you are just epic, guys!
     
  16. fremachuca

    fremachuca

    Joined:
    Oct 13, 2010
    Posts:
    26
    this is just full of awesomeness!! thanks a lot for this great tool!
     
  17. scarletsnake

    scarletsnake

    Joined:
    Nov 27, 2009
    Posts:
    106
    Hi,
    I'm trying to create a skin shader for Unity3 with your node based editor, but I'm stuck with the wrap ramp texture part...
    (The old skin shaders were pixel shaders so they dont work in Unity3, and I really have no idea on how it can be ported to work with U3...)

    Would you lend me a hand with the development of this particular shader? I've already set a thread concerning this issue but haven't received any help.
    I'm using the Jpg's provided in the skin shaders package I used before U3 came along. Here's what I have done with it;



    Completing this shader might be of help to many people, including me! :)
     
  18. Svyatoslav

    Svyatoslav

    Joined:
    Sep 28, 2010
    Posts:
    8
    Great editor.

    ToVec / FromVec nodes will be userful.
     
  19. PvtHudson

    PvtHudson

    Joined:
    Oct 8, 2010
    Posts:
    20
    Yes, indeed a very must have node!
     
  20. alejocadavid

    alejocadavid

    Joined:
    May 7, 2010
    Posts:
    20
    Hey there.

    Can someone guide me to make an outline diffuse shader with Shader Editor?? Outline Diffuse shader from wiki doesnt work i Unity 3 :(
     
  21. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601

    would be nice :)
    there is already a node to get out single components but not in such a convenient way :)
     
  22. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    I'm getting that problem I mentioned earlier again. I've attached a zipped .sgraph file that gives the error when exported.

    The error is:

    Program 'surf', cannot locate suitable resource to bind parameter "Gloss" at line 100

    Looking at the code at that point there is no obvious mistake.

    The problem seems to only happen if the material has 6 texture inputs, removing any one of them will get rid of the error.

    (This is weird though because I've made test graphs with more texture inputs than that and they have worked fine.)

    This is a WIP screen shot of the shader from this graph (if anyone's interested):



    It's just 3 textures blended together so I can make more varied walls.
     

    Attached Files:

  23. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Hey.
    Could you try using a MeshUV input instead of a specific material UV input? I am not at home (and won't have access to unity for 2-3 days), but this is probably caused by there being too many samplers in the vertex to fragment structure. Using Mesh UV's is a way of getting around this limitation.
     
    Last edited: Oct 22, 2010
  24. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    340
    stramit:
    Thank you so much for this great tool!
    i have a question about your shader editer,
    is there anyway that i could blur a texture with your great tool?
     
  25. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Thanks Stramit! That fixes it. Although it does stop the textures from honoring the "Tiling" and "Offset" settings, it is a small price to pay for it working.

    I tried taking the UVs from just one of the samplers and putting that into all of the Tex2D / Tex2DNormal nodes, and that also makes it work (this way I can still use the Tiling setting kinda).

    This is all good. I have another couple of questions.

    1) In the Scene view, if you change the rendering from RGB to Alpha, any material using a shader from the node based editor comes out pure white. I'm pretty sure that this is what's used when calculating the glow for the glow screen image effect, which means that any material I make with the editor will glow more than I would have wanted.

    If I put data into the alpha field then it becomes transparent, which is not what I want. Is there a way to write to this elusive channel ?


    2) Is there an easy way of making a parallax shader with the editor ? or do you have to do some arcane UV offset based on the heightmap and screen space normal ?
     
  26. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    I'm sure I read somewhere when I was writing the shader for my character that the diffuse has 4 channels and that setting the alpha to 0 rather than 1 will stop overbrightening. Perhaps see if you can multiply your diffuse output by (1,1,1,0) and plug that in?
     
  27. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Hmm, didn't make any difference :\

    It sounded like a good idea though.
     
  28. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    any news on your shadereditor 3.0?
     
  29. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    I tried using the Distortion shader that comes with the shader editor package, but it's giving me trouble.

    It seems to work fine in the ShaderEditor preview window, but in editor view, everything shown behind it is mirrored/upside-down.

    I assumed that this was related to the anti-aliasing direct x bug I've seen mentioned on the forums here, but turning AA on or off makes no difference.

    I also tried multiplying the normalizedscreenposition node by a constant (1,-1,1,1) but that just seems to break the shader altogether.

    Any thoughts? Is there a way to fix this in Shader Editor? If not, what can I add to the actual shader code to fix it?
     
  30. scarletsnake

    scarletsnake

    Joined:
    Nov 27, 2009
    Posts:
    106
    No help for the skin shader? Can you at least guide me in the right direction?
     
  31. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    There is no node to do this, and it would be quite expensive to do (one pass sampled Gaussian blur on texture sample). It's probably better to pre blur the teture in photoshop.
     
  32. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Sorry, I'm not familiar with the skin shader and you haven't provided much information about it / how it works / where you are having troubles. If you provide some more detailed information and link the current graph you are having problems with I might be able to help a bit more.
     
  33. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    I haven't seen this (but I normally use OSX). I'll have a look into it over the next few days as I am fixing other bugs.
     
  34. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Hi Rahuxx, In my sandbox I have both the custom lighting and vertex modification code working. The problem is I have not had very reliable access to a computer with unity for the last 3 to 4 weeks as I have been going to conferences and been stuck at work very late (9pm most nights, and I get up at 5:30 so I pretty much go home and crash out). Rest assured it is coming, my job has just gotten in the way of my original schedule.
     
  35. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Yeap, I understand your frustrations with this. It's a limitation of shaders in general. They only allow a limited number of outputs from the vertex shader into the fragment shader. What you were seeing is when you exceed this number. It's a frustrating limitation, but there is not much that can be done about it :(

    Not in the version you have. This is now on my todo list. In the mean time you can write to alpha as you would want for the glow effect, but then manually modify the output shader to turn of transparency. This is not ideal and I'll add a button to fix this.

    Beta 3 has a parallax node, it can be done in beta 2 but it's not easy. The best way to do it is to look at the unity provided parallax shader and emulate what it does. You will need to look into the BumpOffset function (I think that is what it is off the top of my head) to see exactly what it does. This can be found in the cg includes in your unity installation directory.
     
  36. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Because of the new shader model it might be a bit difficult to do. One way that might work is to use the fresnel node with the view direction, and multiply the color by this result. It would be like rim lighting, but dark instead of illumination.
     
  37. scarletsnake

    scarletsnake

    Joined:
    Nov 27, 2009
    Posts:
    106
    Here's what I'm trying to do:


    I'm trying to port the skin shader from Unity2 to Unity3. I've created 5-6 graphs from scratch and the image I've posted on page 16 is the closest I've been able to get, but it's not even close enough.
    (Here it is: )

    This was the description of the original shader:

    * It uses texture maps for doing wrapped ramp lighting (so you can tint the skin reddish for some real fake SSH)
    * It has a falloff ramp texture so you can simulate bluening of the skin where at grazing angles.
    * Full 2.0 shader - comes in diffuse / glossy with bumped and unbumped versions. They support shadows.

    It is a pixel-lit shader that requires vertex&fragment programs. Otherwise it falls back to built-in shaders.

    Assign one of the shaders from the Skin group in the material popup. The Shaders exposes 2 new textures compared to the normal shaders:

    * Rim Fresnel Ramp texture. Controls coloring of the skin at glazing angles. RGB should contain how the color changes, whereas alpha is used to implement fresnel falloff on specular. A "rimramp" texture is included in the package - assign this and then tweak from there.
    * Wrap Ramp: The ramp gradient used for coloring - this is used to control fake SSS of lighting. Assign the "wrapramp" texture from the package, and then tweak from there.

    And here's the link : http://www.unifycommunity.com/wiki/index.php?title=SkinShader2
    I've created some really groovy shaders with your editor but due to my lack of knowledge, I haven't been able to create my "must-have" shader :(

    Can you help me out?

    -Cheers
     
    Last edited: Oct 24, 2010
  38. Nick3d

    Nick3d

    Joined:
    Jan 28, 2010
    Posts:
    100
    I have a couple of questions about this wonderful package:
    - How can I control the intensity of a specular map? there is some kind of Value ( 0 to 1 ) in order to set the intensity? same thing can be done with normal maps?
    - Is possible to tile the textures? sorry but if there is I can't find the proper node :(
    - What is the best way to mix two different textures ( both of them plugged into Albedo )?
    - When there will be a shader library? I'll be damn happy :)
    - Is possible to have the same layout of your tutorial video? the one with the nodes on he right panel? working with the right click is a bit annoying...

    Great work dude :D
     
  39. silver-wind

    silver-wind

    Joined:
    May 8, 2007
    Posts:
    19
  40. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    340
    specular:try the node "pow" or "mutiply"
    textures:try scal their uv.
    mix two different textures:if you want alpha mix,try "min".if you just want to mix them,try"mutiply" or "add" or anything else.
     
    Last edited: Oct 25, 2010
  41. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    Yes you should rest, i think enough rest otherwise it will harm you health, and no one on the forum may like you fall ill, not even me.
    Will wait for you release whenever it comes, i just eager to know about updates.
     
  42. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    When using default shaders i am trying to use texture as a diffuse in place of color. In all this shaders you will find alpha color too.
    When using glow as a image post production effect this alpha values(color) helps to make object glow but not making object transparent.
    Now when i am adding alpha in my self made shader using shader editor it makes object transparent, i do not want this but i want to make object glow.
    Any idea what can be done?
     
  43. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    I asked the same thing on the last page, Stramit said this:

    "Not in the version you have. This is now on my todo list. In the mean time you can write to alpha as you would want for the glow effect, but then manually modify the output shader to turn of transparency. This is not ideal and I'll add a button to fix this."
     
  44. mift

    mift

    Joined:
    Apr 27, 2009
    Posts:
    17
    Great product!

    Just a quick note: you might consider highlighting the "update shader" button in a strong color, I often forget to update because im used to blenders node editor, which updates immediately, but I believe that this is a matter of taste :)

    Thank you for this community contribution, which I believe will make it into the editor natively.
     
  45. mift

    mift

    Joined:
    Apr 27, 2009
    Posts:
    17
    A weakness, IMO, is that you must save the shader first, before you can make use of dynamic values like _SinTime, _CosTime, etc. It would be really nice if those values would change while editing the shader. Is this possible?
     
  46. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    can you help me in this problem?
     
  47. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    I'm just planning on waiting for the next version, he said he's gunna add a button to fix it.

    I'm in no rush.
     
  48. Westmark

    Westmark

    Joined:
    Nov 1, 2009
    Posts:
    187
    You need to open up the shader afterwards in a text editor and disable the transparency.

    Probably by changing this value from this:

    Code (csharp):
    1.  
    2. "RenderType"="Transparent"
    3.  
    to this:

    Code (csharp):
    1.  
    2. "RenderType"="Opaque"
    3.  
     
  49. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    Thanks Stramit!
     
  50. Nick3d

    Nick3d

    Joined:
    Jan 28, 2010
    Posts:
    100
    Sorry about my stupid question, but something is not working right...
    I create the shader, save the graph and them I export the shader...but the problem is that when I try to apply it into Unity thru the list of all the materials, under shadereditor the only "shader" that is on the list is the EditorShaderCache....
    So, the dumb question is, where I need to save the exported shaders, in order to use them into the editor?
    If I'm not wrong in the video he save the shader under the Unity folder ( under program files? ) and then he can select the shader...well I tried to save the shader on that directory and on the editor folder of my project....nothing, no shaders selectable....

    I'm a bit lost, with this editor I feel like home since I'm using XSI, but this "little" thing is a big deal actually!
    Probably the answer is very simple, but I can't find a solution, can someone help me out?