Search This Blog

Labels

Monday, December 6, 2010

Creating an Underwater Scene in Blender

In this article by Reynante Martinez, we will learn how to go about creating a underwater scene from scratch. We will begin by creating the terrain for the underwater environment. In the sequel of the article, we will learn how to add vegetation, pebbles and corals. After which we will discuss how to add distant terrains, lighting effects and finally composition.

INTRODUCTION

Underwater scenes are one of the most exciting, inspiring, and gorgeous environments in real life and computer graphics world alike. And with this awe-striking appearance comes a very complex array of possibilities. From a photographer’s point of view alone, underwater scenes seem to be one of the most challenging places and situations to be at, let alone the difficulty of acquiring a proper lighting and the satisfactory combination of shutter speeds and apertures. Same thing applies also to recreating such a scene in computer graphics, specifically in 3D.

Throughout my career in 3D design and animation, I have never thought exactly how to approach an underwater scene not until I actually delved, sat down, and started thinking what approach to do. Fortunately, after hours of conceptualizing and imagining, I came with an approach, which might seem odd to others, but it works which. And that has been my primary motivation in writing this article and sharing my discoveries.

Hopefully, this wouldn’t be too software-centric as compared to my previous articles, which I was trying very hard not to do. The concepts I will present throughout this entire writing will be based off from my own experiences and repeated mistakes. Since there are so many possibilities in approaching problems, hopefully you’ll find mine to be one of the simplest one.

Let’s head on.

REQUIREMENTS

  • Blender 2.49b
  • Skill Level: Intermediate to Advanced

REFERENCES

Below are some reference images I looked up at Google. These will be our starting point and our scene bases.

You’ll notice from the images above that underwater scenes could greatly vary depending on your location and on how deep you are. The shallower your location is, the darker it might get, and the more life there would be. But for now, we’ll focus on just the ambience of the scene and we’ll try as much as we could to imitate this.

CREATING THE TERRAIN

Now that we’re comfortable with our references and how our scene will faintly look like, let’s go ahead and start the actual creation of our environment. First, we have to create our terrain where our props and other models will be situated on. I had this on the first order so that we can pretty much see where and how our props which we are going to model later will look like or if we ever need them to be in the scene at all. Approaching it this way will give us more leeway on the proceeding steps we’ll do later on.

For this environment, our terrain will simply be a subdivided smooth plane with varying elevations (as would have implied by water movement). To achieve this, first let’s delete whatever default scene elements we have (objects, lamps, etc.) by hovering our mouse pointer over to the 3D Viewport Window, pressing A once or twice (depending whether you have a selected object or not) to select all visible elements in your scene, and press X > Erase selected Object(s) or by pressing the Delete button on your keyboard. After this, we simply add a plane primitive mesh to the scene via spacebar > Add > Mesh > Plane or by clicking on Add > Mesh > Plane on the menu header. It’s a good idea to start adding objects in a hierarchical or orderly manner right from the start so we could easily keep track of our progress and solve problems that may arise later on.

Erasing the Default Scene Objects

Adding a Plane Primitive to the Scene

After adding the plane to our current scene, let’s go ahead and scale it a little bit larger just to give us an initial sense of scale and enough room to add our proceeding objects later. Do this by selecting the Plane Object (if it hasn’t been selected by default), then press S to scale and then type 5 consequently to scale it up by 5 Blender Units (BU) uniformly on the X, Y, and Z axis respectively. Or alternatively, you can use the Transform Toolbox (N) and type in 5 in the Scale X, Scale Y, and Scale Z input fields, better yet, to save time, enable the Link Scale button, and type 5 in either of the scale axes and the others will follow along.

The Default Plane Added to the Scene

Scaling the Plane Object

To review, what we basically did was to add a mesh primitive to our scene, in this case a Plane, then to have enough room to work on, we scaled it five times its original size. Looking at the plane in the 3D space though, you might notice that it lacked thickness which is one of the key roles of the z-axis, so with this in mind, we could just scale it along the x and y axes, disregarding the z axis, which we can do by pressingShift Z after executing the Scale operation. What this will do is scale it only in the other axes excluding z, which will result in the same appearance as scaling it in all axes. But for future reference and to eliminate ambiguities later on, it’s better to just scale it in all axes which is the default option after doing the scale command.

