vendredi 30 novembre 2012

realistic metal with mental ray mia_material



When using the Arch&Design (mia_material) in the various products, the manual mentions that to make metal, one should enable the "refl_is_metal" switch (shown here from the 3ds Max UI, but it's available in all products):










When one does so, the color of the metal comes from the diffuse color swatch. However, most people stop there, and get a very dull looking material, and wonder "what wen't wrong?".

Well, not reading the rest of the manual is what went wrong ;)
 just turning on the "metal" mode doesn't make it look magically like metal. It looks more metal-ish but there is one more thing to do, take care of the BRDF curve.

When metal mode is on, the reflectivity (and the BRDF curve) drives the balance between traditional "diffuse" shading and reflective "metallic" shading. So if your reflectivity is zero, or you are at an angle where the BRDF curve is very low, you will be seeing mostly plain old diffuse shading, i.e. not very "metal" looking.

So what needs to be done is to pump up the Reflectivity value (probably to 1.0), and modify the BRDF curve to contain more reflectivity.

The default BRDF curve only contains a 0 degree reflectivity of 0.2, which isn't really very "metallic looking". One could change this to a higher value like so: (UI from 3ds Max shown, but exists in all products):
 















This works pretty nicely, and most metals can be done this way. But still, it may look a tad "off" in how the reflectivity depends on angle.

Well, then we try the fresnel mode.

"What" I hear you yell, "Fresnel" is for dielectrics... transparent stuff... like water, glass and such. It is based on the Index Of Refraction. Metals aren't transparent, they can't refract stuff! O'le Zap's gone completely bonkers now!

Well... actually... no. Metals are indeed not refractive, and are indeed not dielectrics (meaning, electrical insulators). They are Conductors, and for some baroque reason these are also considered to have an "Index of Refraction".

Now, don't ask me how on earth someone came up with the idea of refractive metals or how this is actually calculated... I didn't write the laws of Physics (I just abuse them) so just trust me it's there.... and these values are high. Not your average "1.3" ish like for water, but values like "25" or "50".

So, if you turn on the Fresnel reflection mode and put in an IOR of 50 you get something like this (Again UI from 3ds Max coz it has the neat curve):



As you see from the quirky curve, the angular dependency of the metallic reflection is... odd. But when rendering this, the metal just looks a tad more... well... metallic:















The above is a gold material under Sun&Sky lighting. It looks "ok", but not great.. why is that? Well, our visual perception of metals come largely from the reflections. While a totally empty sky is "ok" as reflection, it's not more than just "ok"... it looks dull. (But a photo of metal in a completely cloudless desert would look about as dull).

Lets try with reflecting the good o'le "Kitchen.hdr" environment:


 











There, exactly the same material, only reflecting something "interesting". (And yes, a tad of Glare on top, and using the Photographic exposure... so sue me ;) )

Hope this helps in the quest for More Metallic Metals.