Adverti horiz upsell
Subsurface Scattering: Using the Misss_Fast_Simple_Maya shader
Subsurface Scattering: Using the Misss_Fast_Simple_Maya shader
Jozvex, updated 2005-12-13 13:14:09 UTC 296,427 views  Rating:
(10 ratings)
Page 3 of 4

You can see that most of our slots are empty, except that our Misss_fast_simple_maya shader is plugged into the 'Material Shader' slot. If we were working with a standard Maya shader, say a lambert, it would instead be plugged into the 'Surface Shader' slot found up the top (not inside the Mental Ray area). I'm not going to go over what kind of things you can plug into which slots in this tutorial, but the names are reasonably self explanatory. The slot we're interested in is the.....'Light Map Shader' slot!:

  1. Click on the texture-applying button next to the 'Light Map Shader' slot.
  2. When the 'Create Render Node' dialog appears, switch it over to the Mental Ray tab.
  3. Scroll down to the 'Light Maps' section and choose the 'Misss_fast_lmap_maya' shader.
click for larger version

You should automatically be taken into the settings for the Misss_fast_lmap_maya node:

This shader is what will sample the lightmap data that the misss_fast_simple_maya shader will create. The only thing we currently need to do here is:

  1. Type 'mentalrayTexture1' into the 'Lightmap' slot and press enter.
What that does is connect this node up to the same Mental Ray file reading/writing node we created earlier. Alternatively, instead of typing in the name of the node (in case you have a scene with lots and don't remember what each is called), you could find it in the Hypergraph or Outliner (with the 'Show DAG Objects Only' option turned off) and simply drag 'n drop it over. For some reason, mentalrayTexture nodes currently do NOT show up anywhere in the Hypershade...weird! Another weird thing to note is that if you run your scene through the 'File > Optimize Scene Size' process on the default settings, it will delete these node's even if they're in use! So watch out for that one.

Anyway, I said that was the only thing we needed to change here, but let's look at the other settings anyway:

  • 'Include Indirect Lighting' - Turning this option on will include Final Gather and Global Illumination in the SSS scattering process. If you use Final Gather or Global Illumination and this option is off, the surface of the object will still receive the effects, but they won't seep/scatter into the object. We'll see this in action later.
  • 'Diffuse Gamma Curve' - Hmm, this one is easier to explain visually. It basically affects the spread of the diffuse part of the shader. Here's an image sequence showing the effect using the misss_lambert_gamma shader:
click for larger version

  • 'Ambient' - Just like the ambient setting on any regular Maya shader.
  • 'Light Linking Mode' - This is a common parameter on Mental Ray material shaders. Mode 0 means all lights are included in shading the object. Mode 1 means that specifically connected lights are the only ones used. Mode 2 means that specifically connected lights are the only ones NOT used. Mode 0 is the fastest to render.
  • 'Scatter Bias' - Um, we'll come back to this later! It'll make more sense then.
Guess what! If you've managed to follow everything correctly so far (and I haven't made any mistakes!) you should now see some subtle SSS when you render! Here's a before and after comparison:

click for larger version

I know it's very subtle, but the 'after' object has smoother shading, and the parts of the object that are in shadow aren't totally black anymore. Some light has scattered through from the front to the back. Is that it? Did we do all of that setup to get some faint little changes? No, we're just getting started now! Let's make our way back to the settings of the Misss_fast_simple_maya shader itself. I'll explain the settings and then we can start to play around:

  • 'Unscattered Diffuse Layer' section - This section controls the way the shader will look overall. All these settings can be mapped!
  • `Ambient' - Just like regular ambience, only it will scatter through the object. This is cool because you could map a texture into this slot (like perhaps a HDR image file) and it will treat it like incoming light to be scattered!.
  • 'Overall Color' - This is the master control for the whole shader. It is multiplied with the final result of the diffuse shading and the SSS shading. Leaving this setting on white will allow all the shading to occur the way you've set it up below. If you set this to black, the object will be black. You could use a texture to vary the final brightness of the shader if you like.
  • 'Diffuse Color' - Just like the regular colour setting on other shaders. You could put a skin texture in here when creating skin etc.
  • 'Diffuse Weight' - How much of an effect the standard diffuse shading will have. Note that turning this up without lowering the other weighting attributes below can quickly lead to super bright shading as the results are all added together.

  • 'Subsurface Scattering Layer' section - These settings control the SSS effects! All these settings can be mapped!
  • 'Front SSS Color' - When light enters the object from the front (the 'front' being determined by the sides facing the camera) to be scattered it will become this colour.
  • 'Front SSS Weight' - Controls how much the front scattering will effect the shader.
  • 'Front SSS Radius' - Controls have far in scene units the front SSS effect will scatter across the surface.
  • 'Back SSS Color' - When light enters the object from the back (the 'back' being determined by the sides facing away from the camera) to be scattered it will become this colour.
  • 'Back SSS Weight' - Controls how much the back scattering will effect the shader.
  • 'Back SSS Radius' - Controls have far in scene units the back SSS effect will scatter across the surface.
  • 'Back SSS Depth' - Normally you would keep this set to the same value as the 'Back SSS Radius'. The depth controls how far 'into/through' the object the shader will take samples from, while the radius is how spread out the result will be. It can be useful sometimes (say, if you have a translucent screen with something behind it) to set the depth higher than the radius, so that you can see the object behind he screen more clearly, and the smaller radius keeps it in sharper focus. It's fairly subtle to tweak though usually/

  • 'Specular Layer' - Controls the specular highlights. These settings are mappable.
  • 'Specular Color' - The same as any other shader's specular color attribute.
  • 'Shininess' - The size of the highlight.
Some people find that setting the 'Specular Color' to black doesn't completely remove the highlights from the object. This has happened to me sometimes too. I really have no idea why it happens!

  • 'Bump Shader' - You'll never guess!
  • 'Bump' - For applying a bump map. Now, there's some explaining to do here. Unfortunately at this stage, you can't just click the texture-applying button and have everything connect up properly like you can with Maya shaders. You have to create your bump network in the Hypershade/Hypergraph first (placement node > texture > Bump2D/3D) and then connect the Bump2D/3D node to this Bump slot. When you're drag-connecting your nodes in the Hypershade/Hypergraph you can just choose 'default' from the popup menu when prompted about what connection to make each time. Another thing you have to do once you've manually connected your bump network into the misss_fast_simple_maya node is to turn on 'Export with Shading Engine' in the Mental Ray section of the Shading Group node. It fixes many problems that can arise.

  • 'Lightmap' section - Controls the lightmap being used.
  • 'Lightmap' - Where you create the mentalrayTexture file for reading and writing your lightmap.
  • 'Samples' - How many samples are taken from the lightmap per sample of the final image during rendering. If your SSS shader starts looking speckly/artifacty, turn this number up in increments until it looks ok. Eg 32, 64, 128, 256 etc.

  • 'Algorithm Control' - Controls that change some of the maths behind the shader.
  • 'Scale Conversion' - Subsurface Scattering is heavily reliant on the size of the object. If you create your SSS shader for a small object and then later apply it to a much larger object, you're not going to get the same effect. Things like SSS Radius and SSS Depth are going to need changing. Instead of having to tweak multiple settings, you can use this 'Scale Conversion' attribute to multiply all the distance based settings.
  • 'Falloff' - Hmm, the Mental Ray section of the Maya docs explains this quite well I think:
"Falloff sets the shape of the distance falloff along the scatter radius. Higher values yield a sharper falloff, and lower values a smoother falloff, but also make the perceived scatter distance shorter, so one must compensate by increasing the actual scatter distance for a slightly 'softer' look. For high values (1.0 to 10.0), almost all samples within the scatter radius are weighted equally. For low values (0.1 to 1.0), the samples near the edge of the scatter radius are weighted less."

  • 'Screen Composite' - Having this turned on means that the back scattering, front scattering, specular and diffuse layers of the shader are added together using the same method as the 'Screen' layer blending mode in Photoshop and other 2D apps. Turning this off means the layers will simply be added together, most likely resulting in very over-exposed shading. Turning it off can be usefull if you're going to render out to a HDRI format like HDR, OpenEXR etc in which you want exposure control at the compositing stage.