From BlenderWiki

Jump to: navigation, search

Raytraced Transparency

Mode: All Modes

Panel: Shading/Material Context → Mirror Transp

Hotkey: F5

Description

Raytracing is also used for simulating the refraction of light rays through a transparent material, like a lens. 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 travel through it to the next object, and so on, until a non-transparent object is finally encountered which gives the whole chain of rays its color. Eventually, the first transparent object inherits the colors of its background, proportionally 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

You need to enable raytracing in your scene settings if you want to use raytraced transparency and refraction. This is done in the Scene/Render context → Render Panel. Raytracing is enabled by default in Blender 2.37 and higher.


Alpha value

You need to set your Alpha value (A in the Material Panel) at something else than 1.000. However, the alpha value will still be reported in the render as 1.0


Options

The Mirror Transp Panel.
RayTransp
Enables and disables raytraced transparency
Filt
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.
IOR
Sets how much a ray crossing the Material's surface will be refracted, hence producing a distorted image of its background. See Examples.
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 raytracing transparent objects). You may also need to turn on transparent shadows on the other object.
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.
Falloff
How fast light is absorbed as is passes through the material. Gives 'depth' and 'thickness' to glass.
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).
Fac
A controlling 'factor' to adjust how the blending (between transparent and non-transparent areas) happens.
SpecTra
This slider controls the Alpha/falloff for Specular colors


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).