Continuing from where we left off, we are now going to create more vertices from our existing plane, these vertices will be our manipulation points that will eventually define our object’s shape later on.

We’ll do this by subdividing our plane a couple of times. Select the plane object and proceed to Edit Mode (Tab) then position your mouse cursor on your 3D View and press W to access the Specials Menu, then choose Subdivide Multi and in the pop-up menu that appears, type in 20 to subdivide our mesh plane 20 times.

Now that we have a fair amount of vertices to work on, we can now sculpt out the shape that we want for our terrain, but before that we will first create a camera in our scene and make it our default. We need to do this prior to jumping in and creating our terrain so we don’t waste time by modeling parts of the terrain which are not going to be seen at all. To add our camera, move your mouse cursor over to your 3D Viewport and press spacebar then choose Add > Camera. After this, go to your front view (Numpad 1), switch to Perspective View by pressing Numpad 5 and look through your 3D Viewport as though your were looking via your camera, when all is done and you have your camera as your active selection, press Ctrl Alt Numpad 0. What this does is it changes your camera’s view to what you are seeing in your viewport. If you’re not comfortable with hotkeys, you can alternatively access this function by going to View > Align View > Align Active Camera to View . After having magically transported into the camera’s view, you can further enhance your viewing experience by enabling Passepartout which darkens the view outside of your current field of view. To do this, access it in the Editing Buttons window, and click passepartout and increase the Alpha to a non-zero value, depending on what you’re convenient with.

Most of the time though, you don’t want your passepartout to be totally opaque (Alpha 1), since it will then deprive you of viewing other objects that might be of importance to you that you wish to include later on your shot or view. Another disadvantage of setting it to a high value is you’ll have a hard time selecting the camera’s outline (which then selects the camera itself) because of the blending between your camera’s outline (black) and the dark bg.

Subdivide Multi Tool

Adding a Camera

Camera View and Passepartout

Align Active Camera to View Menu Option

Right now, our camera placement seems a little bit odd due to some empty space showing through on the bottom half of our view, to address this, we’ll simply zoom in our camera while on its own view. We can quickly do this by selecting the camera (through its border/outline), then press G for Grab and follow it up immediately by clicking on your middle mouse button and confirm it by left clicking or pressing the Enter key. What this trick does is it moves the camera along its depth axis or its local z axis, this way we can smoothly adjust the way our camera is placed in an inward and outward fashion.

Moving the Camera Along the Local Z-axis

Now that everything’s set, we’re good to start the actual sculpting of our underwater floor. Select the plane mesh and go to Edit Mode (Tab) then select few vertices from the plane, these points will represent our influence vertices. To get a better view from your selection process, you can exit your camera view by pressing Numpad 0, rotating your view with middle mouse button, or pressing Numpad 5.

Selecting Few Vertices

Now let’s go back to our camera view by pressing Numpad 0 or you could simply split your screen and have the other half always a camera view. With our vertices still selected, press O on your 3D Viewport and grab the vertices along the z-axis by pressing G then Z, then you will notice that neighboring vertices got pulled too, this is because we turned on Proportional Editing which is a very handy tool in manipulating meshes. To control the radius of influence, you simply scroll with your mouse wheel. You can access this menu and further more options on the 3D Viewport menu represented by a circle icon on the far left.

Proportional Editing

Let’s now go to camera view (Numpad 0) and start altering our mesh plane according to what we see in our view. Move the vertices like how we see in the screenshot below.

Moving the Vertices Proportionally

This would be a good shape for now. But since we wouldn’t want our plane to appear too blocky or edgy, all we have to do is go to Object Mode and click the Set Smooth button in Editing (F9) and under the Links and Materials tab.

Smoothing the Plane Mesh

After we’re done with the initial model of our terrain, let’s go ahead and assign a basic material to it, just a diffusion color for now then we’ll get back to it later and add in more material settings and textures. To do so, let’s head over to the Shading (F5) then to the Material buttons, then under the Links and Pipelinetab, click Add New to add a new material to the datablock. Let’s name it sand and check the screenshot below for more details on the material settings and shaders.

Basic Material Settings for the Terrain

ADDING VEGETATION

