LIGHTING UP THE SCENE
From the point we started our scene, we haven’t tried any test renders yet to see how our underwater environment looks and I know you’re all so eager to try and press that RENDER button (so am I), but let’s make sure that we don’t waste a second of our time by rendering something that’s not worth the button press at all.
Let’s prepare our background or world (as Blender world) so our recently created objects could have something to lie on, not just blank void of utter nothingness.
In our 3D Viewport, select your camera (which is in layer 5), and proceed to the Editing (F9) panel and under the Camera tab, click the Mist button. What we did was to enable our camera to view our mist distance, for use later in the next procedure. Next step, proceed to the Shading (F5) panel then to the World Buttons and under Mist/Stars/Physics tab, click the Mist button to enable it. As of this time, the Mist toggling we did doesn’t do anything great yet for our scene. Under the same tab, adjust the Start and Dist values accordingly, and then you’ll notice the changes take effect in your 3D Viewport via your camera. What mist does is it fades whatever objects are within its range into our world background.
Enabling Mist Display
After you’ve set your Mist settings, proceed to the tab right next to the current one we are in now, the Amb Occ tab. Click the Ambient Occlusion button and leave the other default settings as they were except for the diffuse energy settings which we’ll change to Sky Color and the type of Ambient Occlusion to use which we’ll change in the dropdown menu from Raytrace to Approximate. We told Blender to render out our scene with ambient occlusion which is basically a global illumination method (or something similar to it), creating a global environmental lighting and producing soft shadows due to object occlusion. I often do this to my scenes where I start out my lighting process by turning on AO (Ambient Occlusion) as my first pass and take it from there.
Ambient Occlusion Settings
Now, the moment you have been waiting for, RENDER TIME! Probably, before you have even read this sentence here, you already pressed the F12 button or the RENDER button. If you didn’t, I guess you already know what to do which leads us to this image:
Pretty dark isn’t it? By default, if we had the Ambient Occlusion’s diffusion settings to Plain, which just uses a plain white occlusion color, this render would be brighter, but we would not achieve that dark blue distant color that we see right now. To fix this problem, or better said to tweak this better, we’ll add in lights, which is the primary reason of this part of this article. So why don’t we throw in some?
The first light we’ll create is a spot lamp from directly above. We would have opted to have this step of the lighting in the last parts of our pass but we’re trying as much as possible to avoid resetting some settings later on.
Add a spot lamp to our scene by moving your mouse pointer over to the 3D Window and pressing spacebar, choose Add > Lamp > Spot. Set the settings of lamp (as seen in the screenshot) such that it only affects our nearest terrain.
Adding the Spot Lamp
Top Spot Lamp Settings
Again, let’s do a test render and see how everything looks like so far.
Render with Top Spot Lamp
And finally, some light and recognition, but still a little bit dark, so however you want it, throw in some lights at the sides to kill the dark shadows. Experiment with the way you light the scene. Just for reference purposes, you can take a look at the screenshot below.
Leading us to:
With More Lights
Just for fun and more aesthetic appeal, we’ll create another light which will cast rays (popularly known as volumetric lighting) and produce caustics which we’ll see in the sand. Duplicate the top lamp and move it higher than the original spot lamp we duplicated it from and adjust the settings accordingly.
Ray Spot Lamp
The key settings for this lamp are the halo and halo steps. Enabling Halo makes our spot lamp draw volumes of light and halo step enables us to block this volume to create nice looking shadows out of the volume. A halo step of 0 will not produce the shadows and non-zero values will enable us to achieve such, often, you can stay at levels of 5 which is a good compromise between the quality of shadows and speed but for this part, we’ll just choose 1 to achieve the smoothest shadows.
Without anything to block out the volumetric light, it would look as though a beam from an alien spacecraft just swept through our scene. But we want smaller light streaks, so what we need to do is to create a mesh to block out the light and let the beam pass through the holes of the mesh (as seen in the screenshot). Commonly, this mesh is called the “gobo” or the pattern with which light passes through.
Render with Light Beams
Now, on to the caustics. To those of you who haven’t heard about caustics before, they are the patterns you see on the floor of a pool or a shallow body of water. It is caused by the way light had been bent by the waves and distortions happening on the surface of the water.
You can skip and just move on to the other one if you don’t wish to add caustics to your scene, but I highly suggest you not to since this is one of the most fun parts in creating the scene.
It had been a tedious and long journey for me to discover about this technique in creating caustics and thought I might share it to those who haven’t found out a way yet. All credit goes to the Blender Artists forum and the creators of this great application that we’ll use shortly to create the caustic effect.
If you’ll do a quick Google search and type in “caustics generator”, among the first few results you will see is the CausticsGenerator application (pretty repetitive, eh?). Or you could go directly to this site http://www.lysator.liu.se/~kand/caustics/ and find out about this wonderful application. Head over to their downloads section and grab a copy of the free version which is licensed under the GNU GPL or you could buy the commercial version. Under their readme file or about section, here’s a description of caustics: “Caustics can be described as the light pattern you see at the bottom of a pool on a sunny day. This tool will let you render such caustics patterns. The rendered images can be animated and used for realtime graphics and are tileable in both space and time.”
After downloading the application, extract the zip file to your preferred directory, and inside that open the file CausticsGenerator.exe. You’ll be presented with lots of settings and sliders to play around it. I won’t hold you back to go ahead, play around with it, and have fun.
The procedure I did to achieve the caustics effect for our scene is to just adjust the depth, resolution (width & height), supersampling, and the output file and render out an animation out of the settings I had.
Caustics Generator Settings
That’s about it for our caustics and after successfully rendering out the animation, you can check the directory where you have the renders outputted and you can see a bunch of BMP images. These are what we’ll be using as image sequence textures for one of our lights back in Blender.
Caustic Image Sequences Generated
Back to Blender, select the upper spot lamp casting the beams of light and go to Shading (F5) panel, then to the Lamp Buttons and scroll over until you see Texture and Input tab. Click Add New and name your texture “caustics” and use the View Coordinates. Under the Map To tab, select Shadows to have the caustics affect the shadows from the light as well (though in real life, this rarely happens).
Adding a Texture to the Spot Lamp
Proceed to the textures button and change the texture type to Images. Browse through the folder where you saved the caustics images and just select the first image in the series and click load or middle mouse click the first file. Under the Image tab, click Sequence (to tell Blender that we’re not just using the single file we loaded but the whole sequence which comes with it), enable Auto Refresh, set the total number of frames, and click Cyclic to make the animation loop.
Loading the Caustics Texture
If we render the scene now, here’s how it will look like with the caustics:
Render with Caustics