background image

Rendering Glass and 
Liquid

author:

Wouter Wynen

brought to you by:

background image

©2006 VisMasters. All rights reserved. 

VisMasters and the VisMasters logo are trademarks of ArchVision, Inc. 

All other trademarks belong to their respective owners. 

background image

Rendering Glass and Liquid

by:

Wouter Wynen

June 2006

background image
background image

Rendering Glass and Liquid

This tutorial assumes you already completed the other V-Ray 
tutorials before this one in the list. 

You will learn how to model and render a glass filled with 

liquid, in our studio lighting setup (previous tutorial). 

INTRODUCTION

5

background image

Rendering Glass and Liquid

1. Continue with the end result of the studio lighting tutorial 

Delete or hide the 3 spheres, we don’t need them any-
more.

Set the render properties like this:

- output size to 400x480px
- global switches: turn off default lights

- image sampler to adaptive QMC
- antialiasing filter “mitchell-netravali”
- indirect illumination ON

- Secondary bounces: QMC GI and multiplier to 0.8
- refractive GI caustics ON

- Irradiance map settings:
     - custom min/max=-4/-3
     - HSph subdivs = 20 = interp samples

     - clr=nrm=0.4
     - dist=0.1
- environment:

     - skylight pure white color, 0.1 multiplier
     - reflection/refraction pure black, 1.0 multiplier

- QMC sampler: noise threshold = 0.005
- system: 
     - render region division 50x50px

     - frame stamp: delete all except render time part.

The V-Ray lights should have the ‘store with IR map’ op-
tion turned ON to start with.  The left light has a value 
of 3, the right one is set to 5.  Position them like in my 

screenshot.

Also adjust the camera position like I did, set the lens 
length to 85mm.

Your scene should have both system and display units 
set to metric mm.

6

background image

Rendering Glass and Liquid

2. Import my glass model

Glass is a material that everyone tries to render while 
learning or testing a new renderer.  V-Ray is capable of 

rendering very realistic glass in a very short amount of 
time. 

I already explained a lot about creating glass in the basic 
materials tutorial.  A lot of it will be repeated here, but 

this time we will render a real object instead of some 
weird blob like thing. 

Download my glass model here (it’s zipped!).  Use the 

import function to bring it into the scene (turn off 
‘convert units’ in the import options).  The glass should 
be sized like in my screenshot. If not, simply resize it :-) 
(probably your units are set wrong or convert units was 

still on if the glass imports too big/small)

3. Move it up a little bit

Any renderer will always have problems with overlap-

ping faces.  Especially with transparent materials this 
can cause visible problems.  The glass bottom faces lie 
exactly on the faces of the ground plane, they are in 

the exact same location.  Although it will not be very 

visible here, it’s a good rule to remember, avoid coinci-
dent faces!  Moving the glass up by 0.2 mm is already 
more than enough.

7

background image

Rendering Glass and Liquid

Create a new V-Ray material. We will first make clear high reflec-
tive glass.  To do that, first set the diffuse color to pure black. 
Then set refraction color to pure white.  Pure white means 

100% refractive, resulting in the diffuse component having no 
effect at all anymore.

Make reflection color almost pure white and check fresnel 
reflections. 

4. Create the basic glass material

5. Reflect on backside

Notice the dark border on the inside glass surface?  To 

get rid of this, we will turn on the ‘reflect on backside’ 

option in the options rollout of the glass material.

Render again to see the difference.

This option creates internal reflections, an effect that 

happens in real life too.

This is the base of our glass material. It is 
100% clear, very reflective glass. 

Assign to the glass object and render. It 

should look like my example. 

8

background image

Rendering Glass and Liquid

These options control the number of 
times a ray can reflect/refract before it is 
removed from further calculations.  Lower 

numbers will cause faster render times, but 
go too low and parts or the whole object 

will turn black. 

Increase them both to 10 and render again. 

The difference is huge on the foot of the 
glass and in the middle part (because in 

these parts, internal reflections will happen 
a lot, exceeding the max depth quickly). 

Values of 10 are okay, don’t go too high 

because rendertimes will increase a lot!

6. Reflection/refraction depth

7. Adjust the studio setup

Our studio setup is a bit ‘too much’ for this 

scene.  We will adjust it by turning off the left 

light.  To compensate for the light decrease, 
turn the environment skylight multiplier to 
0.4.