Let’s leave the terrain as it is right now and make sure it is in layer one (just to keep things more organized). Then let’s select the camera and move it to layer five by pressing M then clicking the fifth layer or by pressing 5 on your keyboard. Activate layer two by pressing 2 on your numeric keys (not the Numpad). We will use this as our layer for our first group of seaweeds.

Go to front view, add a new Bezier Curve, proceed to Edit Mode and follow the initial settings I have on the Editing Panel.

Moving the Camera to Layer Five

Adding a Bezier Curve and its Settings

Let’s leave the curve settings for now and we’ll get back to them when necessary. What we have to do now is to rotate the curve such that we see the thicker part of the face in front view and the start point of the curve on the bottom portion. There are two easy ways to do this; either we rotate the curve on view at a time or we can type in values in the transform window, you can settle for either of the two. To make things quicker, I opt for the latter. With the curve currently active/selected, proceed to Object Mode (Tab), then bring up the Transform Window if it is not yet on your screen by pressing the N key while having your mouse pointer on the 3D Window.

Afterwhich, using the Transform Window, let’s change the default name of the bezier curve from “Curve” to “Curve.Weed”, then change the rotation values for RotX and RotY accordingly, as seen in the following screenshot.

Renaming and Rotating the Curve

Next comes the fun part: editing the curves and giving them the wavy forms they deserve. With the curve selected, go to Edit Mode (Tab), then for convenience purposes, we are going to disable the drawing of the curve handles. We do this by going to the Editing (F9) panel and under the Curve Tools1 tab, disable the Draw Handles button. Now if we select all the points in the curve, the handles that are usually there and are sometimes in the way are now hidden, and if you wanted to have more control over your curves, you can always turn them back on by simply enabling the same button we disabled awhile back. Right now though, we only have two points to work on our curve which is a bit limited. But don’t fret, because Blender’s curve tools are of its greatest assets and they won’t let us have it unless it’s good to use. With that said, we can solve the problem by selecting all curve points (pressing A twice), then press W to bring up the Specials Menu and choose Subdivide. You can also access the same function by going to theEditing (F9) panel and click the Subdivide button. You can repeat the same process to achieve more subdivisions on your curve, but I highly suggest you keep it as simple as you could, and only add points when needed. Another way you can add points to your curve is to select existing points then pressing the Ekey (as in extrude) which will automatically put you in grab mode and confirm location with your left mouse button. You can also select a point from the curve then press CTRL left mouse button which will add a new curve point to where your mouse pointer is.

Subdividing the Curve

Now that you already have enough subdivisions to work on, you can manipulate the individual points the way you want to as shown in the screenshot below. Another cool thing with manipulating curves is the ability to tilt curve points along their own axes with ease. You can tilt points by selecting one or many points then pressing T or accessing it through the menu via Curve > Transform > Tilt.

Curve Shaped

Tilting Curve Points

After creating the shape of our sea weed, it’s time we convert it to a polygon for us to further edit and finalize the shape. Select the Curve in Object Mode, then press Alt C then choose Mesh (which should be the only option available from the pop-up menu). What this does is it converts our existing curve into a polygon mesh with editable points (similar to what the mesh primitives have). This way we can add more details to the weed. But first, we mush fix first one problem that our weed mesh has: a hole at the top. You can choose not to address this issue, but in order to avoid getting back and fixing some stuff later on, it’s better to do it now. When we rotate our view such that we see the top part of our weed, we can clearly see a cut through the mesh, let’s fix this by going to Edit Mode, selecting four neighboring vertices and create a face by pressing F or going to the menu then choosing Mesh > Faces > Make Edge/Face. While in edit mode, you can also occlude background vertices by clicking the button with the cube icon on your menu 3D Viewport menu. This might also be a good time to rename our object from Curve.Weed to Weed.

Creating Faces

Faces Complete

Let’s exit Edit Mode and get back to Object Mode (Tab) and just give our weed a basic subsurface smoothing. With the object selected, you can press Ctrl 1 to add level 1 Subsurf to the weed or your can go to the Editing (F9) panel, and go to the Modifiers tab, click Add Modifier and choose Subsurf, then change the default Render Levels from 2 to 1 since we don’t need the extra count since they hardly differ in this case like ours.

Adding Subsurf

