Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  3. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Cloth Shader

Discussion in 'Assets and Asset Store' started by DavidMiranda, Jan 12, 2015.

  1. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    This shader will represent key lighting behaviours of fabric. You can get a wide range of clothing effects such as carpet, silk or velvet. It's been developed with Shaderforge, so you can tweak it to fit your needs. It supports dynamic lighting and beast lightmaps as well as probe lighting.

     
    mgear likes this.
  2. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Wow! Very nice... how hard would it be to port this over to a PBR like Jove2?
     
  3. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Easy, I guess :) Anyhow, If everything is correct, this one is also energy conserving.
     
  4. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,001
    That looks fantastic, one of the nicest shaders I have seen for a while, totally convincing. Does it run on mobile as well?
     
  5. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Humm, if that mobile supports SM 3.0, it should.
     
  6. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    If it runs on mobile full-stop, is reasonably easy to do, i think, check compiling to opengl es 2.0 (ideally) in shader forge

    These are indeed beautiful and are somewhat what ive been trying to do myself for ages - supplying as shader forge graphs is exemplary. I'll be in for it when finances are better.
     
  7. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Would it be possible to update the shader so shader forge doesn't break it on compiling with the latest SF release? It's dropping the reference to the light attenuation in the later passes and i cant figure out how to fix it
     
    hopeful likes this.
  8. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Yeah, it needs an upgrade badly :/
    I think it would be better to write it by hand instead using shader forge. Depending on others software doesn't help ;)
     
  9. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Id probably find hand written code easier to understand and adapt in this particular shader's case, looking at the generated script its gibberish, so had to rely on SF but i guess some things have changed with it
     
  10. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    On seconds thoughts yeah id really like the node graph still hah, theres a bunch of modificatons id love to make in shaderforge with this shader being so nice
     
  11. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    I have seen that shader forge still doesn't support lightmaps for custom lighting shaders, so I have no choice, I have to write it as a surface shader.
     
  12. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Would you be willing to take suggestions for features? I'm after a very specific look (entertainingly based on my partners crochet at she learns) and the lack of options is quite disappointing, a shader that could provide the general functionality of the standard shader with parallax and triplanar and introducing a proper bdrf option for cloth such as yours would be a bit of a godsend (think creating islands from craft materials) but i dont imagine you have much time for it, which is why i hoped for a working node graph, although maybe i can get something from it as-is
     
  13. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Yeah, well, every project/developer needs their own shaders at some point. The philosophy behind the surface shader layout helps to solve the problem, although not everyone can write the shader they want, it's not easy.
    Lots of suffering is awaiting me when I convert this to a surface shader :p
     
  14. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Well, the Cloth shader will be available for Unity 5 very soon. I have written it again without Shader forge graph this time. I really needed to proceed like this to make it better. It supports real time GI, reflection probes, sky ambient and reflections and... all the fancy stuff in Unity 5 :)
    Its using shader keywords now to disable code snippets, so it won't compute unneeded code, as it did before with the shader forge graph. Anisotropy is easier to adjust and I think it works together with gloss better than before. I have also added some stuff I miss in the Standard Shader, like pulling spec down to my taste or having 2 normal maps with adjustable intensities.

    The new gui currently looks like this:
    2015-11-29_21-24-01.jpg

    The old parameters are still there, so you won't loose your old configs from Unity 4, although you will have to tweak it again.
    Here are some samples:

     
    lazygunn, elbows and christoph_r like this.
  15. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Looks good! There's some code available on the SF wiki which might help with the triplanar stuff so maybe i can hack together something with that and this afterall. The added u5 goodness is getting somewhat essential id say so i like this
     
    DavidMiranda likes this.
  16. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    546
    Hello buyers.
    During December I worked on an update of this package. I knew I had to update it to Unity 5 and all the new stuff. After some days of work several ideas came to my head. "What if it is suitable for metals?", "What if I make a metals demo?" "What if I try to shade a cymbal? "What if supports transparency?", "What if... carbon fiber!!", "What if, what if...." So it started to grow until I realized it was too big/flexible to deliver it as a simple update. Instead of that, I have released it as an upgrade for previous buyers of the old cloth shader.
    The new version aims to model any kind of scratched surfaces / striped microstructures, not just fabrics.
    I want to say THANKS to all the people who bought it. That's what make developers to stay alive and motivated to bring to you more and better products. Happy new year and best wishes!
     
    zyzyx and christoph_r like this.