Search Unity

Strumpy Shader Editor [Now Open Source]

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

  1. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    I'm trying to make some shaders for mobile platform. And when I test it on actual device there is some weird glitch that doesn't appear on PC even though I'm using OGL ES2.0 emulation enabled. It looks like some values is being clamped there where it must not to be. Most likely it happens in Lerp nodes...
    Can anyone help? Please!
     
  2. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    hjupiter, you can do that with a series of lerps if you're just starting to learn shaders (yes, I know there's more efficient ways). Get your splat map, and split the components.

    Lerp1 between Tex1 and Tex2 by R.
    Lerp2 between Lerp1 and Tex3 by G.
    Lerp3 between Lerp2 and Tex4 by B.
    Lerp4 between Lerp3 and Tex5 by A.

    If you're feeling confident, you can learn how to do that in a matrix (faster than a series of lerps). 5-texture is your limit from one RGBA image (0,1,2,3,4) (0,R,G,B,A), so if you want 7 textures you'll need another splat map OR you can use half a channel (R 0-0.5, R 0.5-1) with the associated loss in precision.


    Demnus, post a screenshot of your graph and what it looks like on the mobile. It's kind of hard to help otherwise. I do know that occasionally the specular on mobile platforms can freak out and the highlight will be 100% white of not there at all, with no falloff (sharp edge).


    MariuszP, you can do this several ways. If you know what quarter of the map you need (say U 0-0.5, V0.5-1), then it's simply a case of mathematically changing the UVs.

    NewUV (0-1) = Old U x 2, (Old V - 0.5) x 2

    U 0-0.5 x 2 = 0-1

    V (0.5-1 - 0.5) x 2 = 0-1

    This will go into the Ted2d Sampler's UV slot. This can actually be a bit helpful, because you can get 4 RGBA 512 maps into one 1024 RGBA map, saving 75% of your draw calls and only paying for some shader instructions. Of course it does mean you're completely at the mercy of compression, but with some luck it may not be too bad.
     
  3. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    1. Alright, I think I see how to do this now. I have a handful of crosshatch textures, and which one gets drawn is dependent on light level, it's not just intensity, so I wanted to do the texture read in lighting, but I realize if I'm careful with how I pack my channels I can squeeze the whole thing into one texture anyway, and pass it through custom, so I think this works out.

    2. This works in that I can make it tile, and it only scales symmetrically, but the texture still scales when the game window resizes, and I can't seem to make it draw 1:1 on the screen. Ideally, one texel should be one pixel here.

    3. I'll look into it.
     
  4. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    http://unity3d.com/support/documentation/ScriptReference/Screen.html

    That can help you, grab the screen resolution and then use math to tile the UVs appropriately. Shouldn't be too hard to tile it, just remember that screen res usually isn't a power of 2 (1024, 2048, etc) so you'll probably end up with the thing tiling by 3.75 or something to get 1920 or 1280.
     
  5. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    277
    Alright, I'll give that a go.

    Meanwhile, I made an attempt at the crosshatch shading, and I'm experiencing something weird.

    I've packed each crosshatching level (a greyscale mask) into a channel of an image. I left off the fourth level, in alpha, for now. I have a ramp that dictates which levels are drawn where. I'm doing the math like this. First, I split both the crosshatch image and the ramp. Then, I lerp a constant white with each crosshatch channel, using the corresponding ramp channel as a mask. Then I multiply them together to get a single greyscale mask. I use that mask to lerp my diffuse/albedo channel (right now just a brown color) and my crosshatch color (black). The end result is pretty good. It draws crosshatching over an image in lieu of normal shadows, that's pretty close to working how I want it to work.

    The problem is that it only works properly in the preview window. In the scene, this happens:

    http://imgur.com/lHm4S (Link to large image)

    Unlike in the preview window, the colors of the background and hash affect where the hash is drawn. As long as the R, G, and B of the background color are all either full or empty, and the hash is black, it seems to work fine with the exception of some color bleeding into the hash. However, introducing partial components to the background causes bits of the hash to draw lightly on places where it oughtn't (what channel is partial doesn't seem to matter), and lightening the hash causes it to draw where it shouldn't. If the hash is white, all three components just draw everywhere.

    It seems to me like lerp is behaving differently in the game. Any idea what could cause this, and what to do about it?

    Thanks!

    -Lou
     
  6. smiljan66

    smiljan66

    Joined:
    Jun 9, 2010
    Posts:
    610
    Im wandering what will be of strumphy with unity 4 and shader model 5
     
  7. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    This is screenshots of bugs with comparison photoshots from device.


    And this is the shader of terrain. I'm not sure about that this shader is 100% is the cause of the glitch, but it certainly have at least one of them.
     
  8. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Interesting. The best way to debug this is to disconnect nodes and find out exactly WHERE things are falling apart. From that it's a bit easier to back trace the issue.

    For example if you only put the diffuse channel in does it work? What about diffuse / normals?

    If diffuse by itself is broken where abouts does it break down. Binary searching the tress is the 'easiest' way to figure out whats breaking. When we know what is breaking it's a bit easier to figure out why and then I might be able to offer a solution.

    Edit: It's a sexy shader on PC though btw :)
     
  9. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey stramit, I am having some issues with the worldreflection node... the model will turn pink when i use it...and even stranger, it is the ONLY thing plugged into the shader... I also saw a reflect node... how would I go about using that?
     
    Last edited: Jun 22, 2012
  10. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey guys, I finally figured out how to get the parallax mapping to work, but now looking for a way to have the shader self-shadow... has anyone successfully pulled this off?

    Here is an image of what I have so far... thanks

    $Texture%20Differences.png
     
  11. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    Thanks ^^
    I guess I have pinpointed a problem. It's all caused by UnpackNormal node. I have assembled the shader without this node and it looks pretty much the same as on PC with it.
    For now I don't see any noticeable glitches, except maybe an inversed normals, but not sure about it(need to make fly-cam with touch control, for now I can only rotate it).
    And all this brings a question, how to make a platform independent all this, because now the PC version is broken... ^^
    Also, why I think its exactly this node. I tried to disable the normal channel, but normal map is used also in deformation of map in emission channel. So the glitches was partially there even I haven't used normals channel.

    Update: after all, looks like without this node normals are broken. And with it it's wont work as on PC... At least without this node it looks almost the same as on PC.
     
    Last edited: Jun 22, 2012
  12. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Unpack normal is a unity function that decodes a normal map. It works differently on iDevice and PC (as they both encode normal maps differently). If you are not using the node on decoding an actual normal map then it might not be the right node for you.

    This is how it's defined:
    Code (csharp):
    1.  
    2. inline fixed3 UnpackNormal(fixed4 packednormal)
    3. {
    4. #if defined(SHADER_API_GLES)  defined(SHADER_API_MOBILE)
    5.     return packednormal.xyz * 2 - 1;
    6. #else
    7.     fixed3 normal;
    8.     normal.xy = packednormal.wy * 2 - 1;
    9.     normal.z = sqrt(1 - normal.x*normal.x - normal.y * normal.y);
    10.     return normal;
    11. #endif
    12. }
    13.  
    Perhaps on iOS you want to use the PC decoding? Depending on what your input to the node is.
     
  13. MariuszP

    MariuszP

    Joined:
    Sep 28, 2010
    Posts:
    4
    Thx Jesus!
    I managed to use any quarter of texture with your help. The only problem I have is that my splat map is tiling when I try to tile quarter of diffuse.
    I think about two things:
    first - do the second UV channel or third (second is reserved for lightmap?) for splat map (don't know it is good idea).
    second - try to setup tiling on node before Tex2D function (don't know it is possible) so i will have 1 tile of splat map and let say 20 x tile of first quarter of diffuse.

    Any ideas? :)

    Like always sorry for my bad English and for nooby questions but it's my first time with shaders things.

    Regards
    Mariusz
     
  14. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    Post up a picture of your graph, so I can see what's going on. Generally it's good practice to break up and/or tile what you need to, then use the result in the same way you would use a normal texture (by that stage it should have it's own links ready to be plugged into RGB/A and UVs.

    It sounds like you're also also changing the UVs of the splat in the shader as well, which probably won't work, unless you want to tile your splat UVs by splat UVs. Caution: do not try that at home. Great depth is required - a splat map within a splat map. Three splats deep is impossible. We need to go deeper.
     
  15. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    Actually I'm Android user.
    I'm really not directly use actual normal map, instead I'm calculate it by one map and numbers of parameters. On PC this node works perfectly. I tried to recreate PC version of it and on PC it also worked, but on device it still not worked. It just act as there is no normals at all. But result of it correctly distorts colors in other channels...
    This is the custom unpackNormals branch.
     
  16. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    Found the solution. It was my mistake. I had to unpack normals first, but instead I tried to work with them and unpack it along with my own generated values... So it's no wonder there was glitches when mobile decoding of normals takes place.
    So, sorry to bother and thanks for help. ^^ (but, I'll be back with more questions of this kind ^^)
     
    Last edited: Jun 24, 2012
  17. MariuszP

    MariuszP

    Joined:
    Sep 28, 2010
    Posts:
    4
    O.K i spent all day on this shader. I have working splat map and I can successfully select any quarter of diffuse map. Only thing that I can't get is tiling of quarters - it work on 1x1 tile, but when I try to tile it more all quarters appears.

    I think I'll stay with four textures instead of one 2x2. It is beyond my capabilities.

    Here's graph.
    Regards
     
    Last edited: Jun 24, 2012
  18. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Bump. Good morning from Beantown, I am still trying to get this parallax environment shader to self shadow, and also to get reflections working in world space, but the damn shader keeps turning pink. Maybe someone could take a crack at it... attached is the shader graph from strumpy (graph is huge) still trying to get it to self shadow or fake it...

    View attachment $NI_Supershader ENV.rar

    Thanks a bunch.
     
    Last edited: Jun 25, 2012
  19. Julien-Lynge

    Julien-Lynge

    Joined:
    Nov 5, 2010
    Posts:
    142
    Apologies if this has been answered before - I've read through many pages of this thread and my eyes eventually glazed over.

    Are there any examples of some basic shaders done as sgraphs? For instance, a few of the Unity built-in shaders (http://docs.unity3d.com/Documentation/Components/Built-inShaderGuide.html)?

    I also have a question about lighting - forgive me, this shows just how new to Cg and shader programming I am: How can I write a shader graph where lighting will have an effect on the emission channel? So far, I have a texture I'm sampling and applying to the emission. How do I then get the lightDir at that point and use it to modify the emission? The goal is to create a 'nighttime lights' effect: I'll sample from a 'lights' texture acting as a mask, then use the light intensity (gleaned from the lightDir and the normal) as another mask so lights are at an emission of 1 on the 'night' side and 0 on the day side.

    Thanks much!
     
  20. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I ran into an issue with my glass distortion-effect shader. I'll try to explain the setup with some screenshots.

    Imagine a window with a distortion effect applied to the window glass. You can see the distorted window border in the glass.



    Now when I move my camera until the black window border reaches the end of the screen border this happens...



    The distortion "snaps" to the screen border as if the last pixel row would be stretched out into this direction. This appears only at the right and top screen borders. This is explainable with the the distortion being the screen image moved to the bottom left by the "offset" of the distortion as the distortion technique I'm using is exactly the same as the SSE example. I think this is a general problem with all distortion shaders when you move your camera in a way that the distorted objects are near the screen border.

    My idea for a fix would be to cut away the window borders from the distortion by applying the inverse texture alpha channel to the GrabTexture, but this would be quite a workaround so I'd like to ask some more experienced shader programmers for advice.

    EDIT: Is it even possible to apply an alpha channel to the GrabTexture after sampling it and modifying the UVs of the RGBA vector afterwards? It doesn't seem like it. Sampling with the modified UVs and applying the alpha channel afterwards won't cut away the window border properly from the GrabTexture as it's already been distorted all over the RGBA vector.
     
    Last edited: Jun 30, 2012
  21. skankest

    skankest

    Joined:
    May 30, 2012
    Posts:
    15
    It's been brought up a couple times in the thread but I haven't seen any solutions.

    How do you make a two sided shader. Namely, I want a shader that uses additive blending and you can see the back side of the each normal through the front of the object.

    A little while back Neptune_Imaging posted this:
    Can you share your graph or just explain how to approach flipping normals when you are looking at the back of a face. I've tried passing a -1 value to the z input of the assemble node to see if I could just outright flip all normals. Needless to say this didn't work.
     
  22. skankest

    skankest

    Joined:
    May 30, 2012
    Posts:
    15
    To create a two sided material all I had to do was set the CullMode to off (in settings). The problem I am having is with additive blend mode and the two sided material. See images below:



    As you can see the back faces are represented inconsistently. Sometimes you can see the back face being blended with the front face other times you can't. Right now the graph is super simple: a diffuse texture, CullMode = off, blend type = custom one one.

    any ideas?


    UPDATE - PROBLEM SOLVED:
    If you turn "Write Depth" off in the settings then the above visual glitches will not happen. So to have a two sided additive shader go into settings and do the following:
    - turn off CullMode
    - turn blend type to custom, src to one, and dst to one
    - turn write depth off
     
    Last edited: Jul 3, 2012
  23. chfreezer

    chfreezer

    Joined:
    Jul 3, 2012
    Posts:
    1
    Same problems,Anyone to help me.PLZ
     
  24. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    You should always use the "Clip" output for cutout shaders, this means that transparent pixels below the cutoff value won't be rendered at all and won't be written to the depth buffer (therefore being really transparent and ignored by "light rays").

    This is a texture issue. With a cutout shader using the "Clip" output you can configure the cutoff value fairly easily and set it in a way that the white border disappears. The way to really fix these borders and not just hide them would be to use a separate alpha channel in your texture (has to be done in your texturing software), that way you can set the background color for transparent pixels to whatever color you like. This has been discussed several times, for example here.

    If you want to have both alpha testing (cutout) and alpha blending (smooth borders) it's best to make two shaders and assign two textures to the renderer. When you render the cutout shader first (by setting the rendering queue appropriately) you will get alpha tested pixels with hard edges in the first pass and alpha blended soft edges in the second pass. This article is a must-read.
     
  25. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    Stramit, Hi.
    There something weird happens with new update of unity that affect shaders made in SSE.
    After update to unity 3.5.3 one of my shaders have started to add some greenish tint, where alpha isn't 1 or 0. I have downgraded to previous version of unity and it's work perfectly again. But it can be something related to SSE and popup in future as it's related to some changes in unity itself.
    Can you, please, look into that matter?
    Thanks.
     
  26. tigg

    tigg

    Joined:
    Mar 2, 2011
    Posts:
    6
    How do I use vertex colours with Strumpy Shader editor? I want to blend between three sets of textures based on the Red Green and Blue channels of the vertex colours I've made in blender. However, I've no idea how to split the different channels up. I've tried Split and Splat nodes, but none of them seem to actually isolate individual channels properly.

    thanks
     
  27. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Good morning Stramit,

    I have been using Beast a lot in my work lately, And I have some questions involving using Strumpy to work with Beast... now I have this simple graph, and when I want to use Beast with it, I get the diffuse bleed, but no emissive glow... and I am wondering if it is my naming convention or something like that... perhaps you could shed some light on this... thanks.

    https://dl.dropbox.com/u/158971/Simple%20Shader%20for%20beast.jpg

    EDIT: Found an old post... had to put self-Illumin in the shader name... kinda weak if you ask me, but it gets the job done :)
     
    Last edited: Jul 6, 2012
  28. Spartan_Boy

    Spartan_Boy

    Joined:
    Jul 8, 2012
    Posts:
    38
    Hi all, great thread here, I have a question regarding flowmap, which node can gather diffuse, emission, spec and parallax nodes while still being all driven and influenced by a flowmap ?
    THX in advance!
     
    Last edited: Jul 8, 2012
  29. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    depends what you mean by 'gather'. What I suspect you mean is you want to drive the animation of the diffuse/emission/spec/etc with a flowmap, in which case you want to plug your flowmap into the UV node of the tex2d.

    So grab the UV from Sampler2d, do your flowmap stuff to it,then plug that into the UV node of Ted2d.
     
  30. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    I'm trying to make a shader for doing diffuse, specular, two normal maps, with fresnel cubemap reflection. You can see the result so far in the picture. The problem is, I can't get the diffuse map to work (it only works with the colour you see here). If I connect the diffuse map, the surface goes pink like there's an error.

    It's for doing wet surfaces. The two normal maps are for adding rain drops onto the existing normal map. All of that works fine. This is my first reflection shader so let me know if there's a better way to do something.
     

    Attached Files:

  31. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    Try deleting the sampler2d and tex2d nodes you've got for the diffuse and deleting the input for them as well.

    Then grab some new nodes and a new input, and multiply the RGBA from Tex2d by _Color and plug that into diffuse.

    If that's still giving you trouble, then check the settings. See if it's gone and set itself to something weird (like double multiply blending) and maybe try it on a different shader model.
     
  32. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    Thanks for the reply. I tried what you said but it still went pink. I forgot to mention before, there's a whole lot of errors with the shader in the console. Too numerous to mention, it looks like it's complaining about everything, basically.

    I got it to work once I removed all trace of the second normal map (no errors). Here it is in the screenshot. I'm quite happy with it in this form, fresnel has intensity and ratio control. I'm still new to shader creation so I get a kick out of achieving what I already new about from years of using materials in Max.

    So the question remains, is it possible to have two normal maps and a diffuse map? Did I reach a limitation? I've included the settings I've been using in the screenshot.

    I'm including the two node graphs. One for the single normal map and one for the double normal map. The BumpX2SpecularFresnelReflection shader is the one from my previous post (not working).
     

    Attached Files:

  33. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Nice looking shader man :)...
     
  34. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    I think I have solved my own problem that appeared after last update of unity.
    It was related to GL blend function. In change log there was mentioned that they have "fixed" decal blend mode. I have used it for alpha blending. But now it works somehow different and I had to change it to custom mode: Src_Alpha / One_minus_Src_Alpha
     
  35. Deni35

    Deni35

    Joined:
    Jul 10, 2012
    Posts:
    43
    1. Why a simple shader requires the tangents?
    I generate a mesh in the runtime and do not want to create tangents.
    2. How to make vertex lighting?
     
  36. tigg

    tigg

    Joined:
    Mar 2, 2011
    Posts:
    6
    How do I make an unlit shader? I want to use it for UI things which don't (and shouldn't) be dynamically lit.
     
  37. iossif

    iossif

    Joined:
    Mar 4, 2011
    Posts:
    332
    this may have been asked but i am not finding any answers.

    i have a very simple problem... i have a texture with alpha channel and i want to display the texture with the alpha cut out. i did set the shader to transparent cutout and i gave the alpha channel as the clip setting. this does not work and i am not sure how to do it correct.

    here is what i do:

    $splat.png

    when i update the shader i still see my alpha area as black in the shader and not as seethrough.

    thanks for your help
     
    Last edited: Jul 11, 2012
  38. tigg

    tigg

    Joined:
    Mar 2, 2011
    Posts:
    6
    you need to experiment with the blending settings and queue settings in SSE.
     
  39. Grieva

    Grieva

    Joined:
    Jul 12, 2012
    Posts:
    4
    Is there a way I can set up UV coords in a vertex shader?

    I'm currently using a tex2D with UVs set by normalised screen coords + an offset in the pixel shader. This is giving the effect I want but I thought it might be quicker if I set the UVs in the same way but in the vertex shader and just interpolated for the values in the pixel shader.

    Can I do this using strumpy?
     
  40. Demnus

    Demnus

    Joined:
    May 14, 2012
    Posts:
    34
    You can't use normalized screen position in vertex graph, so guess not.
    Also there is no UV inputs in general node of vertex graph. But once I did passed the calculated UVs from vertex to pixel graph trough vertex color channel.
     
    Last edited: Jul 12, 2012
  41. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey guys, I am still seeking out answers on how to use the reflect node since I am still getting errors when I use WorldReflection in my shader graph, and the reflect node is not really demonstrated... has anyone had any examples on how to use this shader to create reflections on a surface?

    And also, has anyone had any luck with setting up self shadowing with parallax mapping? Thanks a bunch

    EDIT: I got the reflections working :)

    EDIT 2: The reflections are not showing up correctly :(... and the worldreflection node only works if I pull the UVs out of the shaders, but then I will not be able to tile... I also use MeshUVs but I can't tile with that either... and I need to be able to tile...
     
    Last edited: Jul 12, 2012
  42. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Hi there!

    I've been trying to get the alpha channel of a simple diffuse working in Unity without success. I couldn't find a solution to this problem by searching through the 130 pages of this thread and on Google. Some people shared the same issue, but I couldn't find any answer that worked.

    My setup is really basic and I don't know why it doesn't work. I've tried multiple things (with and without transparent as type or queue and with several blend mode). Sometimes transparency simply don't work (it's either dark or not there at all)



    ...and sometimes the diffuse isn't affected by light (which is non-acceptable for my game).



    If somebody could help me that would make my day.


    **UPDATE: It seems like even the Unity transparent shaders ignore light... Does anybody know if a workaround exists?
     
    Last edited: Jul 13, 2012
  43. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    You will need to use this setup. And plug the alpha port of a texture node into port one of the subtract node... and use a float const and set it to a low number. For shadows to take advantage of the alpha, check Advanced Shadow Pass. Hope this helps. BTW, plug the splatalpha into the clip node

    $Alpha.png
     
  44. Santolin

    Santolin

    Joined:
    Jul 13, 2012
    Posts:
    3
    I just downloaded the editor and played a bit with the examples. It is really nice. Thanks :D

    When it came to the lightramp example I got a weird result, though, as you can see here (I didn't touch a thing in the graph!):

    $ramp.png

    Would anyone happen to know what the problem is?
     
  45. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    To Neptune_Imaging: Many thanks, it is perfect :)
     
  46. SinisterMephisto

    SinisterMephisto

    Joined:
    Feb 18, 2011
    Posts:
    179
    Hi guys after watching the GDC presentation i was wondering if it is worth trying to make Oren Nayar(diffuse) and Cook torrance (Specular??) in SSE. I have been looking for a good and effient version of any of the two so if anyone can point me in the right direction i would be happy. I saw 1 udk graph for Oren Nayar and it was super huge and looked pretty confusing.
    I wonder if there anyway to make even SSE graphs look neater.

    Lastly, I tired the normal warp in SSE

    Code (csharp):
    1.  
    2. //warp normals rather than blending
    3.     //can scale normal before blend
    4.      
    5.     float3x3 nBasis = float3x3(
    6.             float3(n1.z,n1.x,-n1.y),
    7.             float3(n1.x,n1.z,-n1.y),
    8.             float3(n1.x,n1.y,n1.z));
    9.      
    10.     n = normalize(n2.x*nBasis[0]+n2.y*nBasis[1] + n2.z*nBasis[2]);
    11.  
    View attachment 36415


    The results left me confused.

    Overall i am trying to create a skin shadder like NCAA12 of FIFA12 on the pc
     

    Attached Files:

    Last edited: Jul 17, 2012
  47. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    222
    Hi. Im trying to make planetary atmosphere shader, but Im very new to it. Is there a way to make alpha to be 1 on lighted side of object and go to 0 on unlighted? And ins there any way to make shader double-sided? Thanks.
     
  48. darkmag07

    darkmag07

    Joined:
    Jul 18, 2012
    Posts:
    1
    I keep getting this error whenever I try to save out my shader. I'm not sure what is wrong with it.

    "Save Shader Error
    Cannot update shader, there are errors in the graph"

    I've got a screenshot of the pixel graph attached. Nothing seems to be wrong, but I'm new to shader editing so maybe I missed something. I'm working on a shader for cars for our game. The cars need to use two main textures, a flat one that we can change the color of and a "decal" one with things we want to keep the same color between paint jobs (the grill, Ford logo, license plate, etc). All that is taken care of in the top part going into the Diffuse and that doesn't give me any errors when I save out a file with just that portion of code.

    Today I tried to simulate the speckled paint look and now I run into errors. You can see the speckling happenig around the specular highlight which is exactly what I want.

    EDIT: Apparently it isn't actually my shader? It works fine when I use my custom shader on meshes and I'm not getting the error since I loaded a new shader from the default ones instead of leaving my custom shader in the pixel graph when I press the play button.
     

    Attached Files:

    Last edited: Jul 18, 2012
  49. lucidcoder

    lucidcoder

    Joined:
    Mar 23, 2010
    Posts:
    138
    Just a quick noobish question, I can't find the preview window, all I see are buttons for "File," "Comments," and "Graphs." Is there a button or keyboard shortcut I'm missing?
     
  50. texasjakit

    texasjakit

    Joined:
    Jul 19, 2012
    Posts:
    2
    Looking for some good literature on the Lighting Graph. Good stuff in the pdf's, but nothing on lighting. The default lighting turns my material black. Pixel Graph has reflections, custom lightmap, normals, and other. Current shader looks really good with no custom lighting... but I can't get any custom lighting to work. If I was going to hard code this, I would use viewDirection and everything, but it seems I can't use that in lighting graph. I'm not really looking for Fresnel yet... plus, if I use Fresnel in lighting graph, I can't use a viewDirection anyways. Just looking for some literature, but this thread is way too long to browse, and search brings me to page 1... Ugh...