Monday, August 8, 2011

Procedural Dents 'n' Dirt (Part 2)

The terms 'Ambient Occlusion map' (or 'AO map') and 'Dirt map' are often used interchangeably. Vray has a node called 'Vray Dirt', which is actually just an ambient occlusion node. Recently I saw an advert for a 3ds Max plugin that allows users to weather and dirty up their models with a fairly realistic looking procedural grime, complete with nice looking streaks. Ambient occlusion does a pretty good job of simulating the areas where dirt buildup is likely to occur on an object.


A very dirty keyboard

Today we'll go a little bit further in Maya than simply baking out an AO map; we'll use ambient occlusion as the beginnings of a mask for a procedural dirt texture. Then, as an enhancement we'll add some streaks in order to break things up a bit for a more natural look. Once finished, we will have created something that does a similar job to the commercial 3ds Max plugin described above, and we'll have saved $30! In Part 3 we will conclude this tutorial by connecting the 'dirt' shader network to our 'dents' shader network (see Part 1), for a very flexible overall shader that we can use in a variety of projects.

Friday, August 5, 2011

Procedural Dents 'n' Dirt (Part 1)

edit: This post has been updated as of 6/13/2012, to account for a previous missed step in the shading network (insert clamp node).  
Example shader

This is a really great technique for quickly generating some chips and dents along the outside edges of your model, as well as adding a layer of dirt (in part 2) to the more recessed areas. Once you have a handle on this technique you can then customise and apply it to all manner of materials. For this shader we will be utilising two of the Mental Ray nodes- a 'mib_amb_occlusion' node as well as a 'mia_roundcorners' node.

Firstly, let's work on generating some chips and dents for our model...


To get a better sense of what we're aiming for, here are some images which show the effect of edge chipping...

Examples of images of edge chipping on a variety of materials


Alright. Some nice subtle and not so subtle edge chipping. By looking at these shots we can appreciate that many objects in the real world show signs of this kind of wear and tear. What this means when it comes to our models and textures is that often times it is not enough to just simply apply a bevel to our object- but we should also think about introducing some variation into the bevel itself for added realism. We want to break up the bevel. How much will depend on our object, it's age and the material we are trying to represent.


So let's start... In the hypershade, bring two new 'mia_roundcorners' nodes into the work area. We also need to bring in an additional node- one of the Maya utility nodes- called 'Vector Product'.

Double click on the Vector Product node to bring up it's attributes window. Then, with mouse pointer over one of the roundcorners nodes in the hypershade, middle click and drag over to the 'input 1' slot in the Vector Product attributes. Release the middle button and the two nodes should now be connected. Do the same for the other roundcorners node but this time connect it to the 'input 2' of the vector product.

Two roundcorners_bump nodes connected to input 1 and input 2 of a Vector Product node

So far, so good.


Thursday, August 4, 2011

Welcome :)

Welcome to Materialism, a blog primarily about shading networks and materials. Hopefully over time this site will start to serve as a repository of neat shader tricks and information that people may be able to find useful in their own projects. The focus will be on Mental Ray for Maya in the beginning, with a possible expansion into other rendering engines and 3d packages as time goes on. Whenever I can personally learn something new and interesting which I feel has not been posted ad infinitum elsewhere on the web- I'll aim to make a post on it.

I'll likely be experimenting with basic design and functionality of the site over the next few weeks.

Hope you enjoy :)