1. Preliminaries

As well as anything related to raytracing with Blender, because of the supplementary calculus time required by your computer, raytracing is only an option that you should feel free to activate and deactivate. This is done by the mean of the Render menu. The Shading panel shows an option labeled Ray Tracing you will have to activate in order to use raytracing in your pictures.

2. Setting transparency

In the Material menu, you can define the base color of your object within the Diffuse panel tab thanks to the color picker, just like usual. In the Transparency panel, you will find the Alpha parameter whose value ranges from 0.000 (object totally invisible) through 1.000 (object totally visible). Blender can use not less than three different methods to handle transparency:

  • "World" based transparency
  • Z-Depth based transparency
  • Raytraced transparency

Only the latest is considered modern and realistic, but the two others are cheaper, computation timewise. The second method is a good compromise between results (at a given distance) and computation times.

2.1 "World" based transparency

This is the most primitive type of transparency. Basically, it blends the Diffuse material color with the World menu's World colors (textures included) according to the opacity Alpha value. Unfortunately, depending of the World settings, such a render will give you a ghostly material, which will be disappointing if you want to achieve some realistic results, unless you have no blocking objects in the view behind the transparent surface (some outdoor scenes, for example).

Apart from setting any Alpha value in the Transparency panel, you don't have anything else to do to enjoy this method. For example, with an opacity Alpha value of 0.250, the object will have a mix of only 25% (Alpha x 100 %) of the Diffuse color, and 75% (the complementary part: (1-Alpha) x 100 %) of the World color. Obviously, you can somehow cheat even in closed environments by adding a texture to the World, which will reduce the ghostly effect.

2.2 Z-Depth based transparency

Unfortunately, most of time, there are blocking objects in the background and their colors DO matter and have to be viewed throuh the front transparent object. Luckily, as a scanliner, Blender virtually stores the distances of any surface point from the camera in a depth buffer called the Z-buffer, so it is very easy for it to sort the surfaces from the point of view of the scene. Basically, when deciding the color of a given pixel from the final rendered image, if it belongs to a transparent surface, the scanliner will pick the color of the next surface immediately behind it in the Z-buffer and mix it according to the opacity of each materials. For example, still with an Alpha value of 0.250, the rendered pixel would have a color made from 75% of the color of the object standing behind it and 25% of the Diffuse color of the transparent object.

With this method, the results are better looking, and easily take into account multiple transparent surfaces. Unfortunately, the transparent surfaces seem to lack thickness and density of some sort, as show in the following picture.

In order to benefit from this technique, in the Transparency panel, you have to make sure that Transparency option is ticked on, and to activate the Z Transparency button.

2.3 Raytraced transparency

When you look through a glass, a bottle, an ashtray, or any fancy glass object, you will see that the background environment is deformed by the thickness and the curves of the object. This phenomenon is called refraction, and simulating it would add a lot of realism to the render. It currently can only be done using raytracing: a ray in sent from the camera ; when it reaches a transparent surface, instead of showing what is exactly behind it on the same trajectory, the ray will be defelected by the curves of the transparent surface according to its density, then showing a slightly different part of the environment.

In order to set this behavior, go back into the Transparency panel and activate the Raytrace button. As for the Z Transparency test case, the glass object will show the objects standing behind it, and not anymore the background set in the World menu. But in order to get the image distorsion through the transparent surface, you have to set the density of the material.

You will notice that the ZTransp and Ray Transp buttons are mutually exclusive. The first depends on scanline calculations, while the second depends on raytracing calculations. The second is the most physically accurate method, the first one being just an approximation, faster to compute, though! Obviously, nothing prevent you from mixing the two methods within a single scene, in order to optimize calculation times where realism would not be noticeable enough, from the actual point of view of the scene.

2.3.1 IOR

Setting the density is as simple as increasing the value of the IOR slider beyond 1.000 in order to witness the refraction phenomenon. Jump to 3.1 Light refraction, hereafter, for more information on this, but two values are very useful and should be known by any serious 3D enthusiast: 1.52 for glass and 1.33 for water.

