1. Design & Illustration
  2. Graphic Design
  3. 3D Design

Create Realistic Glass and Caustics in Maya: Part 2

Scroll to top
9 min read

Achieving a realistic render can be a challenging task, especially when re-creating a real-world object or scene. In this two-part tutorial, you learn how to build and render a realistic glass of water, complete with accurate caustics in Maya.


1. Enabling Mentalray

Step 1

To start, we need to activate Mental Ray. Go to Window > Settings/Preferences > Plug-in Manager.

Maya_Realistic_Glass_PT2_1Maya_Realistic_Glass_PT2_1Maya_Realistic_Glass_PT2_1

Step 2

The Plug-in Manager window will open, look for the Mayatomr.mll plug-in and make sure to activate it. Then you can close the window.

Maya_Realistic_Glass_PT2_2Maya_Realistic_Glass_PT2_2Maya_Realistic_Glass_PT2_2

2. Creating the Glass Shader

Step 1

Now we'll start creating the shaders, go to Window > Rendering Editors > Hypershade.

Maya_Realistic_Glass_PT2_3Maya_Realistic_Glass_PT2_3Maya_Realistic_Glass_PT2_3

Step 2

You should see the Hypershade window.

Maya_Realistic_Glass_PT2_4Maya_Realistic_Glass_PT2_4Maya_Realistic_Glass_PT2_4

Step 3

Under the Mental Ray materials, search for mia_material_x and click on it to create a new material.

Maya_Realistic_Glass_PT2_5Maya_Realistic_Glass_PT2_5Maya_Realistic_Glass_PT2_5

Step 4

You'll see the shader created in the Work Area. Now we have to adjust its settings.

Maya_Realistic_Glass_PT2_6Maya_Realistic_Glass_PT2_6Maya_Realistic_Glass_PT2_6

Step 5

Open its Attribute Editor and rename the material to something meaningful and related to the glass.

Maya_Realistic_Glass_PT2_7Maya_Realistic_Glass_PT2_7Maya_Realistic_Glass_PT2_7

Step 6

Mental ray already has a great preset we can use. Click on the Presets button and choose GlassSolid > Replace.

Maya_Realistic_Glass_PT2_8Maya_Realistic_Glass_PT2_8Maya_Realistic_Glass_PT2_8

Step 7

The settings will automatically change, but we still need to make some adjustments to the shader.

Maya_Realistic_Glass_PT2_9Maya_Realistic_Glass_PT2_9Maya_Realistic_Glass_PT2_9

Step 8

Change the Diffuse Color to White.

Maya_Realistic_Glass_PT2_10Maya_Realistic_Glass_PT2_10Maya_Realistic_Glass_PT2_10

3. Creating the Glass Textures

Step 1

We'll also need to create a texture, I'll show how I created the texture using Photoshop. It has to be a black texture with alpha zones where you would like the glass to become less transparent. It can be very random.

Maya_Realistic_Glass_PT2_11Maya_Realistic_Glass_PT2_11Maya_Realistic_Glass_PT2_11

Step 2

I created a 3800x3800 pixels image.

Maya_Realistic_Glass_PT2_12Maya_Realistic_Glass_PT2_12Maya_Realistic_Glass_PT2_12

Step 3

Then filled the layer with black.

Maya_Realistic_Glass_PT2_13Maya_Realistic_Glass_PT2_13Maya_Realistic_Glass_PT2_13

Step 4

Select the Eraser tool

Maya_Realistic_Glass_PT2_14Maya_Realistic_Glass_PT2_14Maya_Realistic_Glass_PT2_14

Step 5

You can use several different Brush Presets.

Maya_Realistic_Glass_PT2_15Maya_Realistic_Glass_PT2_15Maya_Realistic_Glass_PT2_15

Step 6

Just Erase some parts of the black layer, following horizontal lines to simulate how an old glass looks.

Maya_Realistic_Glass_PT2_16Maya_Realistic_Glass_PT2_16Maya_Realistic_Glass_PT2_16

Step 7

Back in Maya, click on the Texture button next to the Reflectivity option. This will open the Create Render Node window, where you can select File from the list.

Maya_Realistic_Glass_PT2_17Maya_Realistic_Glass_PT2_17Maya_Realistic_Glass_PT2_17

Step 8

Now select the image or texture you are going to use.

Maya_Realistic_Glass_PT2_18Maya_Realistic_Glass_PT2_18Maya_Realistic_Glass_PT2_18

Step 9

Go back to the Attributes Editor of the shader, we'll also add a texture to the Glossiness attribute.

Maya_Realistic_Glass_PT2_19Maya_Realistic_Glass_PT2_19Maya_Realistic_Glass_PT2_19

Step 10

