Vray Tutorials |
|
|
Please don't translate or copy these tutorials elsewhere. I don't like the tutorials to float around in 10 different versions and places on the net. Feel free to link to this page of course! (see also Terms of Use)
This is a free tutorial!
Please click on the Paypal donate button if you want to support this site and help me creating new tutorials.
|
|
|
| Back to Vray tutorials page |
Vray Basic material settings |
| Page 1 - Page 2 - Page 3 |
Before you start
If you discovered this Vray tutorial page through a direct link or search engine, please note that you're on page 2 of the tutorial! Please complete page 1 first if you haven't done so.
This second page is all about refraction!
|
|
1. Start a new scene
Open 3d studio max and start a new scene.
Open the render settings dialog and do the following:
- set Vray as the renderer
- output size to 480*360px
- global switches: turn off default lights
- image sampler to adaptive QMC
- antialising filter "mitchell-netravali"
- indirect illumination ON
- Secondary bounces multiplier to 0,85
- Irradiance map settings:
- "low" preset
- hsph subdivs = 20
- environment:
- skylight pure white color
- reflection/refraction pure black, 1.0 multiplier
- system:
- render region division 50*50 px
- frame stamp: delete all except the rendertime part |
|
2. Create the testscene
I suggest using the same kind of object as I did. A max
teapot is not good now because the mesh has holes in it, it's not 'watertight'
and you don't want that on refractive objects. I made this modified torus knot
because it will be an interesting shape to test with, because of all the curves
and thin/thick areas.
If you want, use the exact same settings as I did
(click image on the right to see all settings).
|
 |
3. Create materials
Make a medium dark blue Vraymaterial for the
groundplane, and a very light grey Vraymaterial for the torus knot and assign
them to the corresponding objects.
Hit render, you should get something
like my example on the right. |
 |
4. Refraction parameters
Go to the white material and take a look at the
refraction parameters. Refraction refers too light rays getting bent when going
from one medium to another. For example light travels through air, then hits a
glass object and the ray gets bent under a certain angle. Then this ray will
travel further through the glass, and eventually will leave it at a certain
point, getting bent again.
How much a ray gets bent depends on the IOR
(index of refraction) of the material. A high IOR means a lot of bending,
IOR=1.0 means the rays will not bend.
The Vray material has all options
available to create any kind of refractive material. As you can see, many
options are similar to the reflection parameters.
First, change the
refract color to a medium grey color. |
 |
5. Refraction color
Render the image. You will notice the object has a
transparent look. The grey refraction color means it's about 50%
transparent. |
 |
6. Diffuse color
Change the diffuse to black and render again. The result
is pretty straightforward. |
 |
7. Refraction color
Change the refraction color to pure white and render.
The result looks weird...
Because now the object is 100% transparent, the
diffuse color has no effect at all anymore. The black regions are rays that get
refracted to the environment color, which is black. |
 |
8. Adjust reflections
The previous step looks weird, because usually materials
with such refractive properties are also reflective. If you set the reflection
to pure white, and check fresnel reflections, the material looks a lot better.
The material you created now is the basic setup for clear glass in Vray. |
 |
9. Create an environment
The rendering looks very boring, because the only thing
to refract/reflect is the groundplane and the black environment color.
Create a large, thin box and position it more or less like I did. |
 |
10. VrayLightMtl
The goal is to turn this box into a light source. An
easy way to do this, is by using the special VrayLightMaterial. Click the get
material button and choose VrayLightMtl from the list. Assign the material to
the box and set the multiplier to 8.0 |
 |
11. Adjust skylight
Hit render. It's way too bright, because our skylight is
still active. Set the skylight multiplier to 0.0 and render again. If it's too
bright or too dark, you need to play with the Vraylightmaterial multiplier until
it looks ok.
You can clearly see tha the light is coming from our big
box now, and the light source also reflects in the torus knot. The contrast
between very bright light and black environment is very good for rendering glass
or metal like objects. |
  |
12. Refractive GI caustics
The light coming from the box is not direct light as
with a max spotlight. It is actually treated as first bounce GI (just like the
Vray skylight). If you would turn off GI and render, there will be no light at
all.
Because of this, it is important that you leave the refractive GI
caustics in the indirect illumination rollout ON. Try rendering this scene
without refractive GI caustics.
You'll see the shadows are much darker.
The GI light is now unable to pass trough the transparent object (there are no
GI caustics). Caustics are noting more than refracted/reflected light.
To continue, turn refractive GI caustics On again. Also go to the
irradiance map rollout and set the preset to custom. Change the min/max rate to
-4/-2 to speed up rendering. Note that the GI will be more blurred now, but
since we're only testing, it doesn't matter.
There will be more on
caustics later on in the tutorial. For now remember that you need to enable the
GI caustics if you want GI to pass trough transparent objects. |
  |
