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

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    yup...i have a SM 5.0 card
     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Hrrm? Unity is SM3.0 max. Shader defaults to SM2.0 unless you select 3.0 in the settings.
     
  3. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458

    I know lol... i have the GTX 570
     
  4. zeldafan_mimo

    zeldafan_mimo

    Joined:
    Jan 27, 2010
    Posts:
    23
    Free Version :( .. It doesent show there Does it ? Or will it even work then ?
     
  5. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    thanks Frank Oz, stg like this ?

     
  6. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    yep!
     
  7. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    Thanks Frank Oz, here how it looks atm.



    one more question, how you conect the alpha of the diffuse map in the alpha of the shading?

    actually my diffuse map is a TGA 32bit with alpha channel.

    thanks
     
  8. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Use the A from TEX2D and output it where you want it to be used, like RGB.
     
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,624
    Yeah, actually, what do you want to use the alpha for?
     
  10. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    is for use the alpha of the diffuse. in Maya is automatic. if your TGA diffuse map in 32bit and have alpha channel, Maya attach it automatically to the transparency node.

     
  11. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Well you gotta remember that Unity isn't Maya, and that everything handles texturing and surfacing differently, especially when it comes to Maya, Softimage, Lightwave, Blender, Cinema4D, Truespace etc. etc. etc.

    Also, SSE is creating a shader from scratch, which in your case is the equivalent of one of the programmers on Maya having gone in and written the piece of code to tell it to use the alpha automatically. So if you want your custom shader built from scratch to do that, you have to tell it to do that.
     
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,624
    Exactly. And when you program a shader (with SSE and without), you can use the alpha map for anything pretty much. It's just another channel with data in it, and you can use it to drive what you want with it.

    I'm still not clear what you want to use the alpha map for though (I'm not very familiar with maya).
     
  13. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    thanks guys! but looks like is not working. i updates the shading but nothing change.

     
  14. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    I'm gonna guess one of the following

    Using it as an emissive texture for lights and such on the model
    A splatmap to show another texture through it
    A way to control the brightness of the main texture (like a Diffuse map in Lightwave)
    A Reflection map
    The standard Gloss map (which could combine and be used for a reflection map)
     
  15. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Are you trying to make some parts transparent? The Alpha, as AcidArrow said, can be used for anything as Unity treats it like any other texture. Adding it to the Alpha of the Shader will simply tell the Shader to use it in the Alpha (so it would effect things like the Glow image effect), but to create transparency you need to do other things so the Shader knows it's transparent, and then the alpha can be used to control the transparency.
     
  16. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    AcidArrow, the alpha is for the transparency mask of the diffuse. here how it looks in maya.

     
  17. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,624
    Yeah, raton you have to explain to us what you want to do.

    You could post a screenshot from maya and how it looks, then how it looks in unity so we can understand the intended effect and help you.

    EDIT: Ah you did that while I was typing. Hang on, I'll post in a bit, if frank doesn't get to it fist :p
     
    Last edited: Mar 31, 2011
  18. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Ok yeah, by the looks of it you're wanting a clip map/cut out type shader (you'll get hard edges, but there's nothing in those railings that requires full transparency).

    The problem there though, is you don't want to use a shader set as transparent, for a mostly solid object (as I understand it anyway). Your best choice is to give the railings and the rest of the model, two materials. One solid and regular, one setup as a cutout transparency shader. Then setting the alpha for the transparency and a range node to fine tune the cutoff point of the transparency on the railings.
     
  19. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    im only looking use the alpha of my diffuse map. it don't will be hard edge cause the alpha map isn't only white and black ( 1 or 0 ) it have a gradation gray scale in the borders of the edges. im working in the video game industry per 8 years so i believe there is a easy way to make it. connect the alpha channel of the diffuse to the transparency node is one of the basic things in the video game industry. i believe you know about it.
     
  20. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Some strange stuff.
     
  21. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    How do you do a fresnel effect?
     
  22. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Add a fresnel node
     
  23. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Uh, I'm a newbie to this ;)

    I'll try my hand at it then ask questions ;)

    Thank you
     
  24. Tinfoilfez

    Tinfoilfez

    Joined:
    Dec 9, 2009
    Posts:
    14
    Try adjusting the blending settings. I dug thru the forum and found that comment from Stramit. I just tried it and it seems to work.
     

    Attached Files:

  25. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hey, I wonder, can I make image posr-process effects using strumpy editor? Like, output only depth to screen
     
  26. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    Hey I am new to this shader editor and I am hoping for some help... I am just messing around trying new things... and i simply cant get a gloss and spec working together... only individually.. check the screenshots... let me know if its glaringly obvious why. :)
     

    Attached Files:

  27. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Very strange, the same setup works fine for me
     
  28. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    im using unity 3.3
     
  29. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    I am using 3.2
     
  30. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    hmmm... any idea if a fix for this issue is coming?
     
  31. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    You need to turn the shader model to 3.0 in the shader settings. If you look at the error it is saying that there are too many instructions for an SM2.0 shader.
     
  32. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    I'll have a look into this. I use a custom lighting model and I might be doing something bad without realizing it.
     
  33. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    thx stramit, forgive me for being a total noob.
     
  34. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Hi ratonmalo,

    Because a real time renderer is very customizable (and unity is no exception) you need to tell it exactly what you want to do with the alpha channel. You have made the right first step by plugging the alpha into the alpha channel but not you need to configure how this channel is used.

    Because you want to do alpha blending the first thing you need to do is go into the setting tab and change the object to render in the transparent queue, with a rendertype of transparent. You should also disable depth writes (but leave depth testing at lequal). You also need to set blend mode to custom with src:srcalpha and dest:eek:neminussrcalpha.

    What this means is that the object will be rendered after everything (in the transparent queue) and because it hasn't written to the depth buffer it will not have masked anything before it, by this I mean you are drawing this object on top of what was drawn before it and the alpha value will determine just how much of the stuff rendered before can be seen.

    As your object is quite large and complex it's considered bad practice to render the whole thing as transparent as it slows down the render pipeline and can result in artefacts. A good idea is in your 3d app to slpit it into multiple materials with the opaque materials being non transparent in your game and only using transparency where it's really needed. Normally in a game for what you are trying to achieve alpha blending is not used and clip is used instead. Using clip has many performance advantages vs blending.
     
  35. Patyrn

    Patyrn

    Joined:
    Feb 17, 2011
    Posts:
    57
    I see you have an outline example, but what if you wanted to black line all the edges of a model? Is that possible?
     
  36. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Not in a shader editor, it would require some code and tech. You could use the GL class (unity pro) to achieve the effect by rendering the mesh again after you have drawn in normally:

    http://unity3d.com/support/documentation/ScriptReference/GL.html
     
  37. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    Tinfoilfez, that's it! is working now, thanks! :)



    stramit, thanks a lot. it help me to understand how it work. Just i was missing the blending settings.
     
    Last edited: Apr 1, 2011
  38. ozekky

    ozekky

    Joined:
    Apr 1, 2011
    Posts:
    6
    Hello

    Strumpy Shader Editer is correspond to ios?
     
  39. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,624
    Hi ozekky. I guess SSE shaders will work on ios (if you use openGL ES 2.0 that is), but generally, since you are trying to squeeze as much performance as you can from a mobile device, it is better to write them yourself.
     
  40. ozekky

    ozekky

    Joined:
    Apr 1, 2011
    Posts:
    6
    >AcidArrow

    Very thank you.
    I was relieved to hear it.
    I will try it.Thank you!
     
  41. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Quickie question stramit! Hopefully before beta4b is ready to roll.

    You know how the ramp lighting isn't taken into account with the lightmapping? Is it possible that that could be fixed, or is that just one of those things we have to accept can't be fixed or changed?
     
  42. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    I doubt it can be fixed. Beast doesn't really know anything about the shader you are using besides some basic things like diffuse and emission (assuming you name your inputs according to the convention it expects). What you could maybe do is allow beast to bake it, then use your own shader that disables Unity's lightmapping stuff and pass in the lightmap texture and atlas coordinates so that you can use or discard the lightmap information as you see fit.
     
  43. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Hmm, so no way to realistically use both at the same time then? Kinda sucks, but I suppose with careful lightmapping to get a similar look and then careful use of the ramp lighting on dynamic objects, it could still work out nicely.

    Well one less thing for me to worry about then :D Cheers mate!
     
  44. kraemology

    kraemology

    Joined:
    Oct 20, 2010
    Posts:
    20
    Does anyone know if there is any way to create a shader where the object itself is completely transparent, yet still receives shadows and also casts shadows. I've already browsed the forums and found one particular solution that came very close, but still not exactly what I'm after. In my search, this thread came up, but before I browse through 75 pages of info I was wondering if anyone knew the answer off the top of their head? Thanks in advance
     
  45. Morc

    Morc

    Joined:
    Jul 21, 2009
    Posts:
    31
  46. noradninja

    noradninja

    Joined:
    Nov 12, 2007
    Posts:
    420
    I know this has been discussed repeatedly, but is iOS support coming along? I have exported some stuff to iOS, and it *mostly* works, but I get graphical glitches on both my iPT 4G and a 1G iPad:

    iPod Touch:

    $photo.png

    iPad:

    $iPad.PNG

    Coloring on the iPad is off (sign should be green, kinda bluish) and and obviously there are stray pixels and blocks of color that dont belong. Anyone else seen this on the devices or know a workaround?
     
  47. Chaoss@Perdition

    Chaoss@Perdition

    Joined:
    Mar 10, 2011
    Posts:
    37
    I've found a bug, Doesn't support alpha/transparent textures no matter what settings i put in
     
  48. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Not a bug.
    You need to change blending to srcalpha and oneminussrcalpha or something like that.
     
  49. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    I wrote a description on this very page about how to do this and there are included examples in the shader editor release :(
     
  50. Chaoss@Perdition

    Chaoss@Perdition

    Joined:
    Mar 10, 2011
    Posts:
    37
    OK I've done that but a spotlight shines onto the fully transparent area :/