Aversis Vray for 3D Studio Max Tutorials
 

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

Rendering a glass filled with liquid

Page 1 - Page 2
Before you start

This tutorial assumes you already completed the other Vray tutorials before this one in the list. Also make sure you have basic 3DS Max skills, since Vray is a 3D Studio Max plugin, it relies on Max's functions a lot too.

You will learn the best way to model a glass with liquid inside, so that Vray renders it correctly. If you're having difficulty to understand some of the concepts used here, make sure you already completed the studio lighting setup tutorial.
 
1. Continue with the end result of the studio lighting tutorial

Delete or hide the 3 spheres, we don't need them anymore.

Set the render properties like this:

- output size to 400*480px
- global switches: turn off default lights
- image sampler to adaptive QMC
- antialising 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 50*50 px
     - frame stamp: delete all except rendertime part.

The Vray lights should have the 'store with IR map' option 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 postion like I did, set the lens length to 85mm.

Your scene should have both system and display units set to metric mm.
Vray tutorial - Rendering a glass filled with liquid
2. Import my glass model

Glass is a material that everyone tries to render while learning or testing a new renderer. Vray 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)
Vray tutorial - Rendering a glass filled with liquid
3. Move it up a little bit

Any renderer will always have problems with overlapping faces. Especially with transparent materials this can cause visible problems. The glass bottom faces lie exactly on the faces of the groundplane, they are in the exact same location. Although it will not be very visible here, it's a good rule to remember, avoid coincident faces! Moving the glass up by 0.2 mm is already more than enough.
Vray tutorial - Rendering a glass filled with liquid
4. Create the basic glass material

Create a new Vray material. We will first make clear high reflective 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.

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.
Vray tutorial - Rendering a glass filled with liquid

Vray tutorial - Rendering a glass filled with liquid
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.
Vray tutorial - Rendering a glass filled with liquid

Vray tutorial - Rendering a glass filled with liquid
6. Reflection/refraction depth

These options control the number of times a ray can reflect/refract before it is removed from further calculations. Lower numbers will cause faster rendertimes, 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 ok, don't go too high because rendertimes will increase a lot!
Vray tutorial - Rendering a glass filled with liquid
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:
Vray tutorial - Rendering a glass filled with 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 modeled.
Vray tutorial - Rendering a glass filled with liquid
9. Import the water

Download the water model here and import it in max (turn off 'convert units'). The water should be positioned perfectly into the glass.

Create a new Vraymaterial, name it water and give it a pure white diffuse color.

Render the scene.
Vray tutorial - Rendering a glass filled with liquid
10. Water material

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.
Vray tutorial - Rendering a glass filled with liquid
11. Render again

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

As you can see, it's pretty easy to get a decent result for glass/water in Vray. 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 Vray forum, so I hope this tutorial will clear things up a bit :-)
Vray tutorial - Rendering a glass filled with liquid
Page 1 - Page 2
Back to Vray tutorials page