Sunday, March 4, 2012

Procedural cloth shaders ( Maya2012 - Mental Ray 3.9 )



Four procedural cloth shaders. You can download the Maya2012 file. The top left is polyester, top right is silk, bottom right is denim and bottom left is cotton.

They all use Maya's procedural cloth node, a ramp shader for the Fresnel effect and a mia_material_x shader. The camera has a mia_exposure_simple lens shader and colors have a gamma node to stay in a linear color space.

Edit #1: 03/22/2012
Update coming soon.  I'm updating the shaders based on some excellent advice on this blog.  She is using a sampler info node to simulate a Fresnel effect, where I tend to use a rampShader.  I like her method better than mine since it gives control in one location.

Edit #2: 03/29/2012
New shaders have been uploaded.  The denim is WIP and will be updated when I have some extra time.

24 comments:

  1. Gunna give these a try. I have been looking on how to create a cloth fabric type curtain. I hope these help.

    ReplyDelete
  2. Ok, nevermind. The link is invalid. Any chance you can re-upload them?

    ReplyDelete
    Replies
    1. Thanks for the heads-up. I will have updated shaders very soon.

      Delete
  3. Sweet, you re-uploaded them. Now I will givem a shot.

    Thank you

    ReplyDelete
  4. Maya file seems to be empty?

    ReplyDelete
    Replies
    1. The file contains shaders and textures only. "Window -> Rendering Editors -> Hypershade -> Materials Tab" will show the shaders.

      Delete
  5. i use it with my sofa model. what i did is select my object and apply one of your mia material x and the result is

    http://i.imgur.com/u8NOWBI.jpg

    but i really want to make it like above pictures.
    any advice

    ReplyDelete
    Replies
    1. The result is what I would expect if you applied the shader without adjustments. From the image it looks like the bump is too high and/or your aa sampling is too low.

      One thing that I do is gather reference for similar materials or objects. Then I try to replicate a material.

      Delete
  6. thanks for the quick reply and i made this for mini challenge for http://www.3dsquirrel.co.uk/forums/forum/35-challenge-iv/ and people really like the model specially your material.
    here is the time lapse video i made and i also mention your awesome material.
    thanks again.

    https://vimeo.com/66601600

    ReplyDelete
  7. Hey! awesome material! I would love to learn how this was done and understand why is everything working the way it does (I am a student, I am having some trouble understanding why did you used the gamma correction nodes and the bumps), would you mind doing a tutorial?
    Thank again!

    ReplyDelete
    Replies
    1. Someday I'll do a tutorial.... maybe....

      For now, take a look at this blog for some discussion on how a cloth shader is made:
      http://gennyx.blogspot.com/2009/11/its-material-world_11.html

      This blog discusses gamma nodes and a linear color workflow:
      http://www.djx.com.au/blog/2008/09/13/linear-workflow-and-gamma/

      Delete
  8. How would you apply a texture as the diffuse? For example, I'm making a Hawaiian shirt and would like to add the floral pattern as the main diffuse.

    Thanks
    Ben

    ReplyDelete
    Replies
    1. Multiply the new pattern and the diffuse:
      - Take the diffuse cloth texture and make it white.
      - Paint your Hawaiian pattern as a separate file ( jpg, tif or exr ).
      - Make a file node and load your new Hawaiian pattern.
      - Drag and drop the Hawaiian pattern onto the Color Gain of the diffuse cloth texture.

      Delete
    2. Awesome, thanks for the quick reply Todd I'll give it a whirl tomorrow :) love these shaders by the way

      Delete
    3. This comment has been removed by the author.

      Delete
  9. Have I done this correctly? It appears a little dark on shader. Also on the render too.

    http://postimg.org/image/4o5ujo9sx/

    Thank you
    Ben

    ReplyDelete
    Replies
    1. Can you re-post the link? I'm getting an error.

      Delete
  10. Sorry, I've added it in two places now.

    http://oi40.tinypic.com/2hyx91z.jpg

    http://postimg.org/image/4o5ujo9sx/

    Thank you

    ReplyDelete
    Replies
    1. You've double gamma'd your textures. You only need a single gamma node at the end of your texture stack. Just take the output from "file1" and connect that to the Color Gain of "cotton_diff_col_ramp".

      Delete
  11. Ahh what a foolWhen I don't forget to gamma I double gamma!
    Thanks so much for your help Todd, much appreciated.
    Keep up the good work :)

    ReplyDelete
  12. Hi, I am being a complete idiot and am really confused as to how to use these shaders. I have applied the textures but they dont look right. I am pretty inexperienced in this area and can't find much help on it. I would appreciate it if you could help me, thanks :)

    ReplyDelete
    Replies
    1. If you pm me/post a scene file or images, I will take a look.

      Delete