Diffraction


Shader Type: Texture
Output: Color (RGB) value
Advanced refraction shader, able to compute not only correct (glossy) refractions, but also dispersion effects.

Refraction


Input Input color that gets mixed with the refraction. Normally, you will want to put an illumination node into this.
Refraction The amount of refraction that gets applied. Note that if you set alpha to 0, then no transparency gets passed through the shader.
Index of Refraction The index of refraction of the material. Higher IORs denote denser media, lower IORs thinner media. 
Normal Blend This will bend the direction of the refracted ray towards the surface normal. It should give you somewhat more realistic results if you set this to twice the Glossy factor, by avoiding ray hits directly below the sampled point... Chances are you will never want to touch this, and leave it at 0.


Absorption


Filter A simple multiplicative filter that gets applied before the refraction is mixed with the input. You can set/texture this to vary the intensity of the material or the color without affecting the relative mixing of the base material and the refraction.
You can get different effects using this in conjunction with the absorption controls (see below).
Consider thickness? This will turn the thickness calculations on or off. If this is off, the filter color will simply be multiplied with the refration result, no matter how thick the material is.
If it is turned on, the intensity of the filter color will be varied according to the thickness of the material the refracted rays have to travel through.
You should leave this turned off unless you need it, even if absorption is at 0.0. The speed hit is very small, but noticeable.
Absorption The amount of absorption that gets applied. The filter color is taken to the power of the distance the refracted ray had to travel to the first hit. For a filter color of RGB(0.5, 0.5, 0.5) and a distance of 1 unit, RGB(0.5, 0.5, 0.5) will be applied. If the thickness was 2, RGB(0.25, 0.25, 0.25) will be applied, and so forth.
This value modifies the ray distance by multiplying it. Lower absorption values mean thinner media (less color), higher absorption values mean denser media (more color).
You can set this to a negative value to get the filter color to act as absorption color (you then will have to set the intensity > 1.0, or the refraction will gain energy instead of losing some).
Note also, that absorption only gets applied for front faces - if you get a strange "inverted" look, try flipping the normals of your mesh.

While the absorption is fast and nice, it is no full replacement for a volume shader. If you have very complex materials with holes and many intersections, it might be better to use a volume shader to get density effects.


Ray-depth exhaustion


Mode Determines what to do if mental ray runs out of either reflection or refraction depth. The default of "Sample environment" will do just that, sample the environment like the standard shaders do. The second setting, however, will allow you to put an arbitrary texture-map into the Exhaustion slot that gets sampled instead. In the simplest case this is just a constant color (which can already give very good results).
Exhaustion Allows you to specify an arbitrary color (or texture map) to use for sampling when the refraction and/or reflection depth has been exhausted. Note that specifying a simple color can give very good and fast results! You can also use this to specify an extra "environment map" to sample instead of the one associated with your material.


Stochastic


Maximum Depth Sets the maximum depth up to which glossiness or aberration get applied. You will get all these effects as long as it is set >= 1. By setting maximum depth to 0, you can effectively disable aberration and glossiness. Note that normally you won't need more than the default of 1, and that rendertime increases exponentially for changing this value.
Samples The number of rays that get cast into the scene. Setting this to 0 effectively disables all stochastic effects. Notice that for aberration effects, values that are a power of two (2, 4, 8, 16, 32, ...) will yield the best results, especially in the lower sample ranges. Start with a value of 4 and increase slowly.


Stochastic - Glossiness


Glossy Sets the amount of glossiness. A value of 0 disables the effect. 0.5 equals completely glossy refraction (samples can be deflected up to 90 degrees, so sampling effectively takes place in a hemisphere) while a value of 1 will result in completely random rays (sampling takes place in a sphere). You will normally want to use low values, like 0.01.


Stochastic - Dispersion


Aberration Sets the absolute amount of aberration that gets applied. This means, that the IOR is modified for different wavelengths of light. For an IOR of 1.5, and an aberration of 0.1, the effective IOR for (Infra)red light is set to 1.45, and the IOR for blue (ultraviolet) light is set to 1.55. Long wavelengths (red) are refracted less than short wavelengths (blue). This results in a rainbow gradient at the edges of contrasts. You can set aberration to a negative value to invert the effect (refracting red light MORE than blue light). The amount of aberration is absolute, and independent of the set IOR. An IOR of 1 with aberration 0.1 will result in the same amount of dispersion as an IOR of 2 with aberration 0.1.
Note that the simulation of aberration is NOT physically correct. It was built to look good and render (reasonably) fast.
Saturation Changes the color intensity of the rainbow patterns created through the aberration effect. A value of 0 takes away all color, resulting in a simple directional blur, while 1 leaves the rainbow colors untouched. You can set this value to be negative (resulting in an inverted aberration effect), or greater than 1 (resulting in an enhanced, overdriven aberration effect). You can normally leave this untouched.
Transposition This parameter allows you to effectively change the wavelengths of light. Normally, red has the longest, and blue the shortest wavelength. If you adjust this value, you can shift the entire visual spectrum, making for example yellow the shortest and pink the longest. You normally can leave this untouched. Note that -1 = 0 = 1.

Render Tree Usage
Originally just built to be a replacement of the standard XSI Refraction node (minus the refraction bug), this shader evolved to a complete replacement and enhancement of the Refraction_Diffuse node. The glossiness value will deliver superior results to the standard node, and the dispersion values can add very much to the realism of refractive materials (especially of diamonds and crystal).
Note that while it is perfectly valid to use glossiness and aberration at once, you will very likely need a big sample value ( > 32) to get relatively smooth results.