Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

SAS - Standard Anisotropic Shader

Discussion in 'Assets and Asset Store' started by DavidMiranda, Jan 11, 2016.

  1. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Standard Anisotropic Shader, (SAS) aims to model the light behavior seen in striped micro-surfaces. Such cases may be brushed metal or many types of fabrics.
    Apart from an anisotropic BRDF, it introduces some options to model other types of softer cloth such as velvet or wool.
    All the content seen in the images is included in the package. Check the documentation for more information and tutorials.
    Buyers of Cloth Shader for Unity 4 can upgrade to this new version.

    Some samples of what can be done:
    Carbon fiber:


    10-12-2015 22.44.37 x5.jpg
    Metals:
    sierra.png 06-12-2015 17.19.27 x1.png 11-01-2016 14.24.29 x5.png 11-01-2016 14.24.36 x5.png
    Fabrics:



     
    Last edited: Sep 26, 2016
    nxrighthere, GamerPET, Arkade and 4 others like this.
  2. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,153
    Looks great! :)
     
  3. GameTechnix

    GameTechnix

    Joined:
    Oct 5, 2015
    Posts:
    84
    Really nice shader!
     
  4. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    Hmmm - is this not compatible with 5.3? I installed it and get pink objects - even in the demo scenes..... or is there something I'm missing?

    This is in a fresh scene - nothing but the shader package imported - Unity version 5.3.1f1

     
    Last edited: Jan 18, 2016
  5. pauldrummond

    pauldrummond

    Joined:
    Oct 30, 2014
    Posts:
    89
    I tried the web demos but the shaders don't seem to work. Textures and alpha channels seem to be missing. Is it because I just updated to the latest version of Unity (5.3.1f1)? Perhaps the browser plug-in has a problem.
     
  6. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    Hey Paul,

    You might have to force re-install the web-player to the latest version to get it to work since the latest Unity installer doesn't install the player any more. I've seen this when I tried to play a new (5.3) build on machines that had the old (5.2) player installed - it can sometimes require a full uninstall/reinstall/restart cycle, but sometimes it just works with an install of the new player.

    (Oh - and FYI - the demos work for me, but the asset itself gives me only the dreaded Pink Material of Death)
     
  7. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Thanks for helping others.

    Well, many of you have emailed me regarding an issue with 5.3. As you can check, I submitted it with 5.2, so I didn't know it won't work in newer versions.
    To solve it replace unity_LightGammaCorrectionConsts_PIDiv4 -> UNITY_PI / 4.0 in StandardAnisotropic.cginc
     
  8. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    809
    Could this asset be used for hair? Or it doesn't have alpha channel?

    Regards,
    Carlos
     
  9. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    The blend mode I implemented is alpha test. I would suggest to use a multipass render for hair. First pass with alpha test and alpha blend on top. Your idea sounds interesting indeed. I should implement alpha blend too.
    Thanks.
     
    nxrighthere and hopeful like this.
  10. rastinrastini

    rastinrastini

    Joined:
    Jul 8, 2010
    Posts:
    158
    Hi
    is it mobile ready?
     
    GMT likes this.
  11. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    81
    Are you... are you just using 2 meshes for carbon fiber? :( I bought this asset solely for that fancy carbon fiber look and you didn't mention it have to use 2 meshes\2 materials?
     
  12. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Humm... well, carbon fiber is not lacquered by definition. Its basically a fiber framework, it could be lacquered or not.

    But anyhow, this sounds like a good idea for the next update. Thanks for that.
     
  13. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Hey guys,
    The next update will split the shader into 4 different versions:
    • Opaque
    • Opaque lacquered
    • Cutout
    • Transparent
    This will help to optimize the shader. Otherwise, I would have to compute unneeded passes.

    The transparent one casts shadows, btw. Next step will be to make experiments for hair shading.

    2016-02-14_16-17-31.jpg

    For the lacquered version I have included a single parameter for fresnel reflectance:

    upload_2016-2-14_16-31-7.png

    Let me know if you will need extra parameters for this extra layer.
     
    hopeful likes this.
  14. Berno

    Berno

    Joined:
    Oct 29, 2014
    Posts:
    26
    I'm also wondering if this is mobile compatible??
     
  15. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Can somebody confirm this?
     
  16. Berno

    Berno

    Joined:
    Oct 29, 2014
    Posts:
    26
    I'm assuming you don't have an android device to test on?
    As an initial test you could install the Android SDK and in Unity switch platforms to Android and see how it runs in the editor. Then see if you can build an APK successfully.
    While this doesn't guarantee it will run properly on android it is a good test to see if you are using anything unsupported right out of the gate.
    Anybody with more knowledge please correct me if I'm wrong!
     
  17. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    Could you make this shader compatible with Alloy?
     
  18. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    573
    Any way we can see a video of the cloth animating to see how well the shader behaves on dynamic objects?
    Because I am seeing things like Ambient Occlusion which are "supposed" to be performance hogs.
     
  19. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    620
    The AO is from an AO map (it's near the top in the Asset Store files list).

    @David_MG
    I second the request for seeing the cloth animating, please! (and, in fact, seeing the cloth in the video for this version! (cars and balls are lovely but cloth is the reason we're here!))

    I'm guessing the AO is required? Does that imply animating the cloth doesn't look so good? (Guess I'm asking what are the bounds of usefulness of the asset?)

    Thanks, Rupert.
     
  20. HardcoreDev

    HardcoreDev

    Joined:
    Oct 15, 2015
    Posts:
    1
    How can I use this shader in the version 5.1, I get an shader error "in 'Standard Anisotropic Transparent': unrecognized identifier 'Unity_GlossyEnvironmentData' at Assets/Standard Anisotropic Shader/Shaders/StandardAnisotropic.cginc(132) (on d3d11)"?
    I can not use a later version of Unity, since there is no longer support web player and my web player builds are broken in these versions.
     
  21. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    I sent you the modified version for 5.1, right?
     
  22. sekiguchi

    sekiguchi

    Joined:
    Mar 10, 2015
    Posts:
    2
    I use this shader in the version 5.4.
    I found artifact with Lacquered.
    I hope the next update.
     
  23. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Hi. I found an error in the shader. The result was black if no lights in scene. Fixed now.

    2016-09-14_20-43-48.jpg
     
    crudeMe and hopeful like this.
  24. sekiguchi

    sekiguchi

    Joined:
    Mar 10, 2015
    Posts:
    2
    Thank you for update!

    I test version 1.2.

    But the artifact is not fixed.

    I tested a fresh scene and default settings.

    Is there a setting that I need to be careful?
     

    Attached Files:

  25. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Im sorry, but I have no idea what's going on. Im am rewriting the lacquered version right now. If you want to test it, mail me.
    So yes, the lacquered thing. I have been playing with it and I miss a secondary occlusion for it, so here is:



    I will add this option for every variation.
     
  26. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Some images of the new lacquered variation

    22-09-2016 12.49.58 x6.jpg 22-09-2016 12.50.03 x6.jpg 22-09-2016 12.50.08 x6.jpg 22-09-2016 12.50.12 x6.jpg 22-09-2016 12.50.49 x6.jpg
     
  27. Steva

    Steva

    Joined:
    Sep 9, 2010
    Posts:
    60
    Is WebGL supported?

    i'm getting:
    "Shader error in 'Standard Anisotropic': 'mul' : cannot resolve function call unambiguously (check parameter types) 'xyz' : vector field selection out of range at line 71 (on gles)"
     
    kenshin likes this.
  28. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Hi @David_MG,

    is webgl support planned?

    any idea about iPad PRO support?

    Thanks!
    Kenshin
     
  29. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Yeah, I want this to get fixed.

    Yeah, I made some tests before the last release, and got this error too. I spent a while with that but couldn't find what was the problem.
     
  30. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Hi @David_MG,

    I am working on version 1.3 to realize realistic velvet material, but it is not so good.
    Are you planning to release any update that improve fabrics visual quality?
     
  31. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Is this asset still alive and supported?
     
  32. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    yes, it is
     
  33. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Thank you David!

    Any chance to have an answer to my question? :)
     
    Last edited: Nov 18, 2016
  34. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Humm, I think that the shader already does a good job. I have used it in big projects and everyone was always happy with it. I would say that input data is 60% of the shading work. If you feed it correctly you can get great results. These are examples of what can be achieved with sas when you spend LOTS of time creating data:

    IMG_1027.JPG 10264129_10153490022357947_6842281456805555353_o.jpg
    It's a tricky and time consuming process. You have to analyze the surface you want to mimic, identify the important features and solve them one by one.

    Have you checked the red chair material?
     
  35. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    383
    I agree.. the shader does a great job. But many times is really hard to get the desired results.
    Create texture for complex material sometimes is really not intuitive.
    I was wondering if the shader can support a Detail Albedo (with mask). Many times fabbric have decorations, writes, logos etc... with a detail Albedo we could manage it much better. What do you think ?
     
    kenshin likes this.
  36. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    This is a very good idea!
     
  37. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Yeah, indeed, I already did that for a client. Okay, I will work on that today.
     
  38. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Okay, done. I used the same method used in Standard, so it won't be surprises ;)
    Additionally, we can select uv channel.

    Some desirable options may be color = lerp(color2, color1, color1.a), so you can mix those textures based on the alpha from the first texture. And another one, ability to select different blend modes.

    2016-11-25_11-12-32.jpg
     
    ArchVizPRO and kenshin like this.
  39. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Great news David!!!
     
  40. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    383
    Wow, can't wait to use it :D
     
    kenshin likes this.
  41. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Thanks guys, I submitted it last Friday, let's wait now some days until its approved. Cheers
     
    kenshin likes this.
  42. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Great, thanks a lot!
     
  43. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Hi @David_MG,

    would be great to have a limited/simplified version for mobile.

    What do you think about it?
     
  44. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    Well, the GUI is full of checkers. If all of them are off, what you have is a simple diffuse.
     
  45. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Exactly for this I think that mobile solution is not just switch off checkers but I am interested to know if you have in your todo list to try to work on a good shader that works on modern mobile GPU.

    It was a serious requesta but I haven't received a serious answer :)
     
  46. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    575
    You ask me to do a mobile version, but I still don't know what's the problem. Maybe performance?
     
  47. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    921
    Did you tried to open a project with your shader and just switch unity editor on Android?

    I have done it and the result is that material with your shader looks with the purple color (shader error).
    Reading your answer I understand that mobile version is simply not interesting for you.
     
  48. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Does this support OpenGL ES? It's usually customary to write what shader model is supported when releasing shaders.
     
  49. EvilFox

    EvilFox

    Joined:
    Jul 23, 2013
    Posts:
    83
    Hello.
    Cool shader, but...
    You can add support for Post-processing Stack v2, namely the "Ambient Only" mode for Ambient Occlusion?
    Currently, on your shader is missing Ambient Occlusion when "Ambient Only" checked.
     
    kenshin likes this.
  50. goetzmoritz

    goetzmoritz

    Joined:
    May 31, 2018
    Posts:
    1
    Hi there,

    is it possible to have this shader in Mobile (iOS and android)?
    In the unity editor, every material appears to be pink. And if you compile and run it, all the nice shading settings are gone :(

    While importing, I get this error:
    Shader error in 'SAS/Opaque': invalid subscript 'boxMax' at Assets/Standard Anisotropic Shader/Shaders/StandardAnisotropic.cginc(212) (on glcore)



    thanks!
     
    Last edited: Jun 1, 2018
unityunity