This is the texture I created for the glossiness. It's a white background with some grey lines, marks and scratches.

Maya_Realistic_Glass_PT2_20Maya_Realistic_Glass_PT2_20Maya_Realistic_Glass_PT2_20

Step 11

Finally, we also need to add this texture to the Color attribute, under the Refraction settings.

Maya_Realistic_Glass_PT2_21Maya_Realistic_Glass_PT2_21Maya_Realistic_Glass_PT2_21

Step 12

You should have added three textures to the shader at this point.

Maya_Realistic_Glass_PT2_22Maya_Realistic_Glass_PT2_22Maya_Realistic_Glass_PT2_22

Step 13

This is how the final shader for the glass should look. You can play with the settings to see what works best for you, and try different textures to help you achieve the effect you want.

Maya_Realistic_Glass_PT2_23Maya_Realistic_Glass_PT2_23Maya_Realistic_Glass_PT2_23

Step 14

Now we have to apply the shader to the glass. Select the Glass object and Right Click to open the menu, go to Assign Existing Material and select the shader we just created.

Maya_Realistic_Glass_PT2_24Maya_Realistic_Glass_PT2_24Maya_Realistic_Glass_PT2_24

Step 15

The glass will now have the shader applied.

Maya_Realistic_Glass_PT2_25Maya_Realistic_Glass_PT2_25Maya_Realistic_Glass_PT2_25

4. Creating the Water Shader

Step 1

We have to create another shader, so go to Window > Rendering Editors > Hypershade.

Maya_Realistic_Glass_PT2_26Maya_Realistic_Glass_PT2_26Maya_Realistic_Glass_PT2_26

Step 2

Inside the Hypershade window, create a new mia_material_x.

Maya_Realistic_Glass_PT2_27Maya_Realistic_Glass_PT2_27Maya_Realistic_Glass_PT2_27

Step 3

The new shader will again appear in the Work Area.

Maya_Realistic_Glass_PT2_28Maya_Realistic_Glass_PT2_28Maya_Realistic_Glass_PT2_28

Step 4

Open its Attribute Editor and change its name, this material will be used for the water inside the glass.

Maya_Realistic_Glass_PT2_29Maya_Realistic_Glass_PT2_29Maya_Realistic_Glass_PT2_29

Step 5

We cannot use a preset for this material, so we have to change the attributes as follows. Under the Diffuse Rollout, change Color to White, Weight to 0.700. Under the Reflection rollout, change the Reflectivity to 1. And under the Refraction rollout, change the Index of Refraction to 1.5, and Transparency to 1.

Maya_Realistic_Glass_PT2_30Maya_Realistic_Glass_PT2_30Maya_Realistic_Glass_PT2_30

Step 6

For this shader, we'll also need a texture. I created a white background with some marks and scratches in a very soft grey. This will make the water look dirtier.

Maya_Realistic_Glass_PT2_31Maya_Realistic_Glass_PT2_31Maya_Realistic_Glass_PT2_31

Step 7

Click on the Texture button for the Color attribute, under the Refraction rollout.

Maya_Realistic_Glass_PT2_32Maya_Realistic_Glass_PT2_32Maya_Realistic_Glass_PT2_32

Step 8

This will open the Create Render Node window, where you need to select File.

Maya_Realistic_Glass_PT2_33Maya_Realistic_Glass_PT2_33Maya_Realistic_Glass_PT2_33

Step 9

Find the texture or image you created for the water.

Maya_Realistic_Glass_PT2_34Maya_Realistic_Glass_PT2_34Maya_Realistic_Glass_PT2_34

Step 10

The texture should be added to the Color Attribute.

Maya_Realistic_Glass_PT2_35Maya_Realistic_Glass_PT2_35Maya_Realistic_Glass_PT2_35

Step 11

Now we need to assign the material to the water. Select the water object and Right Click to open the menu, go to Assign Existing Material and select the material for the water we just created.

Maya_Realistic_Glass_PT2_36Maya_Realistic_Glass_PT2_36Maya_Realistic_Glass_PT2_36

5. Adding the Environment Texture

Step 1

Now we'll create a new material for the Ambient Sphere. We'll create this shader with another method, rather than using Hypershade. Select the Sphere and Right Click to open the menu, go to Assign New Material.

Maya_Realistic_Glass_PT2_37Maya_Realistic_Glass_PT2_37Maya_Realistic_Glass_PT2_37

Step 2

A new window will open, click on the Surface Shader button.

Maya_Realistic_Glass_PT2_38Maya_Realistic_Glass_PT2_38Maya_Realistic_Glass_PT2_38

Step 3

This shader should be assigned to the Sphere.

Maya_Realistic_Glass_PT2_39Maya_Realistic_Glass_PT2_39Maya_Realistic_Glass_PT2_39