However, you’ll notice that hardly any smoothing took place and it even revealed problems with our mesh. Don’t panic because this would just be an easy fix. Select the Weed Object and proceed to edit mode, select all vertices, then press W to access the Specials Menu and choose Remove Doubles.

Removing Mesh Doubles

Next, after successfully applying subsurf to our weed object, we know scale down the top-most part to further make it more convincing and natural. While still in Edit Mode, select the top-most vertices then use the Proportional Editing tool with a Smooth Falloff and perform a scale (S) operation while controlling the radius of influence with your middle mouse wheel.

Using the Proportional Editing Tool for Scaling

After performing the proportional scaling, it should look something like this

Weed Shape

Next, we add in just an initial material to distinguish it from other objects we’ll create later on.

Weed Initial Material Settings

Hardly do we see weeds by their own, as singular leaves with no nearby leaves, unless it’s artificially setup. To add more weeds as group, we simply duplicate the weed we have now and edit the duplicates accordingly.

Group of Weeds

Next up, we “group” the weeds using Blender’s grouping function. We do this by first selecting the objects we want to be included in the group, in this case, the weeds. After we’ve selected the weeds, let’s split our 3D view and make our left view an Outliner (by clicking the lower left-most icon of the screen), then change the drop-down menu entry from “All Scenes” to “Groups”. Let’s move our mouse pointer over to our 3D View and press CTRL G then click Add to New Group or via the Menu, Object > Group > Add to New Group.

Preparing the Weeds for Grouping

Grouping the Weeds

Right after you perform the grouping function, you’ll notice your object outline change from the default white to green which indicates that it belongs to a group. Additionally, we also see a new entry at the Outliner Window labeled “Group”.

The outliner is a very powerful aspect of Blender in a way that you can keep your assets, shots, groups, etc. as organized as you want them to. Think of it as your file manager inside of Blender, aside from the fact of course that Blender has its own dedicated file manager too.

To rename the group we just created (for easier searching later on), move your mouse pointer over to the group name, then press CTRL left mouse button and the name will change into an input area where you can type the name you want to, in our case we will name it “Weed.Group”. It took me a long time before to figure out how to rename items in the Outliner, I checked every possible menu entry showing some rename-this-group function but unluckily I didn’t find any, not until I accidentally pressed this shortcut (after being so frustrated and bugged). Sometimes, accidents just bring out great surprises we never thought be useful. But of course, I could have settled into asking or searching the Blender forums for the solution, but the stubborn user that I am, I still decided to solve it on my own until I lose my mind, and I did after all (without losing my mind though).

Weeds as Group

Renaming the Group

Now here’s one fun part of creating groups for our objects: using them as particle instances. You’ll see what I mean in a moment.

Let’s get back to our terrain layer by pressing 1 on your keyboard or by clicking the first layer button on our layer lineup. Select the terrain object and go to Object (F7) panel then to the Particle buttons sub-panel. Here you’ll see one tab labeled “Particle System”, pretty puny and out-of-place you might say? Just look after we’ve created some system to play around with and you’ll notice just how powerful the particle system of Blender is (far beyond what this article can stress). Click the Add New button to add a new and fresh particle system.

Adding a Particle System to the Terrain Object

Rename the particle system from the default “PSys” to something more meaningful like “Weed”. Next, change the Particle Type from Emitter to Hair. Under the Particle System tab, click Random button and beside it select Faces from the dropdown menu, next click Even button and beside it select Random from the dropdown menu. What we just did is to tell the particle system to emit particles in a random order, in an evenly distributed manner on a per-face basis.

Still on the Particle System tab, change the amount to 50 and the Segments to 2. We won’t need much for this system, just an adequate amount since we don’t want our system to slow down due to the calculation that Blender does when visualizing particle instances. Right now we don’t see yet what’s actually happening and it’s more like a guessing game at this stage but you’ll see shortly how all this comes together.

The greater the particle amount you specify, the heavier your scene will become, thus slowing down your viewport performance.

Now we jump to the Particles tab. Here, we’ll only manipulate the Tan and Rot values accordingly. Normally though, we would have altered the Normal and Random values, but let’s not touch them for now, but you can always do so if you want to feed your curiosity.

Proceeding, we now change some values in the Visualization tab. From the drop-down menu, chooseGroup then in the GR: input, type the name of the group we just added and renamed awhile back: “Weed.Group”. And finally, click DupliGroup to tell the particle system to regard the group input as a whole and not as individual objects (which we’ll use later on).

