Mar 11, 2012

Vray caustics tutorial


In the next tutorial I will try to explain what parameters you need to control in order to obtain realistic caustic effects with 3ds max and vray.
Open the “caustics start” scene that you will find in this zip file.
As you can see, the glass material is already prepared:
-reflect 213:213:213 with fresnel reflections checked.
-refract 238:238:238
-IOR 1.44
-Affect shadows – checked
First, go to the “Vray: caustics” rollout and activate it by checking the box next to it.
If you render it at this stage you will end up with something like this:

The caustics effects are already visible but they have a fake look and lack definition.
The most important parameter that we need to adjust is the “caustics subdivisions” that are emitted by the light. For this, you need to right click on the direct light, choose vray properties and increase the “caustics subdivisions” from 1500 to 20000 and render it again.

The caustics are starting to look more real.
Now let’s see what other parameters do…
If we change the “search distance” parameter to 0.02 we will end up with something like following:

As it can easily be observed, smaller values produce much sharper caustics but a lot more noisy.
Higher values result in smoother caustic effects, but at the same time the higher the values, the blurrier they get.
After several tests, I am happy with a search distance value of 0.09 for this scene. The caustics still look a bit noisy, but we will try to adjust this by tweaking the “max density” parameter.

Max density is probably the trickiest parameter, and if you don’t understand how it really works, you can end up with unexpected and undesired results.
First, let’s do a test; increase the max density from “0” to “1” and look what happens:

Where did all the caustic effects go?
Take a look at the following diagrams:

If max density is greater than “0”, when vray needs to store a new photon, it will look if there is another photon within the radius specified by this parameter. If it finds one, it will just add the energy to the one in the map, in order to keep the photon map at a smaller size (case 2 of the diagram). If the area is too large the end result will look like there are no caustics in the rendering.
If no other photon is found within that radius, the new photon will be stored in the photon map (case 1 of the diagram).
After doing some tests, I think that a value of 0.002 works just fine for this scene.

In order to realize just how tricky this max density can be, leave it at 0.002 (that works fine at the moment, as seen in the rendering above) and increase the caustics subdivisions of the direct light to 50000 and run another test rendering.
You would expect better results, right? WRONG! The result looks exactly like the one with max density set to “1”. Basically by increasing the caustics subdivisions we ended up with more photons acting like “case 2” of the diagram.

Other parameters:

Multiplier – it makes the caustics brighter if increased, or less bright if a value lower than “1” is assigned to it. In theory you should leave it at “1” since it is supposed to give physically correct results.

Max photons
– somewhat similar to “search distance”, but instead of using the distance between photons to interpolate, it uses a higher or a lower number of photons.
Mode – works almost like the irradiance map. You can choose “new map” to calculate it again, or you can save it once you are happy with it and load it later for further renderings.
Another important factor to keep in mind is that the looks of the caustics depend a lot on the geometry of the objects that cast them. For example if you want to render a swimming pool with caustics you need to model a realistic water surface (or at least a really good displacement map), otherwise it will not look natural.

No comments: