{"id":3510,"date":"2010-07-05T05:34:19","date_gmt":"2010-07-05T05:34:19","guid":{"rendered":"http:\/\/www.mrbluesummers.com\/?p=3510"},"modified":"2010-07-08T04:48:53","modified_gmt":"2010-07-08T04:48:53","slug":"3dsmax-mental-ray-sub-surface-scattering-guide","status":"publish","type":"post","link":"http:\/\/www.mrbluesummers.com\/3510\/3d-tutorials\/3dsmax-mental-ray-sub-surface-scattering-guide","title":{"rendered":"Sub-Surface Scattering Guide Part 1"},"content":{"rendered":"
In this epic tutorial we’re going to take a deep look at how you can use mental ray’s Sub-Surface Scattering (SSS) tools in order to make your renders more realistic. \u00a0This technique is often misused, misunderstood, and- if implemented wrong- can seriously affect your render times. \u00a0After reading this tutorial you’ll walk away with a broad understanding of both the concepts behind SSS and how to implement it effectively in 3d Studio Max and mental ray.<\/p>\n
SSS via parti-volume shader (Part 2)<\/p>\n<\/div>\n
I’ll be explaining things from the perspective of a beginner\/intermediate user. \u00a0You should know what mental ray is, how to enable it, and how to create new materials. \u00a0I’ll provide you with downloadable source files along the way so you can have a starting point.<\/p>\n
We’ll begin by getting a strong understanding of what options are available in the 3dsMax implementation of mental ray, followed by detailed guidance on each material and shader type. \u00a0Finally we’ll put these concepts into practice by manipulating renders step-by-step.<\/p>\n
In\u00a0part 1 of this tutorial we’ll discuss<\/p>\n
Then, in Part 2 of this tutorial<\/a> we’ll discuss<\/p>\n You can download my starter scene here<\/a>, though I’m not including the texture files because they’re copyrighted so you may get an error message. \u00a0Any complex materials I create will be provided through a scene file, too.<\/p>\n If you’re already familiar with what SSS is you can safely skip this section.<\/p>\n Wikipedia really does the best job of explaining what subsurface scattering is:<\/p>\n Subsurface scattering<\/strong> (or SSS) is a mechanism of\u00a0light<\/a> transport in which light penetrates the surface of a translucent object, is\u00a0scattered<\/a> by interacting with the material, and exits the surface at a different point. The light will generally penetrate the surface and be reflected a number of times at irregular angles inside the material, before passing back out of the material at an angle other than the angle it would have if it had been reflected directly off the surface. Subsurface scattering is important in\u00a03D computer graphics<\/a>, being necessary for the realistic rendering of materials such as\u00a0marble<\/a>,\u00a0skin<\/a>, and\u00a0milk<\/a>.<\/p><\/blockquote>\n Sub-surface scattering is most visible at thin geometry like between fingers.<\/p>\n<\/div>\n You’ve probably seen this effect before- like when you hold a flashlight over your fingers or the sun shines through your eyelids. \u00a0The light travels through your skin and gets scattered, taking on a reddish color.<\/p>\n When enabled in a render it can have a subtle but dramatic impact on how your renders look. \u00a0Direct light sources will shine light on your object and, when configured correctly, mental ray will be able to scatter and color that light the same way that light would behave in real life. \u00a0Consider the images below.<\/p>\n Stanford dragon with sub-surface scattering enabled.<\/p>\n<\/div>\n Stanford dragon without Sub-Surface Scattering but similar glossiness and specularity.<\/p>\n<\/div>\n mental ray in 3d Studio Max 2009 has four material-based sub-surface scattering modes and one “faked” mode. \u00a0These are:<\/p>\n For the purposes of this tutorial, we’ll be considering the SSS Fast Skin Material and the SSS Fast Skin Material + Displace as virtually identical. \u00a0They’re only differentiated by the ability to add a displacement map. \u00a0Examples of each are shown below at default settings appropriate for the scene size. \u00a0We’ll go over material settings later in this tutorial.<\/p>\n SSS Fast Material<\/p>\n<\/div>\n SSS Physical Material<\/p>\n<\/div>\n SSS Fast Skin Example<\/p>\n<\/div>\n SSS Fast Skin + Displace Example<\/p>\n<\/div>\n SSS Through Parti-Volume Example<\/p>\n<\/div>\n Let’s begin with the simplest SSS material- the SSS Fast Material. \u00a0I’ll use a gradient ramp, a rainbow map, and a single render to demonstrate the effect of various parameters. \u00a0Note that I won’t render all of them because many of these parameters have to be pretty extreme in order to change the render. \u00a0Besides, 99.9% of the time you won’t have to alter parameters like Lightmap size or Falloff strength.<\/p>\n Parameters that take color maps- like unscattered color- will be tested using the “rainbow map” you see along the bottom of the image below. \u00a0Parameters that take numerical maps- like front-surface scatter weight- will be tested using the “black-to-white” gradient ramp above the rainbow map. \u00a0Wherever I state values below an image, it’s referring to the gradient ramp and is read from left to right. \u00a0I.E. “Values are 0.0 to 1.0” means that the left side of the image is 0.0 and the right side of the image is 1.0.<\/p>\n This is the original render with the gradient ramps along the bottom.<\/p>\n<\/div>\n Below are definitions for each parameter in the SSS Fast Material rollout.<\/p>\n The Full SSS Fast Material<\/p>\n<\/div>\n The SSS Fast Material\u00a0\u00a0(mi) Parameters give you high-level control over the quality of the SSS effect.<\/p>\n All objects that should scatter light into each other should be in the same scatter group. To conserve memory, use as few scatter groups as possible. A person’s hands, face, etc. can use the same scatter group; even hands and faces of different people. In general, different scatter groups should be used only when using the same group would cause visible problems due to objects incorrectly scattering into each other. Two characters shaking hands, for instance, would need to have their hands in different scatter groups.<\/p>\n Lightmap size is the size of the lightmap as a percent of the total render size. The lightmap is based on screen space and 50% or less is usually enough (and it’s the default), but if edge artifacts start to appear, you can \u00a0increase this value. \u00a0You’ll rarely need to alter this value and it’s tough to get a change in your render while altering this parameter.<\/p>\n Number of samples sets how many samples from the lightmap are used (maximum) per rendered ray. \u00a0Ideally this should be a power of two. 32 is probably the lowest useful value and 128 is plenty of resolution. However, if the scattering radii are really large then you may need to increase the samples in order to avoid any noisy artifacts.<\/p>\n 10 samples on the left and 128 samples on the right.<\/p>\n<\/div>\n This should already be familiar to you. \u00a0You can apply a bump map to your material in order to add detail to your material. \u00a0One important thing to note is that bump mapping does not affect how your sub-surface scattering is calculated. \u00a0It only affects the color and specularity of the material. <\/strong>You should already know what bump mapping would do to this model so I think we’re good without a render.<\/p>\n This parameter group is responsible for controlling the color and spread of light through the material.<\/p>\n The ambient light controls is the ambient component as though it were an ordinary Standard material. This light will also be included in the lightmap and get scattered like any other light source which makes it the perfect place to add any HDRI light<\/a>. \u00a0Here’re some good HDRI maps you could use<\/a>.<\/p>\n An ambient light example using the rainbow map. Notice the purple color on the belly.<\/p>\n<\/div>\n All diffuse colors below are multiplied with this global color to yield the final result. This parameter is useful for coloring the final color of the material or to apply maps that change all light that hits the material. Moles on a character’s skin, for example, will block almost all underlying light (even scattered) and would make sense applied here.<\/p>\n This image has the rainbow map in the overall diffuse coloration map slot.<\/p>\n<\/div>\n This is pretty straightforward. \u00a0Adding color to this map will only affect unscattered light and will color the model but less-so than overall diffuse coloration. \u00a0Compare the image above with the one below.<\/p>\n The unscattered diffuse coloration using the rainbow map.<\/p>\n<\/div>\n The weight control handles how significant the unscattered diffuse color should be in the final material. \u00a0In the image below, the low weights on the left reveal a material\u00a0almost\u00a0exclusively made up of sub-surface scattering. On the right the material has a high weight and is mostly the “white” color we used in the diffuse color swatch.<\/p>\n The unscattered diffuse weight parameter controlled by a gradient ramp. Values are 0.0 to 1.0.<\/p>\n<\/div>\n These control the color and weight for the front surface scattering. \u00a0Front-surface scattering affects surfaces that are facing the light source and are directly illuminated. \u00a0Other than that, the controls are very similar to the ones we used on the unscattered component above. \u00a0Notice that when the weight parameter is very low (left side of the lower image), the material becomes almost an ordinary Standard material except for the back-scattering component.<\/p>\n Front-surface scatter color controlled by the rainbow map.<\/p>\n<\/div>\n Front-surface scatter weight controlled by a gradient ramp. Values are 0 to 1.0.<\/p>\n<\/div>\n The scatter radius controls how deeply the light should be scattered along the surface<\/em> for light-facing areas of your material. \u00a0This value is in scene units so if you’re working in feet like the downloadable example then .5′ means 6 inches of spread. \u00a0Remember that this will get multiplied by the scale conversion factor discussed in the advanced parameters section.<\/p>\n Front-surface scatter radius controlled by a gradient ramp. Values are 0.0 to 2.0'.<\/p>\n<\/div>\n These are the color and weight for the back-surface scattering. \u00a0Back-surface scattering affects surfaces that aren’t facing the light source but are being indirectly illuminated through the surface<\/em> of the object.<\/p>\n Back-surface scatter color controlled by the rainbow map.<\/p>\n<\/div>\n Back-surface scatter weight controlled by a gradient ramp. Values are 0 to 2.0'.<\/p>\n<\/div>\n These are the scatter radius and depth for light that reaches the back surface from an illuminated front surface. Normally, the radius and depth are set to the same value (and if the depth is not specified, it defaults to the radius). \u00a0I’ll include an extra render below. \u00a0Note that it’s difficult to get this parameter to invoke a change in the render- the default is 0.03′ and these renders go to 1 foot. \u00a0If you’re setting radius\/depth to really high values you should consider changing the scale conversion factor instead!<\/strong><\/p>\n Back-surface scatter radius controlled by a gradient ramp. Values are 0 to 1.0'.<\/p>\n<\/div>\n Back-surface scatter depth controlled by a gradient ramp. Values are 0 to 1.0'.<\/p>\n<\/div>\n Back-surface scatter radius and depth controlled by a single gradient ramp. Values are 0 to 1.0'.<\/p>\n<\/div>\n The color and shininess control a regular Phong shader for the material specularity. \u00a0This should be pretty familiar to you from working with Standard materials. \u00a0The higher the shininess parameter, the higher the glossiness of your final material. \u00a0The specular color generally doesn’t need to be edited but there are some cases when it can be useful.<\/p>\n Specular color controlled by the rainbow map.<\/p>\n<\/div>\n Specular level turned down to 10 from the default of 33.<\/p>\n<\/div>\n The lightmap gamma curve is the gamma of the lightmap. If this is 1.0, normal diffuse light is stored. If it is less than 1.0, the curve is ‘flattened’ causing the light to spread out towards areas not directly facing<\/strong> the incoming light. If it is higher than 1.0, the curve is ‘narrowed’ causing the light to concentrate in areas directly facing<\/strong> the light source. In most cases, a value between 0.4 and 0.8 is fine.<\/p>\n If this checkbox is checked then the material includes any indirect lighting (photons, final gathering, etc) in the lightmap to be scattered. This takes additional render time <\/strong>and one should judge on a case-by-case basis if the indirect light is significant enough that seeing it scattered or not makes a big difference to justify the extra rendering time. \u00a0You also must turn this on in order to have your SSS material react to HDRI lighting via Final Gather<\/a> or to caustics being cast by other objects.<\/p>\n The scale conversion factor is the first place you should go when creating a new material. \u00a0It’s a simple multiplier for all distances in the material. \u00a0Scattering is distance dependent so\u00a0loading a material designed for a model made in inches will not work on a model where the unit is meters, and vice versa.<\/p>\n Scale conversion factor controlled by a gradient ramp. Values are 1.0 to 0.<\/p>\n<\/div>\n If this is set to 0.0 the scattering is completely uniform. \u00a0Positive values favor forward scattering, and negative values favor back scattering. \u00a0Backscattering is where light begins traveling through a surface but then turns around and bounces back the way it came.The allowed range is -1.0 to 1.0, but the useful range is much smaller. A value of 0.1 (a slight bias toward forward scattering) is a good start.<\/p>\n Scatter bias on the left image is unchanged, and on the right is -0.50. This biases light backwards.<\/p>\n<\/div>\n This parameter sets the shape of the distance falloff along the scatter radius. Higher values will give you a more sudden falloff and lower values give a less sudden falloff. \u00a0Lower values will also make the scatter distance look shorter, so you might want to compensate by increasing the actual scatter distance<\/em> for a ‘softer’ look. For high values (1.0 to 10.0), almost all of the samples in the scatter radius are equally weighted. For low values (0.1 to 1.0), the samples near the edge of the scatter radius are weighted less.<\/p>\n Falloff strength controlled by a gradient ramp. Values are 0 to 1.0.<\/p>\n<\/div>\n When this is turned on the system will choose a softer compositing of the sub-surface scattering layers. \u00a0This must be turned off for photometric lights & photographic exposure control to look correct!<\/p>\n That was intense. Now that we have a good hold on the basics of sub-surface scattering, let’s take a deeper look at the other material types and what makes them unique and useful. The SSS Fast Skin Material is very similar to the SSS Fast Material that we just learned about. This is because the SSS Fast Skin Material is like two materials layered on top of each other.<\/p>\n The displacement map in the SSS Fast Skin Material + Displace is a simple 3d Displacement shader. There isn’t much information about what this shader does so I’ve written a quick post about the 3d displacement shader here<\/a>.<\/p>\n For the sake of keeping this tutorial as short as possible we’re going to look at the SSS Fast Skin Material + Displace because it’s a more functional version of the original Fast Skin Material.<\/p>\n SSS Fast Skin Material unaltered render (20% conversion factor).<\/p>\n<\/div>\n The first major difference between the SSS Fast Skin Material and the SSS Fast Material is the extra front-surface scatter layer. \u00a0If you remember from earlier, the front-surface scattering has to do with light-facing surfaces and how light spreads across\u00a0that surface rather than through it. \u00a0The reason for this extra layer is because skin and flesh diffuse light in a unique way compared to more homogeneous materials like stone or milk.<\/p>\n Let’s have a look at what each of these layers looks like independently (without changing the defaults).<\/p>\n Good values for the epidermal layer are a slightly yellowish color, a weight of 0.5, and a radius of around 0.2 to 0.4 inches. \u00a0Notice what a huge impact the epidermal layer has on the overall coloration of this material! \u00a0It’s pervasive but the default scatter depth is so low that much of the detail in the dragon’s scales is still there.<\/p>\n This is the SSS Fast Skin Material epidermal layer isolated from the other layers.<\/p>\n<\/div>\n The subdermal layer operates in pretty much the same way as the epidermal layer (and the original SSS Fast Material). \u00a0This tends to be a\u00a0deeper, reddish scattering effect. \u00a0A reddish\/orangeish color with a weight of around 0.5 and a radius of 0.4 to 1.0 inches would be a good place to start experimenting. \u00a0Remember that if you’re setting the scatter radius unusually high or low, you may need to adjust your scale conversion factor!<\/p>\n Notice in this render how much detail we’ve lost due to this component’s high scatter radius. \u00a0This is probably one of the biggest color components in the material.<\/p>\n This is the SSS Fast Skin Material sub-dermal layer isolated from the other layers.<\/p>\n<\/div>\n As with the SSS Fast Material, this scattering represents light going entirely through the material. \u00a0You can set this scattering as deep as you need, but generally light doesn’t go through flesh very far. \u00a0In the image below you can see that the back-surface scattering isn’t a very heavy part of this example. \u00a0We could increase the weight manually in order to get more scattering in the dragon’s tail and claws.<\/p>\n This is the SSS Fast Skin Material epidermal layer isolated from the other layers.<\/p>\n<\/div>\n The skin specularity functions are two-layered, allowing simulation of both the broad soft specularity of skin and any near-reflective specularities of top layer oiliness and wetness. \u00a0Notice that this layer is inherently blue-ish and is less glossy than the secondary specular layer.<\/p>\n\n
<\/ul>\n
What is Sub-Surface Scattering<\/h1>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
What Sub-Surface Scattering Options Are Available<\/h1>\n
\n
Sub-Surface Scattering Examples<\/h2>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
A Deep Dive into the SSS Fast Material<\/h1>\n
<\/a><\/p>\n
SSS Fast Material Parameter Definitions<\/h2>\n
<\/a><\/p>\n
SSS Fast Material (mi) Parameters<\/h3>\n
Scatter Group<\/h4>\n
Lightmap Size<\/h4>\n
Number of Samples<\/h4>\n
<\/a><\/p>\n
Bump Shader<\/h4>\n
Diffuse Sub-Surface Scattering<\/h3>\n
Ambient \/ Extra Light<\/h4>\n
<\/a><\/p>\n
Overall Diffuse Coloration<\/h4>\n
<\/a><\/p>\n
Unscattered Diffuse Color<\/h4>\n
<\/a><\/p>\n
Unscattered Diffuse Weight<\/h4>\n
<\/a><\/p>\n
Front-Surface Scatter Color<\/h4>\n
Front-Surface Scatter Weight<\/h4>\n
<\/a><\/p>\n
<\/a><\/p>\n
Front-Surface Scatter Radius<\/h4>\n
<\/a><\/p>\n
Back-Surface Scatter Color<\/h4>\n
Back-Surface Scatter Weight<\/h4>\n
<\/a><\/p>\n
<\/a><\/p>\n
Back-Surface Scatter Radius<\/h4>\n
Back-Surface Scatter Depth<\/h4>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
Specular Reflection<\/h3>\n
Specular Color<\/h4>\n
Shininess<\/h4>\n
<\/a><\/p>\n
<\/a><\/p>\n
Advanced Options<\/h3>\n
Lightmap Gamma Curve<\/h4>\n
Scatter Indirect Illumination<\/h4>\n
Scale Conversion Factor<\/h4>\n
<\/a><\/p>\n
Scatter Bias (+\/- 1.0)<\/h4>\n
<\/a><\/p>\n
Falloff Strength<\/h4>\n
<\/a><\/p>\n
‘Screen’ (soft) Compositing of Layers<\/h4>\n
Looking into the SSS Fast Skin Material<\/h1>\n
<\/a><\/p>\n
SSS Fast Skin Material Diffuse Layers<\/h2>\n
Epidermal (Top) Layer Scatter<\/h4>\n
<\/a><\/p>\n
Subdermal Layer Scatter<\/h4>\n
<\/a><\/p>\n
Back-Surface (Through) Scatter<\/h4>\n
<\/a><\/p>\n
SSS Fast Skin Material Specularity<\/h2>\n
Primary Specularity<\/h4>\n