Step 4

Go to the Attribute Editor of the material we just created and change its name.

Maya_Realistic_Glass_PT2_40Maya_Realistic_Glass_PT2_40Maya_Realistic_Glass_PT2_40

Step 5

Now click on the Texture button of the Out Color attribute.

Maya_Realistic_Glass_PT2_41Maya_Realistic_Glass_PT2_41Maya_Realistic_Glass_PT2_41

Step 6

A window should open, you need to click on the File button.

Maya_Realistic_Glass_PT2_42Maya_Realistic_Glass_PT2_42Maya_Realistic_Glass_PT2_42

Step 7

Now we need to select an image that will represent our background and ambient reflections for the scene.

Maya_Realistic_Glass_PT2_43Maya_Realistic_Glass_PT2_43Maya_Realistic_Glass_PT2_43

Step 8

I used this basic photo of a living room. Since we are just creating a still image with depth of field, we don't need to use an HDRI or a high quality image.

Maya_Realistic_Glass_PT2_44Maya_Realistic_Glass_PT2_44Maya_Realistic_Glass_PT2_44

Step 9

The image should be loaded into the Out Color attribute.

Maya_Realistic_Glass_PT2_45Maya_Realistic_Glass_PT2_45Maya_Realistic_Glass_PT2_45

6. Creating the Table Material

Step 1

Now we,ll create a new material for our table. Select the table object and Right Click to open the menu, and click the Assign New Material option.

Maya_Realistic_Glass_PT2_47Maya_Realistic_Glass_PT2_47Maya_Realistic_Glass_PT2_47

Step 2

Inside the window, select the Lambert material from the list.

Maya_Realistic_Glass_PT2_47Maya_Realistic_Glass_PT2_47Maya_Realistic_Glass_PT2_47

Step 3

Go to the Attribute Editor of the new material and change its name.

Maya_Realistic_Glass_PT2_48Maya_Realistic_Glass_PT2_48Maya_Realistic_Glass_PT2_48

Step 4

We also need to add a texture to both the Color and the Bump Mapping attributes.

Maya_Realistic_Glass_PT2_49Maya_Realistic_Glass_PT2_49Maya_Realistic_Glass_PT2_49

Step 5

This is the texture I used for the table. You can use any cloth or fabric texture, it doesn't have to be tillable, as long as it's large enough.

Maya_Realistic_Glass_PT2_50Maya_Realistic_Glass_PT2_50Maya_Realistic_Glass_PT2_50

Step 6

Click on the Texture button of the Color attribute, and select File from the list

Maya_Realistic_Glass_PT2_51Maya_Realistic_Glass_PT2_51Maya_Realistic_Glass_PT2_51

Step 7

Select the texture you are going to use.

Maya_Realistic_Glass_PT2_52Maya_Realistic_Glass_PT2_52Maya_Realistic_Glass_PT2_52

Step 8

Go back to the Attribute Editor of the material, click on the Texture button of the Bump Mapping attribute, and then select File in the window.

Maya_Realistic_Glass_PT2_53Maya_Realistic_Glass_PT2_53Maya_Realistic_Glass_PT2_53

Step 9

Reduce the Bump Depth value, this value will vary depending on the contrast of the texture you are using.

Maya_Realistic_Glass_PT2_54Maya_Realistic_Glass_PT2_54Maya_Realistic_Glass_PT2_54

Step 10

Now click on the button next to the Bump Value attribute.

Maya_Realistic_Glass_PT2_55Maya_Realistic_Glass_PT2_55Maya_Realistic_Glass_PT2_55

Step 11

Select your bump texture, I used the same cloth texture as before, we do not need a dedicated bump image for this texture.

Maya_Realistic_Glass_PT2_56Maya_Realistic_Glass_PT2_56Maya_Realistic_Glass_PT2_56

Step 12

Click on the Textured button in the active view. This will let you see the texture you just applied to the table shader.

Maya_Realistic_Glass_PT2_57Maya_Realistic_Glass_PT2_57Maya_Realistic_Glass_PT2_57

7. Adjusting Render Settings

Step 1

We have created all the materials we need, now we need to change the render settings for the scene. Go to Window > Rendering Editors > Render Settings.

Maya_Realistic_Glass_PT2_58Maya_Realistic_Glass_PT2_58Maya_Realistic_Glass_PT2_58

Step 2

A new window will open. Make sure to activate the Mental Ray rendering engine, by selecting it from the Render Using list.

Maya_Realistic_Glass_PT2_59Maya_Realistic_Glass_PT2_59Maya_Realistic_Glass_PT2_59

Step 3

First, in the Quality tab, we need to adjust the Sampling and change these options: Sampling Mode: Unified Sampling, Quality: 1.00, Max Samples: 400. And in the Sample Options, select the Gauss filter. This setting can vary depending on the quality you want to achieve.