Particle Instancing the Weed Group

You might notice one problem though (depending on your setup), it seems that the particle weeds we just added are not sitting on top of our terrain. To fix this, just go to layer 2 and move the weed group higher on the z-axis and this should do it. If we switch to our camera view (Numpad 0), this is what we’ll mostly have as of now:

Weeds Position Fixed

To add more variation, we will follow similar steps that we did with instancing the weeds and this time we’ll add weeds that are singular and not bound on groups. Let’s add a new particle system above the one we currently have now by selecting our terrain object, then proceed to the particle buttons, you’ll notice that beside the name input of the current particle system we have now (labeled “Weed”) is the number of particle systems present in our object, labeled by “1 Part 1”. What we’ll do next is tick the right arrow of the particle number such that we change it from “1 Part 1” to “1 Part 2”. Don’t worry though, the previous particle system we had is still there intact. Now that we’re in the second particle system, we’ll follow the same steps we did in creating the system we had awhile back, except for some tweaks on some of the values, primarily the amount of particles emitted and the group settings. Instead of using Dupli Group as instance method (under the Visualization tab), we’ll use Pick Random and let Blender choose individual objects from our Weed Group and randomize them. Additionally, you can change the Seed number which is the way randomization occurs. Play around with the settings until you find the right ones.

ADDING PEBBLES

Now that we already have a clear idea about using Blender’s particle system to instance groups of objects on our scene, this next step we’re about to do would be a no-brainer. Let’s activate layer 3 and use this as our holder for our stone group that we’ll create shortly.

This time, the modeling process of the pebbles is as simple as creating the base mesh you want, as in my case I used an icosphere with the default subdivision of 2 and went from there on, manipulating points using the proportional editing tool, and duplicating the stones and adding variations to each piece. After you’re done with the modeling process and you’re pretty confident to use these pebbles on to your scene, go ahead and group them and name your group accordingly.

Just like what we did with the weeds, let’s give these pebbles some initial materials and basic shaders for now.

Creating Pebbles

Pebbles Initial Materials

Now, we use the same technique used to instance the weed group to our terrain object. Let’s add a new particle system to the same object that used to be our particle emitter. So from “1 Part 2” we increment to “1 Part 3” and use the Pick Random function to randomly distribute the pebbles on our terrain.

Adding Pebbles to the Scene

ADDING CORALS

Underwater scenes wouldn’t be complete without those lovely corals we see, blooming with life and populating parts of the water world as we know it.

To get started, we begin with modeling the first set of corals we’ll be adding in. Let’s use layer 4 for our corals. Add a cube primitive to the scene and in Object Mode then press CTRL 2 to add a level 2 Subsurf.

By default, objects added in Blender are shaded as solid, and you’ll notice that right after adding in a subsurf modifier to our cube, it interpolated the edges thus creating curved surfaces, but the result is that it created a faceted shaded look. To address this, go to Edit Mode and press W then choose Set Smoothor go to the Editing (F9) panel and under the Link and Materials tab, click the Set Smooth button.

Subsurfing the Cube

Smoothing the Shading

Go to front view (Numpad 1) then select all the top vertices of the cube and move them up on the z-axis, elongating the shape along its height.

Moving the Top Vertices Up

With the vertices still selected, extrude (E) them upwards a few units along the z-axis and left click to confirm the location.

Extruding the Top Vertices

Next, while still in front view, scale the active and top-most vertices along the x-axis by 0.200 forming a shape like seen in the following screenshot.

Scaling the Top Vertices along X-axis

Then (still in front view), select the upper left four vertices (or the upper left face) then perform several extrusions, scaling, and rotation, forming the shape that you see below.

Left Part Shaped Through Extrusion, Scaling, and Rotation

Let’s add some hole to detail out the tip of the upper left part of the coral-like thing we have now.

Detailing the Tip of the Coral

Repeat the previous steps and apply it to the right part of the coral, adding a bit of variation.

Coral Shape Completed

To add more shape, add several edge loops to the mesh in Edit Mode by pressing CTRL R and further manipulating them the way you want to.

Detailing the Mesh

Coral Model Finished

Just like how we usually do it (for ease of scene visualization), we are going to add preliminary material setup for this one, as seen in the image below.