Render the scene, it should look more or 
less like my example:

9

background image

Rendering Glass and Liquid

8. Filling a glass with water

To fill a glass with water, you should model 
the water.  This isn’t as easy as it sounds. 
First of all, the surface of the water will 

bend up where it touches the glass because 
of adhesion forces.  We call this curved top 

surface the meniscus.  This effect has to be 
modeled or your water will not look very 
realistic.

Then there’s the problem of coincident 

faces.  If you model the liquid exactly as 
large as the inner surface of the glass, the 

rendering will look weird because of these 
coincident faces (right glass).  The best way 

is to model the water a bit larger than the 
inner glass surface (middle glass).  If you 

model it slightly smaller, it’s not realistic 
either (left glass).

Click on the image to see examples of all 
three.  I modeled the glass in rhino, it’s a 

revolved curve.  I show you these curves 
also to see how the glass vs water is mod-

eled. 

9. Import the water

Download the water model here and im-

port it in max (turn off ‘convert units’). The 
water should be positioned perfectly into 

the glass. 

Create a new V-Ray material, name it water 

and give it a pure white diffuse color.

Render the scene.

10

background image

Rendering Glass and Liquid

Go to your water material and change the settings 
according to the image on the right.  In fact, these 
are the same settings as the clear glass, only the 

IOR is different. 

Also go to the options rollout and turn on reflect 
on backside like we did for the glass material. 

10. Water material

Now we have a nice wineglass filled with water :-)

As you can see, it’s pretty easy to get a decent result for glass/wa-

ter in V-Ray.  Already our first render looked pretty good.  But to 

fine tune it, you need to know some tricks.  Questions regarding 
glass pop up a lot in the V-Ray forum, so I hope this tutorial will 

clear things up a bit :-)

11. Render again

11

background image

Rendering Glass and Liquid

12. Red wine

To give the scene a more interesting look, 

we will copy the glass and put it on the 
floor like as if it was tipped over.

So select the glass model and copy it, ro-
tate it and position it like I did.

Change the output render size to 

430x480px.

13. Expand the scene

Copy the water material and name it ‘red 
wine’.  Change the fog color to a saturated 
red, and turn down the multiplier to 0.05. 

This will tint refractions red.  Apply the 
wine material to the water.  Render to see 

the effect.

Experiment with different colors and multi-

pliers to create other liquids too.

Of course you can do the same thing with 
the glass material, to create a colored glass.

12

background image

Rendering Glass and Liquid

With the rotate tool, roll the camera -8 degrees.  Also move it 
to create a better composition.  Render the scene, it should look 
like this.

15. Smaller V-Ray light

The shadows are very dim because our area light is 

so big.  We will adjust the V-Ray light, make it smaller 
and reposition it.  You can see in the screenshot how 

I placed it. It’s not only smaller but also placed further 

away.

U-size= 250mm and V-size=300
Light multiplier is set to 22. It’s much higher because 

the area of the light is smaller.

Also change the sky multiplier (V-Ray environment 

settings) to 0.15 instead of 0.4.  This way, the environ-
ment lighting will not brighten up the shadow regions 

as much as before.

14. Roll the cameramap

13

background image

Rendering Glass and Liquid

16. Nice caustics

This smaller light will also result in more noticeable 
caustics.

Remember my rambling about GI caustics on page 2 
of the materials settings tutorial?  Well, here we will 

use them again.

First render the scene with the new light settings.  It 

should look like my example. Notice the shadows 
that are much more visible now.  The smaller the light 

source, the sharper the shadows. 

17. No GI caustics

In the GI settings, turn off refractive GI caustics.  You will clearly 
see that shadows get darker.  No light is able to pass trough the 
transparent materials.  

This is just a reminder to show you the effect of GI caustics.

Turn the refractive GI caustics back on.

I usually don’t use reflective GI caustics, because they do more 

bad than good in most cases.  Refractive ones are way more im-
portant as you can see from this example.

14

background image

Rendering Glass and Liquid

18. Sharper caustics

Because the shadow and caustics quality is 
controlled completely by the IR map set-
tings, we will fine tune them. 

Note that shadows are created by the IR 

map because we have ‘store with IR map’ 
in the V-Ray light turned on.  So our V-Ray 

light doesn’t cast direct light but GI light 

for the moment.

Open the Irradiance map rollout and 

make the following changes:
Min/max=-4/-1

HSph subdivs= 35

