Diffusion


Shader Type: Material (Illumination)
Output: Color (RGB) value
Performs sub surface scattering.

Basic


Surface This is a simple premultiplication color. Whatever the outcome of the SSS calculations for the current sample, it will be multiplied by this value. Use it to tint the output color and to drain specific colors from the calculations.
Absorption The Absorption color is the "target" color of the scattering. It specifies the color of the material the light has to travel through when it goes through the object. It is not the color that will get drained out of light (like in the volume_effects node), but rather the color that will remain. For example, for flesh, you would set this to dark red, and for jade to a nice saturated green. Try to keep all color channels at less than 1.0, or light passing through the object will actually gain energy in that specific channel. Of course you can use this for interesting effects.
Diffusion The Diffusion value sets the maximum distance to which samples are distributed into the object. Sample rays are being shot into the object in a hemispherical pattern (in the most simple of cases), and the Diffusion value limits the distance those rays will travel. The higher this value, the softer will the sub surface scattering appear. Shadows will get blurred more, and surface features will be smoothed out. The downside however is that you will need more samples to get a smooth solution.
Intensity This sets the general translucency of the material. The higher this value, the further light will travel through the object before being drained out. It is a multiplier for the absorption color, so you will achieve similar effects by increasing the Intensity value or by choosing a brighter Absorption color. Generally try to have a higher Intensity value than Diffusion. If the Diffusion is a lot higher than the Intensity, the solution will be very dark and you will require enormous Sample values to get smooth results.
Samples This sets the number of primary sample rays that are shot into the object. High values will increase rendering time but give visually more appealing results, while lower values will cause sampling artifacts and increase rendering time.
Direct Scattering This sets the amount of direct scattering that is added to the output color. Direct scattering means direct surface to surface light transport. If you light a block of soap from behind, the light that directly travels through to the other side of the object contains a lot of directly scattered photons.
Direct Scattering is normally a lot noisier and darker than the indirect scattering, which is a result of the used algorithm. You can often live without any direct scattering at all, which can save a bit of render time, but especially when you are using secondary illumination to light up your scene, direct scattering can help to distribute energy throughout the object.
Indirect Scattering Indirectly Scattered light is light that gets bent "around the corner". If you point a laser at a block of marble, you will notice that there is a halo of light around the entry point. Photons get bounced around in the marble and exit the material close to the entrance point. This is what indirect scattering tries to simulate.
Indirect scattering greatly depends on the light positions, as does the speed of the shader. For each sample location won by shooting rays into the object, new rays are sent out, one for each light in the light list. This means that for 16 samples and 3 lights, 16 + (16 * 3) probe rays have to be traced. Therefore, try to keep the number of lights and the Samples value to a minimum.


Scattering


Index of Refraction This allows you to specify an IOR for your material. The human epidermis for example has an IOR of 1.45, Ivory 1.54 Jade of 1.61 and teeth are about 1.655. Using the default settings, the IOR is ignored, and rays are based around the negative surface normal. If you change the Refractiveness to a value > 0.0, rays are more and more bent towards the refraction vector.
Refractiveness This is a blending value between the negative surface normal and the refraction vector. At 0.0 (the default), the IOR is ignored and samples are based around the inverted surface normal. This also means that the scattering only depends on the light position, and not on the viewer position. If this value is non-zero, the solution will change if the camera position changes.
Spread This sets how much primary sampling rays are spread around the base vector, which in turn is a blend between the negative surface normal and the refraction vector, as set by the Refractiveness. The default value of 1.0 will sample in a perfect hemisphere, 0.0 will not spread the rays at all (all primary sample rays will have the same direction), and values between will smoothly interpolate between the two choices using a phong-exponent like distribution.
Note that the case Spread == 0.0 is specially optimized. Only a single primary ray will be shot, and all primary sample locations will be situated along that ray. This can give a considerable speed boost, but can also cause shadows to be very sharp and textured scattering to become very directional. Also, direct scattering can cause very ugly artifacts, so you might want to set the Direct Scattering value to 0.0 as well. Experiment a bit with the spread, it can greatly enhance rendering times if set to 0.0.
Textured scattering? If enabled, the shader will sample the Scatter input at every exiting location on the material. Other inputs (like Surface or Absorption) can also be texture mapped, but they will only get evaluated a single time, at the eye ray entry point. The Scatter input however can be used to blur surface textures, like in a marble chess board where neighboring chess fields bleed a bit into each other.
Do not enable this unless you really need it. The shader has to flush mental ray's shader cache for every sample taken, which can cause extreme slow downs.
Scatter A special color input, that will get sampled at every exiting location instead of only the primary shading location. Use high contrast texture maps for best results, like checkerboards or marble textures. Using this input for scattering a skin pore map is a waste of render time.


Illumination


Use irradiance for scattering? The shader will always contribute to secondary illumination (Final Gathering in this case), if you want to exclude it from final gathering you should use a ray type switcher. The shader will not evaluate indirect illumination at exiting locations, however, but only sample the lights in the light list by default. If you enable this checkbox, the shader will compute the influence of secondary illumination (FG, GI and Caustics) at every exiting location and scatter this illumination as well. This can cause slowdown, but can help with distributing energy through objects.
Radiance Like for other illumination shaders, the Radiance controls the influence secondary illumination has on the Diffusion shader.
Area light samples As already mentioned, the shader evaluates the incoming illumination at every exiting location. This means that shadow rays get cast and/or shadow maps evaluated. In the case of area lights, the Diffusion shader can cause enormous amounts of shadow rays to be cast. You can use the Area light samples value to sub-sample area lights. Since shadows anyway get blurred by the Diffusion shader, you can get away with far lower shadow ray counts than on a hard surface, like a Phong shader.
The default of 0 will use whatever settings you have made in the area lights. For example, if your area light has sample settings of U = 3 and V = 3, 9 shadow rays get cast for each exiting location. For 16 samples, with Direct and Indirect scattering, this will cause 288 shadow rays to be cast for every eye ray that hits the Diffusion shader. If you set this value to something different than 0, sampling will stop at the set number. With an Area light samples value of 2, only 64 shadow rays are cast.
Surface shader The Diffusion shader is not meant to be used alone, but in conjunction with a standard surface illumination model. I didn't want to confine the user to e.g. a Lambertian model with a Phong highlight on top, and therefore put this input into the shader. You simply connect a standard surface illumination node (Lambert, Blinn, Phong, Cook-Torrance, etc...) to it, and blend it with the Diffusion solution.
Surface shader amount This controls the amount of surface shader that will get mixed into the final result. The output color of the Diffusion shader is a simple add: Direct Scattering + Indirect Scattering + Surface shader. As a rule of thumb, Direct Scattering and Surface shader amount should have about the same values, and Indirect Scattering should have about 1.0 - Direct Scattering. So, if you set Direct and Surface to 0.3, Indirect should be about 0.7. Those are only starting points for experimentation of course, and you can use whatever looks good.
Lights A light list containing all the lights that will be used for the simulation. Try to keep them to a minimum - as already pointed out above, the number of lights can greatly influence the render time.



Render Tree Usage
The Diffusion shader is an illumination node, and as such normally belongs into the surface input of your material. Note that it does not include any shadow or photon tracing code, you should use other nodes to feed those inputs.