Brown Coral Material

Now, instead of instancing this model using the particle system, we’ll do the placement by hand, this way we can clearly define the manner by which we stage our scene. And of course, aside from the fact that using particle instancing can be a heavy load on your system and on your scene (depending on how complex your models are and how much particles are being emitted).

Instead of only activating layer 1 (terrain layer) and layer 5 (camera layer), we also include layer 4 in our layers now, which includes the coral object we just created. With three layers active, select the coral object and place it in your scene the way you want to, scaling and rotating the coral as necessary.

Here’s how I made mine:

Terrain, Camera, and Coral Layers

ADDING DISTANT TERRAIN

Looking at our scene in our 3d viewport now, it looks rather bland and lacks depth, much like what you’ll see in a small aquarium or fish tank. What we’ll basically do in this step is to add more land to the farther side of our view, which will be of great help later on when we compose our scene with haze effects and such.

Right now, we only needed to see the terrain in layer one and less the other objects which are making our viewing experience slower. Activating only layer one, we see all but the camera and corals, which is still a bit heavy. Let’s fix this by simply turning off the instanced objects for the moment so we gain an almost realtime display of our scene.

Select the terrain object, go to Editing (F9) panel and under the Modifiers tab, you’ll notice three (3)modifiers in the stack, namely the particle systems we’ve added before. Simply disable the modifier during interactive display by untoggling the button with the grid icon (as shown in the screenshot) and there you go, only the terrain object is what we see now (but in theory, the objects used in the particle system are still there, just hidden from our view).

Disabling Particle System in Interactive View

Let’s go back to our modeling steps with the terrain and apply this to the new terrain we’ll add on the distance, except of course it would be offset in the y-axis, a bit far from our original terrain mesh. For this distant terrain, we’ll use the same layer that the original terrain belongs to. Take advantage of the proportional editing tool and choose whichever falloff you wish is suitable.

Fast forward in time, this is how our layer 1 scene should look like:

CREATING THE TEXTURES AND MATERIALS

Now for the fun part. With layer one still the active layer in our viewport, let’s get started by selecting either of the two terrains (which share the same materials). Activate Shading (F5) then Material Buttons. Under the Ramps tab, beside Material tab, activate Show Col Ramp, then click Color Band.

Setting Up the Sand Material

Color ramps are one of the greatest features of Blender’s materials that I have discovered since I embraced the software. They can either add subtleties to the way your materials are shaded or they can also be used to fake highlights and shadows. Let’s continue on. With the Color Band activated, click and drag the slider bars (which aren’t shown well) and you’ll see the effect in the preview window of the materials button. What we want to achieve here is let the materials shader dictate the way the color is interpolated, be it the lights in the scene, the ambience, or any other factor. Let’s flip the sliders by dragging them on to their opposite direction. By default, the light blue slider is positioned to the far right side of the color band and the transparent slider on to the far left side. So what we need to do is move the transparent slider to the far right and the light blue slider bar to the far left, achieving something like shown in the screenshot. Another option we should take note of is using the Shader as Input and Mix as Method.

Setting Up the Color Ramps

Next, click the light blue slider, and change the color to something dark orange, or something near brown.

Color Ramp Settings

Now, some textures. With the same object active and the same button window, scroll below until you see the Textures tab. Click Add New then rename the newly added texture slot as micro bumps. This will serve as our grains-of-sand texture for our terrain.

Adding a Texture to the Terrain

What we have done so far is just to add a texture slot to the stack, much like a placeholder, but it doesn’t tell yet Blender what type of texture nor which channels of the material will it affect. To add definition to our texture, head over to the Texture Buttons (F6), and on the Texture Type dropdown menu, choose Cloud. This texture that we just added is one of the many procedural textures available in Blender, which are one of the most powerful additions yet. Cloud textures are great for creating irregular bumps or even stains (or whatnot, a whole lot more with the right combination of settings).

To achieve the grain effect that we want to for our texture, we scale down the cloud texture size to about.005 and the noise depth to 3. Leave the default settings as they are.

Setting cloud texture sizes to absolute zero can sometimes lead to undesirable effects like jittery motions when animated (just like how the default Noise Textures are). Always keep the values non-zero.

Now we tell Blender what to do with this texture and how it will be used on our current material.