There will be less undersampling, and 

sample quality is increased because of 
more HSph subdivs.

Turn on ‘show calc fase’ so you can watch 
the progress of the IR map calculation. 

This will speed up the rendering psycho-
logically :-) 

As you can see, the caustics are already 
sharper.

15

background image

Rendering Glass and Liquid

19. High quality GI settings

If you want a better GI solutions to increase caustics 
and shadow quality even more, you have a few options.

First is to increase min/max settings, to for example 
-2/1.  For low resolutions like this, -2/1 is really high 

quality, don’t go higher or you will loose the benefit of 
the undersampling.

You can also increase the HSph subdivs. This will calcu-
late each taken sample better.

The clr threshold is also important, going from 0.4 to 

0.3 will have a huge effect, but also on render times... 
The dist threshold can be useful here too (more sam-

ples where objects are close to each other, important 
for region under the foot of the glass)

So what settings are the best? A bit of everything :-)

The min/max settings have the biggest impact.  For this 
rendering I used the following IR map settings:

- min/max=-3/1
- HSph subdivs= 40

- clr=0.35

- nrm=0.4
- dist=0.25 

The caustics (especially these under the glass that lies 

down, look at the foot area) are much better now. But 

render time increased a lot... Usually you don’t need this 
high settings, because no client will ever see the differ-

ence...

Note that the max setting of +1 is only used as long as 
the resolution stays at 430x480. 

For resolutions from 640 to 800px, use -3/0 as the high-
est settings (-4/-1 for 1280 to 1600 etc...).  I will explain 

the irradiance map behavior in another tutorial. 

16

background image

Rendering Glass and Liquid

20. Store with IR map option

As you can see, we need very high IR map settings to 
make sure shadows and caustics will be calculated ac-

curately. 

As I said before, the shadow quality depends on IR map 
settings because of the ‘store with IR map’ option in the 
V-Ray light, treating the light as GI light instead of direct 

light.

By turning this option off, shadows will be raytraced, 
which results in very high quality. Rendertimes will be 
higher, but since quality now almost completely depend 

on the subdivs of the light, we can use lower IR map 
settings!  So IR map calculation will speed up, and the 

actual rendering pass will slow down, resulting in +- the 
same overall render time, but better shadow detail.

When you use raytraced area shadows, note that the 

GI caustics will still be calculated by the IR map settings 

(the V-Ray light is the only light being able to produce 
direct light AND GI caustics at the same time, making 
it an ideal light for product renderings).  So we can’t go 
too low on these settings or else the caustics will loose 

too much of their quality.

Turn off the ‘store with IR map’ option in the V-Ray light, 
and set the subdivs to 30.

Go to the IR map settings and change min/max to -4/-1, 

and HSph subdivs to 35.

Render the image, look at the process.  Note that dur-

ing IR map calculation, everything looks darker, because 
the V-Ray light doesn’t cast GI light anymore.  This IR 

map pass will go pretty fast, but the actual rendering 
pass will go slow because the direct light (and area shad-
ows) need to be computed now also...

The result is very pleasing.  Caustics are a bit less 

detailed, but this is compensated by the raytraced area 
shadows. 

17

background image

Rendering Glass and Liquid

21. Final image

We will now render the image at a higher 
resolution.

Set the render output to 717x800px.

We want the same GI quality as in the pre-
vious image, but since the IR map settings 
are resolution dependant, we will need to 

make a small change.  We nearly doubled 
the render resolution, so in order to have 

the same GI quality, you only need to 
lower both the min and max setting by 1. 

So set these at -5/-2. The tresholds and HS      
ph subdivs are not resolution dependant so 
leave them at their current values. 

To get rid of the last noise in the shadows 
and anti aliasing, go to the QMC sampler 
rollout and change the noise threshold to 

0.002.

Render the image!

Click the image on the right to see the 

high resolution version.

18

background image

About the author

Wouter Wynen has studied product development for 5 

years at the university in Antwerp, Belgium. During these 
years, his interest in 3D modeling and visualization grew 

more and more. In the end, it even overpowered the 

interest in product design.

After graduation, he founded the company Aversis, offer-
ing 3D viz & webdesign services.

19

background image

share - learn - inspire

©2006 VisMasters. All rights reserved. 

VisMasters and the VisMasters logo are trademarks of ArchVision, Inc. 

All other trademarks belong to their respective owners.