Join George Maestri for an in-depth discussion in this video Rendering transparent materials with caustics, part of Maya 2013 Essential Training: 6 Lights and Rendering.
Let's take a look at one more lighting effect that we can do in mental ray and that's called caustics. Now caustics has basically two things that it can do. It can create an effect of light transmitting through a transparent material, or it can also simulate light reflecting off of highly reflective materials, such as say the water in a swimming pool or a metallic object sitting next to a table. So basically what it does is it creates some very realistic highlights and transmission effects.
So let's take a look at this basic scene here. I've got a martini glass with a little bit of martini and an olive in it, and let's go ahead and just render this frame. So as you can see, we've got a pretty realistic glass going on with this martini glass, some nice refractions, but we really don't have anything connecting the glass to the table. We need a shadow and maybe also some caustics. So let's go ahead and add in some caustics. I'm going to pop out to my quad view here and you can see we've got a light right here which is illuminating the scene, it's called spotLight1, and let's go into the Attribute Editor.
Now it's got a Color, it's got an Intensity, now it does have a quadratic falloff, so it is a fairly realistic looking light, and if we want we can add some shadows. So let's go ahead and add some Raytrace Shadows here under the Raytrace Shadow Attributes, and let's go ahead and highlight our Camera1 Viewport and do a quick render. So when I add in the shadows you can see I'm getting just a faint, faint shadow from the glass as well as from the olive in the martini, but I'm not really getting any of that transmission effect that I will get of a light going through such a glass material.
We can fix that by adding caustics. So I'm going to go ahead and reselect my light and let's go down all the way to Caustic and Global Illumination. Now you might be familiar with this, we used it in the last lesson, and basically for this light we have to emit photons just like we did for global illumination. And just like with global illumination we need to turn it on in the renderer. So I'm going to go into my Render Settings window, go over to Indirect Lighting, scroll down to Caustics and turn those on, and we're going to leave those at the default.
So with Caustics turned on, let's go ahead and go into our Camera1 Viewport and do a quick render. Now we're getting a little bit of an effect but not much, so just like we did before we need to up the level of the photons. The intensity of these photons will determine the intensity of the effect. Just like with Global Illumination, you want to balance the intensity of your light against the intensity of your photons. So let's go ahead and bring this up to really big number. I'm going to bring it up to 100,000, and let's go ahead and do another render.
Now with the light at 100,000 you're starting to see the Caustic effect. Basically what it's doing is it's brightening up the area where there is more light. The glass is acting somewhat like a lens and so it's going to push some of the light into more concentrated areas, and this is really what we're seeing here. So if we want to get a really strong effect, we can just keep bumping up our photon intensity. Let's go ahead and bring it up to 400,000 and do another render. Now this brings it up quite a bit, in fact this may be just a little bit too much.
But as you can see we're getting a really strong Caustic effect on the floor, and we're also getting light bouncing around inside the liquid and that's illuminating the olive as well as the stem. We're also getting a little bit of a highlight here along the lip of the glass. Now this is a little bit too much, so let's go ahead and back this off. I'm going to bring it back down to say 250,000 rather than 400, and let's go ahead and do one more render. Now that looks like a pretty good balance between my photon intensity and the intensity of my light.
And again, just like with global illumination, you want to balance your photon energy against the intensity of your light. Now I want to show you one more thing and that's the number of photons. Now in this case we have 10,000 photons, which is the default. And if you look at the Caustic effect here you can see it's kind of blotchy, it's not really sharp, and that's because we don't have enough photons. So let's go ahead and add in some more.
I'm going to make this go from 10,000 to 100,000 and let's do one more render, now this may take a little bit longer. Now with 100,000 photons you can see I'm getting a lot less of that blotchiness and I'm getting a much sharper effect. Now typically I find that caustics does take a few more photons than global illumination, but what's really nice is that Maya allows you to set these values independently, so that way you can do global illumination and caustics and have different numbers of photons for each solution.
So those are some of the basics about how to do caustics. Now remember caustics is not just for transparent material such as this glass, it can also be used for reflections as well.
- Adjusting the Render Settings menu
- Adding depth map and raytrace shadows
- Understanding the principle of light decay
- Creating cameras
- Using Motion Blur in Maya and mental ray
- Using Final Gather for natural illumination
- Rendering transparent materials with caustics
- Batching rendering