View Full Version : Looking for help with a metal shader.

04 April 2006, 09:27 PM
So I finished my model, and realized I know doo doo about shaders. I did what any reasonably person would and bought eleventy billion dollars worth of training dvds.... But they won't get here until tomorrow and I would like to get a little bit of work done tonight. I am working on the rear casing of this camera, so ignore the other stuff, that's just fiddling around. Any help is always appreciated. I am working in Maya 6.

This is what I'm going for:

and this is what I've got..... :(

04 April 2006, 11:38 PM
You got the chrome working nicely though. The key is to understand what the material itself does.

Pure, polished, uncoated metal is very specular. About 95 to 100 percent of the light can get reflected in the same matter as it hit the surface, same angle, like a mirror. That's specular reflection.
When the surface is unpolished (rough, sanded, brushed) the incoming light rays start to scatter around. When the surface gets rougher the rays start to go from parallel to disordered. This is when you start to see the reflected image get blurrier. That's diffuse reflection.

Take a piece of paper for instance. Its surface is very rough plus light can penetrate the surface (better than metal) where it gets scattered even more. Basically what you see when you look at a piece of paper is a ~100% blurred reflection of your surroundings. Though it's doubtful that you can make a metal surface that rough.

OK, back to metal. When you take a piece of sandpaper and sand a smooth metal surface the reflection will get blurrier, more scattered. If you continue making the surface rougher the reflections will become unrecognisable. The easiest way to achieve this effect is to enable the reflection blur/glossy option in your shader/renderer. I don't have Maya at home but it's in there somewhere. I think it's called glossy in Maya. Look it up.
Note that this is very render-intensive but if you're going for a still you should be fine.

Another effect of rough surfaces is that objects nearby aren't as blurred as objects close by. This is because of the scattering of the light rays. The divergence of the rays will become bigger the farther away an object is. Sorry, a picture would've helped here. The nature of the glossy feature in Maya will cause this to happen automatically.

And then there is another effect. When you sand a piece of metal in one direction you'll get little grooves in the surface, all going in the same direction. This will cause the reflection to become blurrier in one axis than in an other. This is called anisotropy. Brushed metal cooking pots.


Just in case you need to know. Non-metals also have specular reflections, though they're not as pronounced. Non-metals will always have a very strong diffuse part to them. Take a shampoo bottle for instance. It has a colour. That's the diffuse reflection part. Note that when it's smooth you will also see bright objects reflected in it. In fact it's reflecting everything but only the brightest objects are visible. That effect is (very cheaply) simulated in 3d programs with specular highlights.
If you want to go for realism and not necessarily speed then don't use specular highlights, use toned down real reflections instead. And if you understood (hopefully, it's a mess) what I typed above, you'll understand that you NEVER EVER use specular highlights on smooth metal surfaces. EVER. :) Reserve those for non-metals or really rough metal surfaces if you have to.

Another thing about non-metals is that they have a really visible effect where the edges of an object (lower surface angle compared to your eye) will be more specular reflective than the middle (higher surface angle...). This is the Fresnel effect, there's plenty to read on that here and on the net, but a thing to keep in mind is that it's really important for realism.
Basically a surface like glass will have a specular refl. of about 4% head-on and when you look down the surface of it reaaaaly close by it will reach 100%.

My guess is that the light rays can penetrate the surface better in non-metals. Once past the surface they get scattered around like a box of candy dropped into a schoolyard. This is why non-metals always have a very visible diffuse part (it's 'colour') and a not-so-visible specular reflection. And this is also why the Fresnel effect is so pronounced, I think rays bounce off the surface easier when they hit it at a shallow angle and get a lot more below the surface when they hit it straight on.

Anyway.... sorry about cluttering your thread with this mess, I hope that I answered your question in there somewhere. I'm planning on writing a tutorial and this is a nice way to pour my thoughts into solid form while helping some people out. :)

CGTalk Moderation
04 April 2006, 11:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.