2.3.2 Depth

This button lets you set the "depth" of the transparency, that is, the number of transparent surfaces stacked behind each other along the ray direction, and that will be effectively rendered as transparent materials. The transparent materials in excess of this threshold will be rendered plain and solid, according to their base shader.

From upper left to bottom right: Depth values of 1, 2, 4 and 10

2.3.3 Fresnel, Fac

By default, the material is rendered with a transparency level even on all its surface. By increasing the Fresnel value, you can artificially make the material more plain and solid on the outer edges, and using the Blend button, you can fine-tune the Fresnel effect. Behavior is quite close to Fresnel effect applied to reflective materials.

3. Hints to know about

Even if you know have a fair basic knowledge of transparency, you will most probably come to some more questions about its usage, and you will find the proper answers hereafter.

3.1 Light refraction

You certainly have been surprised when looking through a drinking glass (or any other glass object, with curved surfaces) and when you saw for the first time a distortion of the objects located in the background of it. In fact, with transparent objects, like glass, the path of the light is no more linear, but is deflected according to the curvature of the object and its density. This phenomenon is called light refraction. In Blender, you can simply reproduce it by activating the Raytrace option in the Transparency panel, and then setting the IOR slider (Index of Refraction) with a density value greater than 1.00.

Of course, choosing the good values for the Index of Refraction is not easy, but there are many documents containing whole lists of materials with their associated IOR, based on the density of the material. Here's a short abstract from them, with some common values.

* Air 1.0002926
* Alcohol 1.329
* Amber 1.546
* Amethyst 1.544
* Diamond 2.417
* Emerald 1.576
* Glass 1.51714
* Oxygen (gas) 1.000276
* Oxygen (liq) 1.221
* Plastic 1.460
* Plexiglas 1.50
* Quartz 1.544
* Topaz 1.620
* Turquoise 1.610
* Water (gas) 1.000261
* Water 100'C 1.31819
* Water 20'C 1.33335
* Water 35'C (Room temp) 1.33157

3.2 Shadows cast by transparent objects

Now we delete the texture of the ground and give the lamp a different orientation, in order to be able to see shadows in the foreground. We can notice that all the objects (cube, spheres, glasses, etc.) have solid shadows, while if we carefully look at the shadows of a real glass on a table, for example, we will see that they should be lighter. Blender can easily take into account the transparency of the material in order to cast more or less solid shadows (and even provide the shadow a hue depending of the color of the transparent surface). For this, you have to adjust the shader of the object receiving the shadow, and not the shader of the object emitting the shadow: this is the only tricky step of this tutorial. In order to conclude on this topic, let's select the ground of the scene, and go to the Material menu, in the Shadow panel. Then acitvate the Receive Transparent tick option and notice how the shadows look different now.

Without and with the option Receive Transparent activated

3.3 Blurry refractions

The very same way blurry reflections has been implemented, you can settle blurry refrections for transparent objects. For example, in the following picture, the Gloss value has been set at 0.850. This property is very interesting for the simulation of depolished, frosted or smoked glasses, with the proper shaders. The other properties (Samples and Threshold) work the same as for the blurred reflections tutorial.

3.4 Colored glass

A lot of the glass objects in our surroundings are colored. This is the case for vases, bottles or any fancy glass objects. Try to give to the material a classic "bottle green" color:

The result is not satisfactory, because the hue is very feint, while the colors of the background are dominant. In order to achieve the illusion of colored glass, you will have to use the Filter parameter. The values close to 1.000 makes the base color of the material to be dominant, while the values close to 0.000 makes the background colors to be dominant.

From top left to bottom right, Filter values of 0.250, 0.500, 0.750 and 1.000

Article written on December the 26th, 2004.
Updated on November the 23rd, 2008 for Blender 2.48a. Comments re-initialized.
Updated on June the 14th, 2010 for Blender 2.50 Alpha 2.