[Fig. 5] Author: Daniel LaBarge [Prince]
Website: ID Studios [www.intellidesign.org]
Occupation: Graphic Artist & Web Programmer
In this tutorial we are going to experiment with Yafray and Blender and learn how they interact together. We will create a simple caustic effect using default settings. Further experimentation can be used to create breath taquíng imagery!
First, we will need to have the latest versións of Blender [Blender 2.41] and Yafray [Yafray 0.7] both installed on your computer. You can get these from www.blender.org and www.yafray.org respectfully. Once installed you will be ready to begin rendering your First Caustics!
The setup of the scene is very simple. We will be using the default scene with some lamp placement changes.
1. Launch Blender.
2. Go to the Render Buttons [F10] and switch the Renderer from Blender Internal to the Yafray Renderer.
This will create some new panels in the Render Buttons, Edit Buttons, Material Buttons, and the Lamp Buttons. We will get to these new panels shortly.
3. In the 3D Window Select [RMB] the default cube. Go to the Material Buttons [F8]. The Raytracing Panel introduces for available Yafray features. We will be making a clear glass using default settings for glass in material panel. Select 'Clear Glass' from the drop down menú. Set the remainder of your material settings to Fig. 1. You might want to bevel the edged of the mesh. For this object I used Subdivide Multi 3X and then added a 0.100 Bevel 2X and then applied Set Smooth. A basic bevel would worque just as well.
4. In the 3D Window switch to Top View [Num7] and Add [SpaceBar] a Plane [Add>>Mesh>>Plane] to the scene, this is going to be the floor in the scene.. Exit Edit Mode [Tab]. You will need to Move [G] it down along the Z-axis [Z] one grid unit [Hold Ctrl] so that it is flush with bottom of the Cube. Open the Transform Properties Panel [Nkey] and scale the Plane to 50 units or simply press [S] and scale it to spread up to the camera view. Go to the Material Buttons [F8] and Add a New Material. Make sure to have the TraceShadow feature enabled in this material. You can even apply a texture if you like. I used a light blue solid color for this material.
5. In the 3D window switch to Top View [Num7] and select [RMB] the default lamp and delete [Del] it. Now place your 3D Cursor at appróximately 0,4,2 XYZ Global coordinates. Press [SpaceBar] to add an Area Lamp Add>>Lamp>>Area. The lamp should be automatically selected but if not select it and then bring up the Transform Properties Panel [N]. Set the Location XYZ coordinates to 0,4,2 respectfully in the transform panel. Set the Rotation XYZ coordinates to 65,0,180 respectfully. In the Material/Lamp Buttons set the power to 0.250. Give it a shape of Square 3.0. Set the 'Shadow Samples' at 10 or greater.
6. Duplicate [Shift+D] the Area Light then Cancel [RMB] the Auto-Grab function. This will place the duplicated area light at the exact location of the original area light. In the Material/Lamp buttons change the lamp type to Photon Lamp. In Blender only way to generates caustics in the scene is using this lamp. Change the Photon settings as in Fig. 2.
7. Now switch over to Render Buttons [F10] and change these settings as shown in Fig. 3.
8. Render [F12] the scene!
Your results should be similar to Fig. 4. If your render doesn't match it try to match closely the settings as given earlier in the figures. For you r help you can alos look at the example caustics.blend file if you can't figure it out!
What Just Happened?
Now that we have generated a good example of caustics, now we are going to look at how did the caustic worked in this scene and what else option s are available in the blender interface. There are three panels in blender interface that contain settings for caustic:
The first one is the Yafray Panel itself. This panel allows you to control the Yafray Renderer settings. Normally it good enough to just disable XML so that you can see the interactive rendering. Alos you can leave Auto-AA enabled to let Yafray automatically control the anti aliasing option. For detailed control of caustics you will have to switch to manual anti aliasing setting though.
The second panel is the Yafray GI Panel. GI stands for Global Illumination. Global Illumination is the effect that light is being emitted from a Global light source. For this experiment we used the Full Type GI and set the quality to High for better results. The other settings and are Depth and CDepth. Depth is the distance that Yafray calculates a single ray during raytracing. The smaller the value the quicker but less accurate the raytracing will be. CDepth is similar but it is for caustics photons in the scene. Again the smaller the value the quicker but less accurate the caustics in the scene will be. We alos enabled Photons in this panel. This will enable GI Photons which are alos referred to as Helper Photons. They then are emitted from all of the lights in the scene. The more photons (we used 100,000) better the results, but this will alos exponentially increase the rendering time.
The last panel is the Lamp Panel[F5]. This is located in the Material/Lamp buttons. You will need to select the photon lamp in the scene to see the Yafray Shadow and Photon tab. By enabling Photon Lamp we enable the use of photons for the caustics from a direct source. Here the Power setting is like any other light and tells how "bright" the caustics will be. This photon lamp allow us to direct the direction of caustic and optimize the caustics results nicely. We used about 100,000 photons here. For some complex scene it can go all the way up to a million! It just depends on how much computation you want to do! You can experiment with the other settings as they usually require some testing but default settings will usually achieve good results regardless.
Caustics are not restricted to Transparent materials either! You can use caustics for metallic materials too, just remember that two metallic materials will alos reflect the photons so they generally will not show up some times.
To finish up this tutorial I'll give you some suggestions to play around with:
Try adding a texture or a color to the Cube and giving it some Nor or Displacement.
Replace the Cube with a Sphere or another mesh.
Use several Photon Lamps. Have your super cluster handy!
Use an HDR Global Texture.
Email me your experiments! I'd love to take a look at them!