Materials - Transparency in Blender
Materials - Transparency in Blender
Transparency
Mode: All Modes Panel: Shading/Material Context Transparency Materials in Blender can be set to be transparent, so that light can pass through any objects using the material. Transparency is controlled using an "alpha" channel, where each pixel has an additional value, range 0-1, in addition to its RGB color values. If alpha=0, then the pixel is transparent, and the RGB values for the surface contribute nothing to the pixel's appearance; for alpha=1, the surface is fully opaque, and the color of the surface determines the final color of the pixel. In Blender, there are three ways in which the transparency of a material can be set: Mask, Z-Buffer and Ray-trace. Each of these is explained in more detail below. The Material Preview option with a sphere object gives a good demonstration of the capabilities of these three options.
Common Options
The following property controls are available for all transparency options: Alpha Sets the transparency of the material by setting all pixels in the alpha channel to the given value. Fresnel Sets the power of the Fresnel effect. The Fresnel effect controls how transparent the material is, depending on the angle between the surface normal and the viewing direction. Typically, the larger the angle, the more opaque a material becomes (this generally occurs on the outline of the object). Specular Controls the alpha/falloff for the specular color. Blend Controls the blending between transparent and non-transparent areas. Only used if Fresnel is greater than 0.
Mask
This option simply masks the Background. It uses the alpha channel to mix the color of each pixel on the active object plane with the color of the corresponding background pixel, according to the alpha channel of the pixel. Thus for alpha = 1, the object color is seen - the object is completely opaque; but if alpha = 0, only the background is seen - the object is transparent (but note that any other object behind the active object disappears). This is useful for making textures of solid or semi-transparent objects from photographic reference material - a mask is made with alpha opaque for pixels within the object, and transparent for pixels outside the object. See Mask Transparency.
Z Buffer
This uses the alpha buffer for transparent faces. The alpha value of each pixel determines the mix of the basic color of the material, and the color of the pixel is determined from the objects/background behind it. Only basic settings are available with this option; it does not calculate refractions.
Raytraced Transparency
Uses ray tracing to calculate refractions. Ray tracing allows for complex refractions, falloff, and blurring, and is used for simulating the refraction of light rays through a transparent material, like a lens. Note that the RayTrace option is only available in the Blender Render and Cycles render engines, but not in the Game Engine. A ray is sent from the camera and travels through the scene until it encounters an object. If the first object hit by the ray is non-transparent, then the ray takes the color of the object. If the object is transparent, then the ray continues its path through it to the next object, and so on, until a nontransparent object is finally encountered which gives the whole chain of rays its color. Eventually, the first transparent object inherits the colors of its background, proportional to its Alpha value (and the Alpha value of each transparent Material hit in between). But while the ray travels through the transparent object, it can be deflected from its course according to the Index of Refraction (IOR) of the material. When you actually look through a plain sphere of glass, you will notice that the background is upside-down and distorted: this is all because of the Index of Refraction of glass. Enable Raytracing To get ray-traced transparency, you need to: 1. enable ray tracing in your Render settings. This is done in the Render context Shading Panel. Ray tracing is enabled by default. 2. set your Alpha value to something other than 1.0. 3. in order for the background material to receive light passing through your transparent object, Receive Transparent must be turned on for that material in the Material Shadow panel.
Options
In addition to the common options given above, the following property controls are available: IOR Index of Refraction. Sets how much a ray traveling through the material will be refracted, hence producing a distorted image of its background. See IOR values for Common Materials below. Filter
The Transparency Panel.
Amount of filtering for transparent ray trace. The higher this value, the more the base color of the material will show. The material will still be transparent but it will start to take on the color of the material. Disabled (0.0) by default. Falloff How fast light is absorbed as it passes through the material. Gives 'depth' and 'thickness' to glass. Limit Materials thicker than this are not transparent. This is used to control the threshold after which the filter color starts to come into play. Depth Sets the maximum number of transparent surfaces a single ray can travel through. There is no typical value. Transparent objects outside the Depth range will be rendered pitch black if viewed through the transparent object that the Depth is set for. In other words, if you notice black areas on the surface of a transparent object, the solution is probably to increase its Depth value (this is a common issue with ray tracing transparent objects). You may also need to turn on transparent shadows on the background object. Gloss Settings for the glossiness of the material. Amount The clarity of the refraction. Set this to something lower than zero to get a blurry refraction. Threshold Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped. Samples Number of cone samples averaged for blurry refraction.
Examples
Index of Refraction
(Influence of the IOR of an Object on the distortion of the background: spheres of Water, Glass and Diamond (top to bottom).). There are different values for typical materials: Air is 1.000 (no refraction), Alcohol is 1.329, Glass is 1.517, Plastic is 1.460, Water is 1.333 and Diamond is 2.417.
Influence of the IOR of an Object on the distortion of the background: spheres of Water, Glass and Diamond (top to bottom).
Fresnel
16 pieces of glass rotated in various directions demonstrate the angle-dependent Fresnel effect with ray-traced (left) and alpha buffered transparency (right). Note that the major difference is the lack of IOR effect in the latter case. (Download .blend.)
Settings for Fresnel using ray-traced (left) and Z transparency (right). Note the specular highlight in the F4 glass tile (which is facing midway between the light and the camera); the Fresnel effect can be seen in row C and column 6 where the faces are turned away from the camera. The amount of Fresnel effect can be controlled by either increasing the Blend value or decreasing the Alpha value.
Depth
A simple scene with three glasses on a surface, and three lamps. Depth was set to 4, 8, 12, and 14, resulting in render times of 24 sec, 34 sec, 6 min, and 11 min respectively. (Download .blend.)
Increasing Depth also considerably increases render time. Each time a light ray passes through a surface, the raytracing algorithm is called recursively. In the example above, each side of each glass has an exterior and an interior surface. Light rays thus have to pass through four surfaces for each glass. But not only that, at every point on a surface, some of the light can be reflected, or mirrored off the surface in various directions. This results in multiple rays needing to be calculated for each point (often referred to as a tree of rays [1] (http://www.cs.unc.edu/~rademach/xroads-RT/RTarticle.html) ). In each of the rendered images above there are 640400=256 000 pixels. By increasing Depth, at least one tree of rays is added to each pixel. Be kind to your computer. Carefully placing objects in a scene to avoid overlapping transparent objects is often an interesting alternative.
Hints
Transparent shadows
No transparent shadows
Transparent shadows with ambient occlusion set to multiply, distance 1 (radius of sphere)
By default, the shadows of transparent objects are rendered solid black, as if the object was not transparent at all. But in reality, the more transparent an object is, the lighter its shadow will be. In Blender, transparent shadows are set on the materials that receive the shadows from the transparent object. This is enabled and disabled with the Receive Transparent button, in the Material context Shadow panel. The shadow's brightness is dependent on the Alpha value of the shadow casting material. Alternatives to transparent ray-traced shadows can be found in the World context, namely the Ambient Occlusion, Environment Lighting, and Gather panels. Alternatively, a texture can be used to control the Intensity value of the shadow-receiving material.
Alcohol
1.329
Emerald Catseye 1.605 Emerald, Synth flux Emerald, Synth hydro Enstatite Epidote Ethanol Ethyl Alcohol Euclase F Fabulite Feldspar, Adventurine Feldspar, Albite Feldspar, Amazonite 2.409 1.532 1.525 1.525 1.565 1.525 1.539 1.434 1.47 G Garnet, Andradite Garnet, Demantoid Garnet, Demantoid 1.88 1.94 1.880 1.9 1.880 1.561 1.568 1.663 1.733 1.36 1.36 1.652
Jet
1.660
Scapolite, Yellow 1.555 Scheelite Selenium, Amorphous Serpentine Shampoo Shell Silicon Sillimanite Silver Sinhalite Smaragdite Smithsonite Sodalite 1.920 2.92 1.560 1.362 1.530 4.24 1.658 0.18 1.699 1.608 1.621 1.483 1.79 1.81 2.368 1.885 1.712 1.717 1.712 1.747 1.708 1.735 1.650 1.76 1.773 1.739 1.539 2.50
Alcohol, Ethyl 1.36 (grain) Alexandrite Alexandrite Almandine Aluminum Amber Amblygonite Amethyst Ammolite Anatase Andalusite Anhydrite Apatite Apophyllite Aquamarine Aragonite Argon Asphalt Axinite Axinite Azurite B Barite Barytocalcite Beer Benitoite Benzene Beryl Beryl, Red Beryllonite Brazilianite Bromine (liq) Bronze Brownite C Calcite Calspar Cancrinite Carbon 1.486 1.486 1.491 1.636 1.684 1.345 1.757 1.501 1.57 1.60 1.570 1.598 1.553 1.603 1.661 1.18 1.567 1.745 1.750 1.83 1.44 1.545 1.611 1.540 1.600 2.490 1.640 1.571 1.632 1.536 1.575 1.530 1.635 1.674 1.704 1.675 1.730
K Kornerupine 1.665 Kunzite Kyanite L Labradorite Lapis Gem Lapis Lazuli Lazulite Lead Leucite M Magnesite Malachite Meerschaum Mercury (liq) Methanol Milk Moldavite Moonstone Moonstone, Adularia Moonstone, Albite Morganite N Natrolite Nephrite 1.480 1.600 1.515 1.655 1.530 1.62 1.329 1.35 1.500 1.518 1.526 1.525 1.535 1.585 1.594 1.560 1.572 1.500 1.50 1.55 1.615 2.01 1.509 1.660 1.676 1.715
Sodium Chloride 1.544 Spessartite Sphalerite Sphene Spinel Spinel, Blue Spinel, Red Spodumene Star Ruby Staurolite Steatite Steel
Garnet, Grossular 1.738 Garnet, Hessonite 1.745 Garnet, Mandarin Garnet, Pyrope Garnet, Rhodolite 1.790 1.8 1.73 1.76 1.740 1.770
Stichtite 1.520 Strontium Titanate 2.410 1.595 1.38 1.49 1.960 1.730 1.720 2.240 1.690T Taaffeite Tantalite Tanzanite
Styrofoam Nitrogen (gas) 1.000297 Sugar Solution Nitrogen (liq) 1.2053 30% Nylon 1.53 Sugar Solution O Obsidian Oil of Wintergreen Oil, Clove Oil, Lemon Oil, Neroli 1.489 1.536 1.535 1.481 1.482 80% Sulphur Synthetic Spinel
Dioxide (gas) Carbon Disulfide Carbon Tetrachloride Carbonated Beverages Cassiterite Celestite Cerussite Ceylonite Chalcedony Chalk Chalybite Chlorine (liq) Chrome Red Chrome Tourmaline Chromium Chrysoberyl Chrysoberyl, Cat's eye Chrysocolla Chrysoprase Citrine Citrine Clinohumite Clinozoisite Cobalt Blue Cobalt Green Cobalt Violet Colemanite Copper Coral Coral Cordierite
1.000449 Garnet, Uvarovite 1.74 1.87 Gaylussite 1.517 1.628 Glass 1.460 1.34 1.356 1.997 1.622 1.804 1.770 1.544 1.553 1.510 1.630 1.385 2.42 1.61 1.64 2.97 1.745 1.746 1.755 1.500 1.534 1.532 1.554 1.550 1.625 1.675 1.724 1.74 1.97 1.71 1.586 1.10 Ice Idocrase Iodine Crystal 1.486 1.486 1.658 1.540 1.713 3.34 1.522 Glass, Albite Glass, Crown Glass, Crown, Zinc Glass, Flint, Heaviest Glass, Flint, Heavy Glass, Flint, Lanthanum Glass, Flint, Medium Glycerine Gold H Hambergite Hauyne Hauynite Helium Hematite Hemimorphite Hiddenite Honey, 13% water content Honey, 17% water content Honey, 21% water content Howlite Hydrogen (gas) Hydrogen (liq) Hypersthene I 1.309 1.559 1.490 1.505 1.502 1.51714 1.4890 1.520 1.517
Oil, Orange 1.473 Oil, Safflower 1.466 Oil, vegetable 1.47 (50 C) Olivine Onyx Opal, Black Opal, Fire Opal, White 1.670 1.486 1.440 1.460 1.430 1.460 1.440 1.460 1.560 1.572
Teflon Thomsonite Tiger eye Topaz Topaz, Blue Topaz, Imperial Topaz, Pink Topaz, White Topaz, Yellow Tourmaline
1.7 1.35 1.530 1.544 1.607 1.627 1.610 1.605 1.640 1.620 1.630 1.620 1.603 1.655
Oregon Sunstone
Oxygen (gas) 1.000276 Tourmaline 1.624 Oxygen (liq) 1.221 1.61 Tourmaline, Blue P 1.64 1.760 Tourmaline, 1.61 Padparadja 1.773 Catseye 1.64 Painite Pearl Periclase Peridot Peristerite 1.787 1.530 1.740 1.635 1.690 1.525 1.502 1.650 2.117 1.460 1.50 1.55 1.540 1.540 1.610 2.790 1.840 1.810 1.740 Q Quartz 1.544 1.553 Wardite Variscite Water (0 C) Water (100 C) Water (20 C) Water (gas) Water (35 C, room temp) Whisky Willemite Witherite 1.690 Ulexite Uvarovite V-W 1.590 1.550 Tourmaline, Green Tourmaline, Paraiba Tourmaline, Red Tremolite Tugtupite Turpentine Turquoise U 1.490 1.870 1.61 1.64 1.61 1.65 1.61 1.64 1.600 1.496 1.472 1.610
1.000036 Petalite 2.940 Phenakite 1.614 1.655 1.504 1.494 1.484 1.586 1.000140 1.0974 1.670 Phosgenite Plastic Plexiglas Polystyrene Prase Prasiolite Prehnite Proustite Purpurite Pyrite Pyrope
Corundum 1.766 Cranberry Juice 1.351 (25%) Crocoite Crystal Cuprite D Danburite Danburite Diamond Diopside Dolomite Dumortierite 1.627 1.641 1.633 2.417 1.680 1.503 1.686 2.310 2.000 2.850
Rhodochrisite 1.600 Rhodonite Rock Salt Rubber, Natural Ruby Rum, White Rutile 1.735 1.544 1.5191 1.757 1.779 1.361 2.62
Vivianite Vodka Wulfenite Z Zincite Zircon Zircon, High Zircon, Low Zirconia, Cubic
1.580 1.363 2.300 2.010 1.777 1.987 1.960 1.800 2.173 2.21