Subsurface Scattering: Using the Misss_Fast_Simple_Maya shader
Subsurface what?!? -
Don't freak out! 'Subsurface scattering' is the term used in 3D graphics to
describe the effect we see when, in the real world, light enters a surface (at
least to some degree), bounces around a bit and is then either absorbed or
reflected back out again. The effect is usually associated with soft/organic
surfaces like skin or wax, and is a major factor in the look of those materials.
How can we demostrate this effect in an obvious way? Well, I'm sure most people
have seen that if you hold a torch up to the back of your hand, you can see a
red glow that spreads all the way through to your palm. Some of the light has
travelled through the inner (subsurface) layers of your hand, picked up the
reddish colour of your blood/tissue and made it all the way out through the
other side. That is one example of the effect that Subsurface Scattering
describes, and many people in 3D graphics wish to achieve. Why is that so
usefull? It's usefull because Subsurface Scattering appears all around you,
though not as obviously as in the torch-to-hand example. It's a big help in
achieving skin that doesn't look plastic!
Yes! Subsurface Scattering (called SSS from now on, hehe) has become a lot
more common in 3D applications these days, and thanks to Mental Ray being a part
of Maya now, we can use it's various different SSS shaders. However, the Mental
Ray SSS shaders are actually quite new for public use, and so only those with
Maya 6 or greater can use them. Those with Maya 6 must download the shaders as a
bonus pack from the Alias website. You'll need free Bronze community membership to access them. They're about the fourth from the top, of the downloads on this page:
How do I install new Mental Ray shaders? -
Those that already know how, or have Maya 6.5 can skip this part. Ok, so you've downloaded the SSS bonus pack and perhaps some other fancy Mental Ray shaders too, now they need to be installed so that we can actually use them. There are two parts to installing new shaders; Copying the files to the right locations and then editing a file called 'maya.rayrc'. Firstly though, what files make up a Mental Ray shader? There are usually around 4 or 5 files that together create the 'total shader experience' (hehe) of a new Mental Ray shader. These files are:
- *.dll - The dll files are the actual shader code. They are what do all the fancy calculations when the shader is rendered.
- *.mi - The files that end in .mi are written in the Mental Images MI format. They are just text files. They give Mental Ray some general information about the shader, and tell Maya what attributes you would like to have present inside Maya for tuning the shader. They also tell Maya what section of the Hypershade the shader should be found in (ie Textures or Materials etc).
- *.mel - The .mel files are usually named something like AEshadernameTemplate.mel. AE stands for Attribute Editor. What these MEL files do is create the interface for the shader inside Maya's Attribute Editor. Without these files you would still be able to edit the shader in the Attribute Editor, but Maya just generates a very basic interface that lists the attributes.
- *.xpm - These are Maya icon files. They simply provide an icon for the shader in the Hypershade's Create Bar.
- *.fti - Not that many people include these files, but more are starting to. They are also Maya icon files and they create the Hypershade node icon that is visible in the Hypershade's flow area. Without these icons you just get a generic 'mental ray shader' icon.
So lets install these SSS shaders! Unzip the package you downloaded to
somewhere handy like your desktop, all the right folders and sub-folders should
be created at that location:
Open up that new folder and you'll see 6 sub-folders and a readme file. Luckily Alias is helpful and have named the sub-folders according to where the files contained in them need to go. The sub-folders we're interested in are 'icons', 'include', 'scripts' and 'lib'. Let's start with 'include' and 'lib' as they end up in similar locations. The file inside the 'include' sub-folder is named 'subsurface.mi' and it needs to be moved/copied to the:
"C:Program FilesAliasMaya6.0mentalrayinclude" folder for those on Windows. Sorry to those on other platforms, I'm sure you can translate these paths over without much trouble.
In that 'include' destination folder you can see the other Mental Ray shaders that come by default with Maya:
Next up is 'subsurface.dll' in the 'libyour platform' sub-folder. Move/copy it to the similar destination:
Now, those two files were the essentials. The rest are to make the interface much nicer. While we're here though (in the lib folder), there's something we can do to save us time. Navigate 'up' one step to the:
"C:Program FilesAliasMaya6.0mentalray" folder.
Here you will find a file I mentioned earlier, 'maya.rayrc'. What is it? It's like an initialization file that is read during Mental Ray's startup procedures. It defines all the Mental Ray shaders that you potentially might want to use. We're going to need to add our new SSS shader to the list in this file, but not this exact file. We could edit this exact file (and I used to in the past) but it means you're without the default one in case you mess something up and prevent Mental Ray from working. The better idea is to copy this file to your:
"C:Documents and SettingsusernameMy Documentsmaya6.0prefs" folder. So do that now!:
Now that you've made a copy of the file here, this one will take priority over the default one, because your user folders have the highest priority. Now we need to edit the file. To do that, all you need to do is open it up in a text editor. I'm going to use TextPad but you can use Notepad or whatever it is that you like. Here's the default contents of the file:
Eek! It looks kinda scary but really it's not. The first few lines starting with a '#' are comment lines. They don't 'do' anything besides tell the person looking at the file some information. You can add these lines yourself anywhere you like if you want. The lines starting with 'registry' are just setting up where Mental Ray and Maya need to look for the shaders. The parts we're interested in are the lines starting with 'link' and 'mi'. The link lines are listing which *.dll files to load, and the mi lines list which *.mi files to load. We need to create our own lines that instruct to load the 'subsurface' files we copied into place. It's just a matter of copy/pasting previous lines and then changing the name of the shader file:
Now save the file and we're done here! The last bit to do is the copying/moving of the icon files and MEL script. Copy all the icon files from the 'iconsxpm' sub-folder of the downloaded pack to your:
"C:Documents and SettingsusernameMy Documentsmaya6.0prefsicons" folder.
For some reason they created an 'iconsfti' sub-folder but it's empty, so ignore that. Copy the MEL scripts from the 'scripts' sub-folder to your:
"C:Documents and SettingsusernameMy Documentsmaya6.0scripts" folder.
And finally that's it! The SSS shader pack is installed. Let's jump into Maya and see how the Misss_fast_simple_maya shader works!