13. Max depth
Increase the max depth parameter in the glass material
to 10, both for reflections and refractions. You'll notice a bit more variation
in reflection/refraction. In some cases increasing the max depth really helps to
make your glass more realistic. It doesn't matter much here because our
environment is also black, just like the exit color when max depth is reached.
In colored environments the max depth effect will be more noticable.
To
continue, reset the max depth to 5. |
 |
14. Options: reflect on backside
Go to the options rollout of the glass material, and
turn on the 'reflect on backside' option. This will allow the inside of the
surface to also reflect the environment. When rendering glass, you should leave
this option turned on, it generates very nice and realistic inner reflections.
This also increases rendertime of course...
To continue the tutorial,
turn it OFF again. |
  |
15. Glossiness
The
glossiness parameter is similar to the one for reflections. It's use is to blur
the refractions. This is one of the most time consuming settings, rendertimes
will go really high if you use high subdivs...
Try a value of 0.8 with 8
subdivs. You'll see that the blurry refractions are very noisy due to the low
subdivs. But you get the idea.
Turn the glossiness back to 1.0 |
  |
16. Index Of Refraction
Set the IOR to 1.0 and render. The torus is gone! This
is because no rays get bent with this IOR value. Because fresnell IOR is linked
to the refraction IOR, this is also set to 1.0, which means the object becomes
non reflective too. The refraction color is pure white, so the rays don't become
tinted either! All this makes the torus dissappear. |
 |
17. IOR
Unlink the
fresnel IOR, so that its value is set to 1.6 again. Hit render.
The thing
you see now is purely created by reflections. |
 |
18. IOR
Set the
refraction IOR to 1.1 and render again.
Each material has its own IOR
value. Typical glass values are around 1.6. Do a google search for other common
used material IOR's.
Render a few tests with different IOR
values.
Reset the IOR to 1.6 to continue. |
 |
19. Exit color
Like with reflection, there's also an exit color for
refractions. After a ray has refracted the max depth number of times, this exit
color will come in to play. tick the checkbox and give it a flashy green color.
Hit render. You can clearly see what parts of the image go over the max depth
number (5).
Make the exit color black again. |
 |
20. Fog color
The
fog color is used to tint the refractions with a certain color. Thicker areas
will become darker (more colored) than thinner areas. Try a light red color for
fog and render.
The material is very dark, but the thinner parts show
some transparancy.
The fog color and fog multiplier are actually an
absortion control. The light looses its energy while traveling through the
material. The longer it travels, the more energy will be absorbed by the object.
That's why thinner parts will remain lighter than the thicker parts. |
  |
21. Fog multiplier
Change the fog multiplier to 0.05 and render again. The
fog effect is much weaker now, letting more light pass through, resulting in a
lighter material.
You should experiment with different fog
color/multiplier ratios. For example a light but very saturated color with high
multiplier, or a dark unsaturated color with a very low multiplier. You can get
very different effects by playing with this relationship. |
 |
22. Refraction color
You probably think, what's the use of the refraction
color then??
Well, set fog options back to default, and choose a red
refract color. Hit render.
The glass is coloured too, but without the
absorbtion effect. Thin and thik areas are equally coloured (the dark areas are
refractions of the black environment!).
I usually use pure white for
refract color and play only with the fog options. But experiment with different
refract color/fog settings to see what they do. Remember, dark refract color
means less transparency. The saturation of the color has a huge impact on the
look of the refraction. A very dark saturated color will look very similar to a
very dark unsaturated color in the color swatch, but it will be completely
different when used for refract color or fog color. Just try it! |
  |
23. IOR=1.0 mixed with fog
Adjust refraction settings to the ones on the right. By
mixing an IOR of 1.0 with fog color, you get a waxy kind of material. |
  |
24. Glossiness + IOR=1.0 + fog
Adjust the glossiness to 0.75 and the subdivs to 16 and
render again. The material looks a bit like reflective wax.
Turn
glossiness to 1.0 again and IOR to 1.6 before continuing. |
  |
25. Affect shadows
An important option we didn't touch yet, it the affect
shadows checkbox. It will have no effect in our test scene because there is no
direct light, only GI light. The affect shadows options is only used with direct
light rays.
Therefore, we will replace the light box with a Vray
Arealight. Go to the create panel and choose lights, and from the dropdown menu
choose Vray. |
 |