(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.

Glass

Realistic Glass is not perfectly transparent, and so light can reflect off of it, it can bend light, and you can even sometimes see shadows cast on the glass, since in reality the non-shadowed surface of the glass is reflecting some light back at you.

Realistic Glass Settings

In the Render panel, enable Raytracing and Shadows. In the example render shown, we have a lamp just off camera to the right, a red-colored ball, an angled piece of glass covering the bottom of the picture, a teal-colored NURBS torus (donut), and a back wall, in Z order. You can see:

  • Refracted wall, the donut, the environment behind the glass
  • Shadows cast onto the glass by the red ball in front of the glass
  • Shadows cast through the glass onto the donut by the red ball
  • Shadow cast by the ball behind the glass into the box
  • Refraction of the shadow of ball and torus coming back through the glass
  • Specular glare on the glass from the lamp

In the Material settings, shown here for slightly blue green glass, enable Traceable and Shadbuff so that Raytraced as well as Shadow Buffer lamps will work with the glass.

In the Material panel, notice that the Alpha is not pure 0.0 In the Shaders panel, Shadow and TraShadow are enabled. The glass is colored by ambient light and emits its color, to simulate light bouncing around inside the glass itself and emerging

In the Mirror/Transp panel, default settings are used except for IOR.

Atmosphere/Cloud Cover

Cloud Cover Settings

In this example, we need a cloud cover for a planet. This is used to texture a UV Sphere that is a larger diameter than the planet inside of it.

The Alpha of the base material is zero, as is any Ambient or Emit values.

Of course, we have to use the Cloud texture, and put it to two uses: to slightly affect the color of the mesh, and to affect the Alpha transparency. While the base material is white, the texture gives it a blue tinge. It receives shadows, so the shadow of the planet will actually darken the dark side of the atmosphere.

Where the texture is black, think 0 color. If you map that 0 to alpha, you get transparent, or see-through. Where the texture is white, think full, 1.0 color. If you map white to alpha, you get full opaqueness. If that 1.0 also maps to some color, like blue, you will get a fully opaque blue color. In the example to the right, that full blue is then mixed down by the Col slider in the texture Map To panel so that it mixes with the base white material and only shades the white a slight hue of blue.

To make the clouds more pronounced, you can map the input to a higher value, and/or multiply (not mix) two texture channels layers together.

Hints

In order to get a physically accurate Fresnel effect with the current algorithm, you have to set Fresnel to 5.0 and Fac to 1.25. Nevertheless, you can play with these values for the sake of artistic freedom, if you feel the need to.

Casting Transparent Shadows

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. This can be taken into account, but not in the Mirror Transp panel transparent object settings.

Transparent shadows are set on the materials that receive the shadows from the transparent object. This is enabled and disabled with the TraShadow button, in the Shading/Material context → Shaders Panel. The shadow's brightness is dependent on the Alpha value of the shadow casting Material.

Casting transparent shadows: TraShado 'off' on the left, TraShado 'on' to the right.

Ray versus Z Transparency

RayTracing Artifact

ZTransp, located in the Material Links panel, causes Blender to use the Z value, or distance from camera, to bleed things through. When using transparent planes with images, ray tracing will let the colors come through the transparent areas, but the Z values will not carry through. Therefore, later on down the rendering pipeline some issues may arise. For example, when OverSampling/Aliasing (OSA) is applied, artifacts may ensue as shown. In this example, raytracing is not providing the correct samples for the portion of the ground plane behind the transparent portions of the alpha-mapped tree image plane. To solve this, use ZTransp for the material, not raytracing.

As another alternative, change the texture interpolation filter size to 0.100 or some number smaller than 1.0. This slider is found in the Texture subcontext (F6 Map Image panel.

Raytracing affects the Color, but does not affect the Alpha channel value that is saved or passed on. Even if the Material is set to Alpha 0, raytracing will treat the material as transparent, but will return an alpha 1 for that channel regardless of the alpha setting inthe material.

ZTransp does affect Alpha channel values in the output. If you are going to be compositing the image later using Alpha over, you probably want to set ZTransp for your material. The disadvantage with ZTransp is that the light can not be bent or refracted.

To set the Alpha value of an object AND use raytracing, set the Pass Index the object (Object and Links panel). Render the image using Ray Transp and the Index pass (Render Layer panel). Then use the Index OB node to mask it out and the Set Alpha node to set the alpha for that portion of the image.


IOR values for Common Materials

The following list provides some Index Of Refraction values to use when RayTraced Transparency is used for various liquids, solids (gems), and gases:

A
Acetone 1.36
Actinolite 1.618
Agalmatoite 1.550
Agate 1.544
Agate 1.540
Air 1.000
Alcohol 1.329
Alcohol, Ethyl (grain) 1.36
Alexandrite 1.745
Alexandrite 1.750
Almandine 1.83
Aluminum 1.44
Amber 1.545
Amblygonite 1.611
Amethyst 1.540
Ammolite 1.600
Anatase 2.490
Andalusite 1.640
Anhydrite 1.571
Apatite 1.632
Apophyllite 1.536
Aquamarine 1.575
Aragonite 1.530
Argon 1.000281
Asphalt 1.635
Axenite 1.674 - 1.704
Axinite 1.675
Azurite 1.730
B
Barite 1.636
Barytocalcite 1.684
Beer 1.345
Benitoite 1.757
Benzene 1.501
Beryl 1.57 - 1.60
Beryl, Red 1.570 - 1.598
Beryllonite 1.553
Brazilianite 1.603
Bromine (liq) 1.661
Bronze 1.18
Brownite 1.567
C
Calcite 1.486
Calspar 1.486
Cancrinite 1.491
Carbon Dioxide (gas) 1.000449
Carbon Disulfide 1.628
Carbon Tetrachloride 1.460
Carbonated Beverages 1.34 - 1.356
Cassiterite 1.997
Celestite 1.622
Cerussite 1.804
Ceylanite 1.770
Chalcedony 1.544 - 1.553
Chalk 1.510
Chalybite 1.630
Chlorine (gas) 1.000768
Chlorine (liq) 1.385
Chrome Green 2.4
Chrome Red 2.42
Chrome Tourmaline, 1.61 - 1.64
Chrome Yellow 2.31
Chromium 2.97
Chrysoberyl 1.745
Chrysocolla 1.500
Chrysoprase 1.534
Citrine 1.532 - 1.554
Citrine 1.550
Clinohumite 1.625 - 1.675
Clinozoisite 1.724
Cobalt Blue 1.74
Cobalt Green 1.97
Cobalt Violet 1.71
Colemanite 1.586
Copper 1.10
Copper Oxide 2.705
Coral 1.486
Coral 1.486 - 1.658
Cordierite 1.540
Corundum 1.766
Cranberry Juice (25%) 1.351
Crocoite 2.310
Crysoberyl, Catseye 1.746 - 1.755
Crystal 2.000
Cuprite 2.850
D
Danburite 1.627 - 1.641
Danburite 1.633
Diamond 2.417
Diopside 1.680
Dolomite 1.503
Dumortierite 1.686
E
Ebonite 1.66
Ekanite 1.600
Elaeolite 1.532
Emerald 1.560 - 1.605
Emerald Catseye 1.560 - 1.605
Emerald, Synth flux 1.561
Emerald, Synth hydro 1.568
Enstatite 1.663
Epidote 1.733
Ethanol 1.36
Ethyl Alcohol 1.36
Euclase 1.652
F
Fabulite 2.409
Feldspar, Adventurine 1.532
Feldspar, Albite 1.525
Feldspar, Amazonite 1.525
Feldspar, Labradorite 1.565
Feldspar, Microcline 1.525
Feldspar, Oligoclase 1.539
Flourite 1.434
Formica 1.47
G
Garnet, Andradite 1.88 - 1.94
Garnet, Demantiod 1.880 - 1.9
Garnet, Demantoid 1.880
Garnet, Grossular 1.738
Garnet, Hessonite 1.745
Garnet, Mandarin 1.790 - 1.8
Garnet, Pyrope 1.73 - 1.76
Garnet, Rhodolite 1.740 - 1.770
Garnet, Rhodolite 1.760
Garnet, Spessartite 1.810
Garnet, Tsavorite 1.739 - 1.744
Garnet, Uvarovite 1.74 - 1.87
Gaylussite 1.517
Glass 1.51714
Glass, Albite 1.4890
Glass, Crown 1.520
Glass, Crown, Zinc 1.517
Glass, Flint, Dense 1.66
Glass, Flint, Heaviest 1.89
Glass, Flint, Heavy 1.65548
Glass, Flint, Lanthanum 1.80
Glass, Flint, Light 1.58038
Glass, Flint, Medium 1.62725
Glycerine 1.473
Gold 0.47
H
Hambergite 1.559
Hauyn 1.490 - 1.505
Hauynite 1.502
Helium 1.000036
Hematite 2.940
Hemimorphite 1.614
Hiddenite 1.655
Honey, 13% water content 1.504
Honey, 17% water content 1.494
Honey, 21% water content 1.484
Howlite 1.586
Hydrogen (gas) 1.000140
Hydrogen (liq) 1.0974
Hypersthene 1.670
I
Ice 1.309
Idocrase 1.713
Iodine Crystal 3.34
Iolite 1.522 - 1.578
Iron 1.51
Ivory 1.540
J
Jade, Jadeite 1.64 - 1.667
Jade, Nephrite 1.600 - 1.641
Jadeite 1.665
Jasper 1.540
Jet 1.660
K
Kornerupine 1.665
Kunzite 1.660 - 1.676
Kyanite 1.715
L
Labradorite 1.560 - 1.572
Lapis Gem 1.500
Lapis Lazuli 1.50 - 1.55
Lazulite 1.615
Lead 2.01
Leucite 1.509
M
Magnesite 1.515
Malachite 1.655
Meerschaum 1.530
Mercury (liq) 1.62
Methanol 1.329
Milk 1.35
Moldavite 1.500
Moonstone 1.518 - 1.526
Moonstone, Adularia 1.525
Moonstone, Albite 1.535
Morganite 1.585 - 1.594
N
Natrolite 1.480
Nephrite 1.600
Nitrogen (gas) 1.000297
Nitrogen (liq) 1.2053
Nylon 1.53
O
Obsidian 1.489
Oil of Wintergreen 1.536
Oil, Clove 1.535
Oil, Lemon 1.481
Oil, Neroli 1.482
Oil, Orange 1.473
Oil, Safflower 1.466
Oil, vegetable (50° C) 1.47
Olivine 1.670
Onyx 1.486
Opal, Black 1.440 - 1.460
Opal, Fire 1.430 - 1.460
Opal, White 1.440 - 1.460
Oregon Sunstone 1.560 - 1.572
Oxygen (gas) 1.000276
Oxygen (liq) 1.221
P
Padparadja 1.760 - 1.773
Painite 1.787
Pearl 1.530
Periclase 1.740
Peridot 1.635 - 1.690
Peristerite 1.525
Petalite 1.502
Phenakite 1.650
Phosgenite 2.117
Plastic 1.460
Plexiglas 1.50
Polystyrene 1.55
Prase 1.540
Prasiolite 1.540
Prehnite 1.610
Proustite 2.790
Purpurite 1.840
Pyrite 1.810
Pyrope 1.740
Q
Quartz 1.544 - 1.553
Quartz, Fused 1.45843
R
Rhodizite 1.690
Rhodochrisite 1.600
Rhodonite 1.735
Rock Salt 1.544
Rubber, Natural 1.5191
Ruby 1.757 - 1.779
Rum, White 1.361
Rutile 2.62
S
Sanidine 1.522
Sapphire 1.757 - 1.779
Sapphire, Star 1.760 - 1.773
Scapolite 1.540
Scapolite, Yellow 1.555
Scheelite 1.920
Selenium, Amorphous 2.92
Serpentine 1.560
Shampoo 1.362
Shell 1.530
Silicon 4.24
Sillimanite 1.658
Silver 0.18
Sinhalite 1.699
Smaragdite 1.608
Smithsonite 1.621
Sodalite 1.483
Sodium Chloride 1.544
Spessarite 1.79 - 1.81
Sphalerite 2.368
Sphene 1.885
Spinel 1.712 - 1.717
Spinel, Blue 1.712 - 1.747
Spinel, Red 1.708 - 1.735
Spodumene 1.650
Star Ruby 1.76 - 1.773
Staurolite 1.739
Steatite 1.539
Steel 2.50
Stichtite 1.520
Strontium Titanate 2.410
Styrofoam 1.595
Sugar Solution 30% 1.38
Sugar Solution 80% 1.49
Sulphur 1.960
Synthetic Spinel 1.730
T
Taaffeite 1.720
Tantalite 2.240
Tanzanite 1.690-1.7
Teflon 1.35
Thomsonite 1.530
Tiger eye 1.544
Topaz 1.607 - 1.627
Topaz, Blue 1.610
Topaz, Imperial 1.605 - 1.640
Topaz, Pink 1.620
Topaz, White 1.630
Topaz, Yellow 1.620
Tourmaline 1.603 - 1.655
Tourmaline 1.624
Tourmaline, Blue 1.61 - 1.64
Tourmaline, Catseye 1.61 - 1.64
Tourmaline, Green 1.61 - 1.64
Tourmaline, Paraiba 1.61 - 1.65
Tourmaline, Red 1.61 - 1.64
Tremolite 1.600
Tugtupite 1.496
Turpentine 1.472
Turquoise 1.610
U
Ulexite 1.490
Uvarovite 1.870
V-W
Wardite 1.590
Variscite 1.550
Water (0° C) 1.33346
Water (100° C) 1.31766
Water (20° C) 1.33283
Water (gas) 1.000261
Water 35'C (Room temp) 1.33157
Whisky 1.356
Willemite 1.690
Witherite 1.532
Vivianite 1.580
Vodka 1.363
Wulfenite 2.300
Z
Zincite 2.010
Zircon 1.777 - 1.987
Zircon, High 1.960
Zircon, Low 1.800
Zirconia, Cubic 2.173 - 2.21