Let’s head over to Material Buttons, then scroll over to the Texture tab and beside it you’ll see two more tabs beside it namely Map Input and Map To. These are our primary tools in telling Blender what to do with the textures we create. You can play around and see what each setting does. If you’re done experimenting around, let’s get back on track. For now let’s leave the default settings of Map Input as they were. Move toMap To tab and here you’ll be presented with lots of confusing buttons which are confusing at first (thanks to tooltips, life is easier). Activate Col then change the color from the default purple to something close to the original material color but a tad darker. Leave the Col slider to the right portion at its default as 1. Next, activate Nor by clicking it once (which means positive, twice is negative) and then move the Nor slider to the right part to something higher than 1. Normal mapping is one of the greatest things ever invented yet in 3D. What it does is it fakes displacement – which is the actual distortion/alteration of mesh points, by using a mesh’s normal coordinates and simulates displacement by faking the way diffusion, specularity, and shadows are casted, created the illusion of bumps. To cut the long description short, it creates bumps for us, the fake way. Below is a comparison of the mesh with Normal mapping as against a mesh with displaced geometry which has more faces than the other one.

From the images, we can clearly see that with normal mapping, the sphere object which we applied mapping to stays the same shape, with its contours perfectly as that of a smooth sphere while the other one with displaced mapping, the geometry is actually modified such that in all angles, the definition is clearly stated.

But since we wouldn’t need that much of information as the displacement mapping has, we’re good with using normal mapping which is lighter and easier to set up.

Now let’s move on to giving the see weeds some decent materials and textures.

Activate layer 2 and select either one of the weed objects. Proceed to Shading (F5) then on to theMaterial Buttons then do the same process that we did with the terrain except that you change some of the mapping options and ramps. Instead of using a Shader ramp, we’ll use Normal as the input; this is to simulate translucency and light diffusion.

Use the same procedure to your other scene objects, after which, we’ll proceed to lighting up the scene.

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 theWorld 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 andDist 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

Mist Settings

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:

First Render!

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 pressingspacebar, 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.

Light Setup

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

COMPOSITING

That’s about it in creating all that’s needed for our baby underwater scene, there’s still so much that has to be done but I leave that up to you. Right now, one of the most important parts of this scene, making it look right. We could spend hours to days to weeks tweaking the lights, adding additional props, and effects, but it could only take us minutes to look it even better by simply adding some visual effects and contrast changes to the images rendered from our scene.

Change your 3D Viewport to the Node Editor, click Composite Nodes, Use Nodes, and Backdrop. Then under Scene (F10) and Render Buttons, enable Do Composite under the Anim tab to tell Blender to respect our compositing node process and use it for our render output.

Enabling Compositing

Under the Node Editor, select the Render Layer node and press spacebar > add ≫ output > viewerthen position it somewhere below the render layer node.

Adding a Viewer Node

Reselect the Render Layer node then press spacebar > add > color > rgb curves. Select the RGB Curves node and add a viewer just like the way we added a viewer node to the render layer node.

Adding RGB Curves Node

Adjust the curves on the RGB Node using the C tab’s curve to increase the contrast, like how we see in the screenshot below with the S Contrast Curve in use.

S Contrast Curve

Repeat this process until you’re satisfied with your color results, using different channels of the RGB Curve.

Series of RGB Curves

Extending through the noodles, here’s what we will achieve with the Noodles (with lot of patience and experimentation):

Noodle Network

Showing us this render:

Composited Render

And for some bonus, with a few tweaks here and there and some particle instance effects (which I’ll discuss on my upcoming article), here’s what I came up with:

SUMMARY

In this article, we learned how create an underwater scene from the preparation stage (prop modeling, environment modeling, etc.), shading and texturing stage, lighting with halo effects, basic particle systems, up to compositing the scene for better looking outputs.

I hope you like it and thanks for reading! And please, if you had some renders to share, feel free to send them to my email address: reynantem@gmail.com and I would love to give feedback on them. Moreover, if you have some comments and suggestions on this article or how I could make our future articles better, please do let me know. And why not, you could throw in some ideas too!

Thank you so much and have a happy Blendering time!

2 comments:

  1. Hai :) I've send you an email, if you have a time please check it, I hope you can reply it too

    ReplyDelete