{"id":3636,"date":"2010-07-07T05:10:26","date_gmt":"2010-07-07T05:10:26","guid":{"rendered":"http:\/\/www.mrbluesummers.com\/?p=3636"},"modified":"2010-09-29T18:16:58","modified_gmt":"2010-09-29T18:16:58","slug":"3dsmax-mental-ray-sub-surface-scattering-guide-part-2","status":"publish","type":"post","link":"http:\/\/www.mrbluesummers.com\/3636\/3d-tutorials\/3dsmax-mental-ray-sub-surface-scattering-guide-part-2","title":{"rendered":"Sub-Surface Scattering Guide Part 2"},"content":{"rendered":"
Welcome to the second part of my sub-surface scattering guide for 3dsMax and mental ray. In this epic tutorial we’re looking at how you can use mental ray’s Sub-Surface Scattering (SSS) tools in order to make your renders more realistic. This technique is often misused, misunderstood, and- if implemented wrong- can seriously affect your render times. After 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
Just like before, 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 for any complex effects. \u00a0I strongly recommend that you at least glance over the first part of this \u00a0SSS guide<\/a> in order to make sure you have a strong understanding of the basic concepts before tackling this second section.<\/strong><\/p>\n Remember that this guide is geared toward discussing what options are available in the 3dsMax implementation of mental ray, followed by detailed guidance on each material and shader type. \u00a0Toward the end of this section we’ll put these concepts into practice by manipulating renders step-by-step.<\/p>\n In part 1 of this tutorial<\/a> we discussed<\/p>\n Then, in Part 2 of this tutorial we’ll discuss<\/p>\n You can\u00a0download 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 This material type is significantly different from the Fast SSS Material<\/a> and Fast SSS Skin Material<\/a> in that it’s a true scattering solution based on photons. \u00a0That makes it significantly slower and more difficult to work with<\/em> and should only be used where absolutely necessary. \u00a0Consider the following from the mental ray manual:<\/p>\n The fast shader is recommended for:<\/strong><\/p>\n The physical shader is recommended for:<\/strong><\/p>\n You\u2019ll want to use the physical shader for highly refined renders like close-up products or more scientific renders and visualizations. \u00a0Otherwise the fast shader family has everything that you need.<\/p>\n Also I wanted to include a disclaimer for the images in this section. \u00a0The SSS Physical Material requires a lot of calibration in order to look good. \u00a0However this runs contrary to what I’m trying to do in this tutorial; to provide you with images that demonstrate only one change in a material with otherwise default settings. \u00a0That’s why some of these renders might be kind of ugly.<\/p>\n Now that the warnings are out of the way, let’s dig into the SSS Physical Material and get comfortable with the controls. In order for the SSS Physical Material to work properly, you must enable caustics generation. \u00a0Don’t forget to enable “All objects generate & receive caustics” if you don’t want to set up a more complex solution.<\/strong><\/p>\n We’ll begin by going over the SSS Physical material parameters and how they impact the material during renders. One thing to notice is that the SSS Physical material and the SSS Physical shader have the same parameter set. \u00a0This is because they’re basically the same thing. \u00a0The SSS Physical material is actually just a mental ray material that has the SSS Physical shader assigned to the “surface” and “photon” slots. \u00a0Since this is the case, we’ll only look at the material and I’ll leave exploring the shader component to you as homework. \u00a0See the image below.<\/p>\n The SSS Physical Material is identical to a mental ray material with instanced SSS Physical shaders in the Surface and Photon slots.<\/p>\n<\/div>\n As with before, 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 dragon is 0.0 and the right side of the dragon is 1.0, with escalating values in between.<\/p>\n This is the original render with the gradient ramps along the bottom.<\/p>\n<\/div>\n The material parameter controls what the surface properties of the SSS Physical material should be. \u00a0For example, if you put a DGS Material (3dsMax) shader in this slot, you’ll get a diffuse-glossy-specular control that you can use to make a ceramic-looking effect. \u00a0The image below uses our rainbow map.<\/p>\n This image has the rainbow map in the material map slot.<\/p>\n<\/div>\n Transmission controls the color that light takes as it passes through the material. \u00a0For example a character’s skin might have a reddish color for the transmission swatch, while a green wax candle would have a green color. \u00a0Remember that a white or grey color in the transmission slot will take on photons of all colors, rather than photons of one specific color. \u00a0This is why you’ll tend to see multi-colored splotches in the default SSS Physical material.<\/p>\n This image has the rainbow map in the transmission color map slot.<\/p>\n<\/div>\n You should already be familiar with what index of refraction controls. \u00a0This will change how light is “bent” or refracted as it passes through the material. \u00a0A value of 1 is the equivalent to air and 1.33 is equivalent to water.<\/p>\n This image has a gradient ramp in the index of refraction map slot. Values are 0.0 to 1.5.<\/p>\n<\/div>\n The absorption coefficient is a 3 part parameter that controls the absorption of light as it passes through the material. \u00a0Each component represents an RGB color value, not an XYZ direction value.<\/p>\n This image has a gradient ramp in the absorption coefficient map slot. Values are 0.0 to 1.0.<\/p>\n<\/div>\n Similar to the absorption coefficient, the scatter coefficient is also a 3 part parameter except this one controls the scattering of light as it passes through the material. \u00a0Again, each component represents an RGB color value, not an XYZ direction value.<\/p>\n This image has a gradient ramp in the scatter coefficient map slot. Values are 0.0 to 1.0.<\/p>\n<\/div>\n The scale conversion factor operates the same way as it does for the SSS Fast Material. \u00a0Check out it’s effects below. \u00a0Notice that values too close to 0.0 cause errors- black areas where mental ray refuses to render the material.<\/p>\n This image has a gradient ramp in the scale conversion factor slot. Values are 0.0 to 3.0.<\/p>\n<\/div>\n The scattering anisotropy parameter controls how light travels once it enters the object. \u00a0The range of this parameter is between -1 and 1. \u00a0A value of zero means it travels the same in all directions. \u00a0A value above zero favors “forward scattering” where light prefers to continue going the way it’s is already going, while a value below zero favors “back scattering” where light prefers to bounce back the way it came.<\/p>\n This image has a gradient ramp in the scatter anistropy slot. Values are 0.0 to 1.0.<\/p>\n<\/div>\n The depth parameter controls how deeply light should penetrate the object. \u00a0As you can see in the image below, low values will force light to stay very shallow in the object making it glow and sparkle. \u00a0Values that are too high will cause light to get pretty buried in the object and dull the effect. \u00a0Finding a happy medium is key!<\/p>\n This image has a gradient ramp in the scatter depth slot. Values are 0.0 to 1.0.<\/p>\n<\/div>\n The max samples parameter controls how many samples to take during the rendering process. \u00a0You can increase this value in order to get smoother results but you’ll rarely have to go above 512. \u00a0I like to set this at 256 until I’m ready for a final render.<\/p>\n This image has a the maximum samples value set to 256.<\/p>\n<\/div>\n The max photons parameter controls how many photons should be sampled within the max radius during rendering. \u00a0I.E. if you have max photons set to 1,000 and max radius set to 5cm, then during render each sample will look around up to 5cm for photons and collect up to 1,000 photons. \u00a0Values up to about 1,000 should be fine. \u00a0I like to set this to 512 until I’m ready for a final render.<\/p>\n This image has a the maximum photons value set to 512.<\/p>\n<\/div>\n The maximum radius controls how far each lookup should go in searching for photons during render. \u00a0A low value means very little smoothing will happen to the solution so you’ll need high photons and samples. \u00a0A higher value will smooth out the effect allowing for faster renders, but if set too high it could look unrealistic or dull.<\/p>\n This image has a gradient ramp in the max radius slot. Values are 0.0 to 1.0.<\/p>\n<\/div>\n This is pretty straightforward. \u00a0It’s a list of include\/exclude lights to help you refine the effect. \u00a0You can add lights to this list and control how they’re considered using the “mode” parameter.<\/p>\n Mode is an enumeration with only 3 settings so I’m not sure why it’s a spinner. \u00a0See the table below for what each mode means.<\/p>\n Now that we’ve gotten familiar with the SSS Physical material, we can look at one of the most over-looked SSS techniques- the Parti-Volume shader. \u00a0What’s tricky about the Parti-Volume shader is that it follows a different paradigm to the SSS Fast Material and SSS Physical Material. \u00a0Instead of considering light traveling through a medium it calculates light as though it were traveling through some murky volume like dusty air or muddy water. \u00a0This technique was originally presented by Jeff Patton<\/a> in the CGTalk forums and it’s a pleasure to formalize his method in this tutorial.<\/p>\n The Parti-Volume Shader tends to be used for things like smoke or dust in the air, or cloudy water like in the ocean. \u00a0In our case, we’re going to use it for cloudy glass materials like muddy water, jade, or smoked glass.<\/p>\n The caveat to this technique is that it is painfully slow to render and is more of a theoretical exercise than anything else<\/strong>. <\/strong>You will be forcing your computer to render a really difficult material. \u00a0This is the price that you pay for the impressive realism of the technique.<\/p>\n The diagram below shows you a basic mental ray material that’s been set up with “glassy” shaders in order to create a basic Parti-Volume material. \u00a0All of the changes made in this section of the tutorial are with the Volume Shader (Parti Volume (physics)).<\/p>\n Part-volume as SSS solution setup.<\/p>\n<\/div>\n By setting the Extinction parameter in the Parti-Volume and Parti-Volume Photon shader to 0.35, (and all other parameters set to defaults) we get the image below.<\/p>\n This is the original parti-volume render.<\/p>\n<\/div>\n You’re probably wondering what’s going on here. \u00a0That’s not sub-surface scattering in the way we’ve been discussing it so far. \u00a0With caustics disabled, this isn’t a photon-based solution and it’s not Fast SSS either. \u00a0Instead it is a shader that allows light to pass through it in the form of ray-tracing and falloff, making it a different kind of sub-surface illumination. \u00a0You’ll notice that it has that same “jelly-like” look that a strong SSS Physical material might provide. \u00a0Thus, in a way, this tool should be kept in the same toolbox as your sub-surface scattering abilities. \u00a0Take a look at the image below where you can really see the light scattering and diffusion in effect. \u00a0With the lights brought lower to a simpler model, you can really see the diffusion. \u00a0If we wanted to get really fancy, we could even apply blurry transparency to this material through the surface shader.<\/p>\n This image was taken with a gradient ramp in the extinction slot. Values are 0.0 to 1.0.<\/p>\n<\/div>\n This mode parameter determines whether or not the height parameter is used. \u00a0If Mode is set to 0 then the material is the same throughout the entire volume. \u00a0If the mode is set to 1, then there is only cloudiness at the specified height or lower.<\/p>\n The scatter color proved difficult to pin down since using the rainbow map in this slot caused the entire material to result in errors. \u00a0It turns out that procedural maps do alright, so I used a marble map below.<\/p>\n The documentation says that this map determines the color of the direct and indirect light that gets scattered.\u00a0Apparently\u00a0this is a multiplier of the photon energy for the photons in the photon volume map.<\/p>\n This image has a marble map in the scatter color slot. It wouldn't take a bitmap for some reason.<\/p>\n<\/div>\n <\/span><\/p>\n This image uses a gradient ramp to control the Extinction value. Values are 0.0 to 1.0.<\/p>\n<\/div>\n These three parameters control the scattering process. \u00a0If g1 and g2 are set to “0” then you’ll get what’s known as isotropic scattering or diffuse scattering. \u00a0That’s where light is diffused in every direction as it passes through the material. \u00a0The reason there are three parameters is because mental ray uses a two-part model.<\/p>\n Think of g1 and g2 as scatter anisotropy from before. \u00a0They control whether light bounces mostly forward (high values of g) or mostly backward (values of g between 0.0 and -1.0). \u00a0r is a weighting factor that lets mental ray decide the importance of g1 vs g2. \u00a0g1 is multiplied by r while g2 is multiplied by (1 – r).<\/p>\n For example,<\/p>\n will yield the anisotropic values of 0.25 and -0.125.<\/p>\n This image uses a static r value (1) and g1 values are -1.0 to 1.0.<\/p>\n<\/div>\n This parameter spans between 0 and 1 . \u00a0Lower values mean a uniformly-distributed material (like haze or mist) while higher values introduce noise into the material like cloudy quartz.<\/p>\n This image has a gradient ramp controling the non-uniform slot. Values are 0.0 to 1.0.<\/p>\n<\/div>\n The height parameter is used in conjunction with the mode parameter. \u00a0When mode is set to 1, the height parameter determines at what point the “fogginess” of the material should stop. \u00a0I.E. a value of 1cm means that above 1cm the material should be clear.<\/p>\n This image has the height controlled by a gradient ramp. Values are 3.0 to 15.0.<\/p>\n<\/div>\n Minimum and maximum step length control the quality of the effect. \u00a0This is very similar to how ordinary 3dsMax volumetric effects work. \u00a0A longer step length will decrease the quality of the effect and speed up your render. \u00a0A shorter step length will increase the quality of the effect while increasing render times, too. \u00a0Think of these in the same way as min\/max samples in mental ray.<\/p>\n Below is a side-by-side comparison of a low quality render, the original render, and one with substantially higher quality (and a very <\/strong>long render time).<\/p>\n\n
\n
The\u00a0SSS\u00a0Physical Material & Shader<\/h1>\n
\n
\n
SSS Physical Material Parameter Definitions<\/h2>\n
<\/a><\/p>\n
<\/a><\/p>\n
Material<\/h3>\n
<\/a><\/p>\n
Transmission<\/h3>\n
<\/a><\/p>\n
Index of Refraction<\/h3>\n
<\/a><\/p>\n
Absorption Coefficient<\/h3>\n
<\/a><\/p>\n
Scatter Coefficient<\/h3>\n
<\/a><\/p>\n
Scale Conversion Factor<\/h3>\n
<\/a><\/p>\n
Scattering Anisotropy<\/h3>\n
<\/a><\/p>\n
Depth<\/h3>\n
<\/a><\/p>\n
Max Samples<\/h3>\n
<\/a><\/p>\n
Max Photons<\/h3>\n
<\/a><\/p>\n
Max Radius<\/h3>\n
<\/a><\/p>\n
Lights<\/h3>\n
Mode<\/h3>\n
\n
Using the Parti-Volume Shader for SSS<\/h1>\n
Parti-Volume Shader Parameter Definitions<\/h2>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
Mode<\/h3>\n
\n
Scatter Color<\/h3>\n
<\/a><\/p>\n
Extinction<\/h3>\n
This controls how much light is absorbed or scattered in the material. \u00a0A value of 0.0 means means totally clear air or material. \u00a0In this case, it would be clear glass. The higher you set this value, the denser the material will become (and the more scattering you’ll see). Note that a high extinction value won’t allow photons to enter deep into the object since they will have already been scattered.<\/span><\/h3>\n
<\/a><\/p>\n
r<\/h3>\n
g1<\/h3>\n
g2<\/h3>\n
r = 0.5<\/pre>\n
g1 = 0.5<\/pre>\n
g2 = -0.25<\/pre>\n
<\/a><\/p>\n
Non Uniform<\/h3>\n
<\/a><\/p>\n
Height<\/h3>\n
<\/a><\/p>\n
Minimum Step Length<\/h3>\n
Maximum Step Length<\/h3>\n