Its a Material World

Okay, so now that we're passed the cheesy title, the point of this post is the Sampler Info Node and how I've been using it to make various materials like satin, velvet, etc. And to not give myself a headache, I'm going to approach this in a step by step manner, flapping my lips all the way, yay.

First up on the chopping block is satin.

Googled examples





Satin is almost metallic in appearance but not in a way that reflects the environment in detail, it reflects blurred light sources instead and it's seemingly view dependent. I want red satin, so my first task is to make a highly reflective red shader that reflects highlights only.

I get my mia_material, give it a dark red diffuse color. Crank up the reflectivity, but I'll also have to crank up the BRDF values because these cap off the minimum and maximum reflectivity, slide the values up so the material will be highly reflective no matter what the viewing angle. Also, under the reflectivity section, check on “Highlights only” because I don't want the entire environment to be reflected only the bright areas.








Now, for this to look like a red metallic surface, there needs to be red in its reflection color, but because of the nature of satin, the brightness of that color needs to change across the surface depending how its facing the viewer. So now we need two more nodes. A ramp texture to provide those colors and the samplerInfo node to control the conditions under which the colors change.







Shift+MMB drag the samplerInfo node onto the ramp, and in the Connection Editor connect the facingRatio of the samplerInfo into the U and V coord of the ramp




That's done, then I MMB dragged and dropped the ramp onto the reflection color of the mia_material. Now this surface has a reflection color of blue for the points facing the camera, and as it bends away from the camera the reflection color fades to green and finally red.




Now to tweak that ramp. The more black a color has in it, the less reflective it'll make the surface appear.



Unlike the two darker reds in the ramp, the brightest red isn't at full saturation, I find that overkills the highlights, though full saturation might look gravy-cakes to someone else. With its new red ramp, it now looks like this





Almost done, at this point, the highlights are too sharp, to give them the smooth satin look, I'm going to blur the reflections to about 0.4 and …done!




Actually you can take it a step further and do this to the color channel as well, this image is from another test. Personally, I think it looks better without the ramp in the diffuse.



Note: I am using a linear workflow here and for the sake of avoiding clutter and confusion of gamma nodes, I used a default mia_material_x. Normally I use a pre-made and exported version with gamma correct nodes plugged into all the channels that return color information, like the diffuse, reflection color(I'm checking out if I really need to gamma correct this particular channel), refraction color, translucency color, additional color etc.  Scratch that, now I have made a script that automates gamma correction.


The same method can be used to simulate a velvet shader and various other effects, like toon shading, electron microscope images etc. You just have to get a bit creative with where you plug the ramp!

Googled velvet examples








28 comments:

  1. what settings are you using on the 2nd fractal node? (for the bump slot)

    ReplyDelete
  2. also - since lighting seems to have a big impact on the appearance of these materials - are you lighting with IBL or a area light or what?

    ReplyDelete
  3. I'm adding a screen grab of the fractal settings to post. And as far as lighting goes, there is a photographic exposure lens shader on the camera and there are two area lights with quadratic falloff and set to use the MR light shape.

    ReplyDelete
  4. its just looks amazing! i will test the sampler info node!

    ReplyDelete
  5. can you post your satin shader?
    can't seem to match your scene
    =(

    ReplyDelete
  6. Hey n8skow, what part is giving you trouble?

    ReplyDelete
  7. hi, i am trying to reproduce your material, but it seems that in maya 2010 the samplerinfo node just doesn't do anything when i plug it into ramp texture, did you come across this problem ?

    ReplyDelete
  8. I don't see any of my ramp colors in the reflection. Also, where do you control reflection blurring?

    ReplyDelete
  9. Alexei, I'm in the dark on that one because I'm using 2009 and I never even touched 2010.


    N8skow, if the ramp is plugged into the reflection "color" slot then I can't see why it wouldn't show, so double check and make sure you didn't plug it into the "reflectivity" slot instead. Sometimes it's the little things that drive ya mad. And blurring is controlled by the "glossiness" attribute.

    ReplyDelete
  10. I'm suspecting an issue with my lighting and/or gamma - blowing the color saturation out...

    Is it possible to contact you by email and share my pics/scene?

    ReplyDelete
  11. gen,

    great tut, i have recreated and it works perfectly, can i post on mymentalray materials section credits due ofcourse

    cheers

    matthew999

    ReplyDelete
  12. N8skow Sure, the address is at the top of the page.

    Matt Yeah, you can post it up if you like, just send me a link so I can satisfy my curiosity on how your shader turned out :)

    ReplyDelete
  13. thanks gen,

    your materials where created in maya2009sp1a and can be found here

    http://www.mymentalray.com/materials.html

    love the blog, you are added to my list of favourite rss feeds

    cheers

    matt

    ReplyDelete
  14. Nice, might try and convert this to vray. Thanks Gen

    ReplyDelete
  15. Matt, those look real nice!
    Kiernan, thank you, happy shading and stuff :D

    ReplyDelete
  16. omg this is so amazing, thank u so much, im not even using the shader, just the technique opened my eyes.

    U ROCK.

    ReplyDelete
  17. Thanks for your enthusiasm! lol :D

    ReplyDelete
  18. How would you go about creating a material for a semi transparent curtain?

    ReplyDelete
  19. That brings to mind "sheer curtains", if that's the case then I think a slightly transparent, thin walled (instead of solid) mia_mat with a bit of translucency should be a good start.

    ReplyDelete
  20. I have tried so many different variables trying to make a realistic curtain for the past 2 weeks. It always looks so wrong. I have seen so many renders that have absolute perfect looking curtains and then when I try replicating them, it turns out horrible. Yes, i only use the mia_mat. Kept playing around with the transparent and transl. attributes, but to no avail.

    ReplyDelete
  21. You can drop me an email and let me see what you're talking about.

    ReplyDelete
  22. Hi Gen, Stumbled upon this as I was trying to develop a shader for a Disco-era silk shirt. I love the affect overall but I'm seeing some "blowing out" like radioactive sunflares on my model based on what I can only assume is my sample info lighter ramp color. Any thoughts on that, or other details I should provide?

    ReplyDelete
  23. Can you send me a link to an image? What's your lighting setup like?

    ReplyDelete
  24. Thank you very much for this lovely tutorial my friend! This seriously helped me a lot! Thank you once again and keep up the good work!

    George

    ReplyDelete
  25. Hi Gen im trying to create a realistic velvet look and i'm using mental ray. I seem to be having trouble recreating it and I'm not getting that furriness to it. I'm not sure if its to do with the light setup or if its the shader. If you could help that would be awesome.

    Thanks Jess :)

    ReplyDelete
  26. Hey Jess,

    You could send me an example scene so I could check it out. The email address is on the about/contact page.

    ReplyDelete
  27. Hi! How do you get the fractale2 to show up in the bump slot for the velvet material? Mine is greyed out. I could follow just about every step in the tutorial, but couldn't figure out how to get the bump to work. :(

    ~ KL

    ReplyDelete
  28. Check if the attribute is locked. That's the only thing that I can think of off the top of at the moment.

    ReplyDelete

Leave a message at the beep...wait for it...:p