Maya_Realistic_Glass_PT2_60Maya_Realistic_Glass_PT2_60Maya_Realistic_Glass_PT2_60

Step 4

Next go to the Indirect Lighting tab. Activate Final Gathering and change the following settings: Accuracy: 150, Point Density: 0.100. These settings are not going to achieve accurate lighting results, but they help to get a fast and good render.

Maya_Realistic_Glass_PT2_61Maya_Realistic_Glass_PT2_61Maya_Realistic_Glass_PT2_61

Step 5

Now activate Caustics and change its radius to 1.000.

Maya_Realistic_Glass_PT2_62Maya_Realistic_Glass_PT2_62Maya_Realistic_Glass_PT2_62

Step 6

Close the Render Settings window and select the Area Light in the scene. You can either find it in the 3D view, or select it from the Outliner or Hypershade windows.

Maya_Realistic_Glass_PT2_63Maya_Realistic_Glass_PT2_63Maya_Realistic_Glass_PT2_63

Step 7

Open the Attribute Editor of the Area Light. Change its Intensity to 0.800. And under the Raytrace Shadow Attributes section, activate Shadows and increase the Shadow Rays to 15.

Maya_Realistic_Glass_PT2_64Maya_Realistic_Glass_PT2_64Maya_Realistic_Glass_PT2_64

8. Adjusting the Lighting

Step 1

Now select the Spotlight in the scene, that is illuminating from the top.

Maya_Realistic_Glass_PT2_65Maya_Realistic_Glass_PT2_65Maya_Realistic_Glass_PT2_65

Step 2

Open the Attribute Editor of the Spotlight. Change the following settings: Color: whitish yellow, Intensity: 0.350, Cone Angle: 86.000, Penumbra Angle: -9.800, activate Ray Trace Shadows and set Light Radius to 0.350, and Shadow Rays to 30.

Maya_Realistic_Glass_PT2_66Maya_Realistic_Glass_PT2_66Maya_Realistic_Glass_PT2_66

Step 3

Select the other Spotlight from the scene, this Spotlight will generate the Photons for the caustics.

Maya_Realistic_Glass_PT2_67Maya_Realistic_Glass_PT2_67Maya_Realistic_Glass_PT2_67

Step 4

Open the Attribute Editor of the Spotlight. Change the following settings: Color: whitish yellow, Intensity: 0.350, Cone Angle: 46, Penumbra Angle: -9.800. Under the Caustics and Global Illumination section, activate Emit Photons and set Photon Intensity to 20000, Exponent to 2 and Caustic Photons to 500000.

Maya_Realistic_Glass_PT2_68Maya_Realistic_Glass_PT2_68Maya_Realistic_Glass_PT2_68

Step 5

We'll now do our first test render. Click on the Render button.

Maya_Realistic_Glass_PT2_69Maya_Realistic_Glass_PT2_69Maya_Realistic_Glass_PT2_69

Step 6

The image is almost finished.

Maya_Realistic_Glass_PT2_70Maya_Realistic_Glass_PT2_70Maya_Realistic_Glass_PT2_70

Step 7

There is something we can correct. The caustics over the table look too bright.

Maya_Realistic_Glass_PT2_71Maya_Realistic_Glass_PT2_71Maya_Realistic_Glass_PT2_71

Step 8

We need to go to the Attribute Editor of the Spotlight that emits the photons. Under the Caustics and Global Illumination settings, change the Exponent value to 2.200.

Maya_Realistic_Glass_PT2_72Maya_Realistic_Glass_PT2_72Maya_Realistic_Glass_PT2_72

Step 9

Now when we render the scene, we can see an improvement.

Maya_Realistic_Glass_PT2_73Maya_Realistic_Glass_PT2_73Maya_Realistic_Glass_PT2_73

9. Adding Depth of Field

Step 1

We just need to add DOF (Depth of field) to the render. Since it's a pretty simple scene, we don't need to use separate passes. Select the render Camera.

Maya_Realistic_Glass_PT2_74Maya_Realistic_Glass_PT2_74Maya_Realistic_Glass_PT2_74

Step 2

Open the Attribute Editor of the Camera, and under the Depth of Field settings, activate Depth of field and change the Focus Distance and F Stop values to achieve the result you want. This settings will be totally different depending on the size of the elements in your scene, and on the distance and position of your objects and camera.

Maya_Realistic_Glass_PT2_75Maya_Realistic_Glass_PT2_75Maya_Realistic_Glass_PT2_75

Conclusion

Now render the scene.

Maya_Realistic_Glass_PT2_76Maya_Realistic_Glass_PT2_76Maya_Realistic_Glass_PT2_76