25. Vraylight
Click and drag in a viewport to create the Vray rectangular light. Make the size the same as our box, and position it in the same way. After that, hide the box. Set the Vraylight settings as in the image on the right (click to enlarge). The multiplier should be equal to the multiplier of the Vraylightmaterial you used on the lightbox.
We now created a lightsource exactly the same as the lightbox, but it will cast raytraced area shadows. |
 |
26. Affect shadows
In the glass material, turn ON affect shadows and hit
render.
The image should look like mine. As you can see, it casts green
shadows. This is because the affect shadows option and fog color is used.
Rendertime increases because the shadows are raytraced. |
 |
27. Affect shadows OFF
Turn affect shadows OFF and render again. Notice the
shadows are different now. This is because the GI caustics come back into play.
This image is the physically correct one! When you have the affect shadow option
turned ON, no refractive GI caustics are computed for that material, they are
automatically turned off by Vray. The affect shadow option is nothing more than
a 'fake caustics' option. So imagine that when using the affect shadow option,
refractive caustics would not be turned off automatically, you would get a fake
caustic effect AND a real GI caustic effect on top of each other! That's why
Vray automatically turns off GI caustics for materials that have the affect
shadow option turned on. THIS IS VERY IMPORTANT TO
UNDERSTAND!
Use the affect shadows option when you want light to pass
trough refractive objects, and you don't want to enable refractive GI caustics,
or when you don't use GI at all, or when you're using Max lights. Max lights
will never produce refractive GI caustics! So if you want the light of max
lights to pass trough refractive objects, you MUST use the affect shadow
option.
The second image on the right is rendered with an omni light as
the only lightsource, and the affect shadows option is turned off. Notice the
black shadows, no light passes through the material.
The third image has
affect shadows turned on. There is a fake caustic effect but it's nowhere near
physically correct.
Note that the Vray light is a special light. Although
it casts direct light just like max lights do, they do produce GI caustics (max
lights don't!). Normally only first bounce GI light (like the light coming from
skylight and object lights like our lightbox) produces GI caustics.
If
you want real caustics when using max lights, you need to enable caustics in the
caustics rollout (=photon mapped caustics). Don't do this right now, these
caustics controls need a tutorial of their own... Just remember that you can get
nice caustics effects by using GI and Vraylights much easier.
That is why
I prefer using the lightbox or Vraylight over the max lights. You simply check
the GI caustics option and you don't have to care about other caustic settings
all over the place! Drawback is that you need to have good GI settings for the
caustics to be sharp, resulting in longer rendertimes. Another advantage of
Vraylights or objectlights is that they reflect/refract in your objects. Max
lights are invisible to camera and reflection/refraction.
So to
summarize:
1. If you use only object lights and Vraylights and you want
caustics:
- enable GI caustics
- use good quality GI settings to
make sure the caustics look sharp.
2. If you
use max lights and you want the light to pass through refractive
materials:
- use the affect shadow option for a fake caustic
effect
- OR enable caustics in the caustics rollout and play with the
settings for photon
mapped caustics.
3. If you use Vraylights
and you want photon mapped caustics:
- Disable affect shadows
-
Disable GI caustics
- Enable caustics in the caustics rollout and play
with the settings. |
   |
28. Final material
Use the material settings as in the image on the right.
I lowered the fog multiplier a bit, and upped the max depth values both to
8. |
 |
29. Final image setup
In the irradiance map settings, change everything as in
the image on the right. Also go to the QMC sampler rollout and change noise
threshold to 0.001 for maximum quality. |
 |
30. Final image
Render the image, it should look something like
mine.
Notice the nice caustics and area shadows, controlled by the IR map
settings. No caustics were enabled in hard to find places, no time consuming
raytraced shadows were needed. |
 |
31. Comparison with QMC GI
As a test, I rendered the image with QMC GI instead of
irradiance map for first bounce. QMC GI is not an approximate method like IR map
with its undersampling algorithm. QMC GI calculates the GI without compromise,
every light sample gets equal attention. So it's a good test to compare how well
the GI with IR map is computed.
As you can see, in the areas with much
lighting detail, the QMC GI image looks better (=more physically correct) than
the IR map one. But it takes 10 minutes compared to 1m24s for the IR map
version... If you want more detailed GI with IR map, you need to edit some of
the IR map settings. |
 |
32. Better IR map settings
This last image is rendered with optimized IR map
settings. As you can see, this comes very close to the QMC GI example, but
without any noise on the floor. I will explain how to optimize the IR map
settings in an upcoming tutorial. |
 |
| Page 1 - Page 2 - Page 3 |
| Back to Vray tutorials page |