Sunday, December 12, 2010

The Basics of Terragen 2 - Part 1

Hello, everyone!  In this tutorial I'll be teaching you the basics of landscape generation in Terragen 2.  This will be a series, as there's too much to cover in one tutorial.

Terragen 2 is a landscape generator, and it produces extremely realistic results.  If you take a quick look at my CG Artwork section on this blog, you'll see a few landscapes that I have made using this program.

Terragen 2 has both a pro version and a free version, and in this tutorial I will be using the free version.  The restrictions in the free edition are:

1.) You can't use any of what you make for commercial purposes
2.) Your maximum render size is 800 by 600
3.) You have a limitation on detail amounts and anti-aliasing
4.) You can't use more than 3 object populations (we'll go into that later)
5.) You can't animate (it would take forever to render an animation anyway.  A 5 minute animation could take up to a year to render, depending on the quality and size)

You may think these are all horrible restrictions, but I can't afford the pro edition, and I still enjoy using the free.

I know this isn't related to blender at all, but blender tutorials will still be released, it's not the end of the world (not that I get a ton of page views, anyway), and this is, after all, free software.

It can be downloaded here.  I also strongly recommend you download the two additional plant packs at the bottom, as those are incredibly helpful at times (as land does tend to look a little better with some form of foliage covering it).  While you're at the site, take a look at the gallery; believe me, you won't regret it :D

Assuming that you have installed Terragen 2, let's get started!  Open it up, and a little splash screen will pop up.  Unless you want to buy the software, click on Use Free Edition (obviously :P)


As you can see, the interface looks a bit complex at first (maybe not quite as complex as blender looked when you first opened it, though ;), but it doesn't take long to get used to it.  I learned how to use Terragen 2 in about 7 hours (not straight, though) simply by messing around and looking at other tutorials for it.  Let's start with the interface now:


As you can see, there are 5 main sections in the interface.

1.) 3D Viewport - This is where you can see the product of your work; the aspects that are displayed in it vary depending on what you're doing to the landscape

2.) Node Configuration - I'm sure you've heard of Blender's compositing nodes by now (unless you've never used blender before); and it's other nodes: materials and textures.  This is similar in a way, except that this time, the nodes control the entire scene.  As you can see, it has multiple different categories in it: Atmosphere, Cameras, Lighting, Objects, Renderers, Shaders, Terrain, and Water.  There are several nodes that can be used to control those specific elements.  Of course, a lot of things you can do with the nodes, you can do in the properties panel on the left.  But there are some advantages to the node set up, and we'll delve into these later.

3.) Properties - This is where most of the magic is; the properties panel is what you use to do almost anything to your landscape.

4.) Outliner - The outliner is exactly the same as it is in Blender; it simply displays a list of everything involved in your scene, with a small amount of interactivity.

5.) Toolbar - Whatever option you choose on the toolbar will display its properties in the Properties window, as covered above.

Of course, there are multiple other options in Terragen 2, but these were the major parts of it.

Let's move on to the navigation controls.  The main one you'll want to know is rotating your view.  This is done by dragging your middle mouse button, just like you'd do in blender to achieve the same effect.  You can also zoom out, but it's actually reverse; when you scroll your mouse wheel in, you zoom out, and vice versa.  These a re the only two shortcuts I use, as I rely on the navigation panel for the rest of it.  This is located in the upper right corner of your 3D viewport:


As you've probably noticed, these controls are fairly straightforward, so I don't need to go into too much detail on them.  

Another thing is, if you move your view around a little, and like the new position, you need to copy the location to the current render camera.  If you don't press this button, when you render, it will render the position you were originally in before moving, so be sure to press that button.


And that's it for the interface!  I hope you enjoyed this quick little tutorial, and I'll be releasing one on how to generate an actual landscape next (probably within the next hour or so).  Thanks for reading!

Saturday, December 11, 2010

How to use the Ivy Generator with Blender 2.5

Hello, everyone!  In this tutorial, I will be teaching you how to use the Ivy Generator with Blender 2.5.  The Ivy Generator is a separate application, not an add-on in Blender, so here's the link: http://graphics.uni-konstanz.de/~luft/ivy_generator/

This is the final result of this tutorial (with a few tweaks and post-processing):



The installation process is fairly straightforward, but when you're trying to open the application, it might get a little confusing.  Once you've installed it, and extracted the files so they are no longer in a zipped folder, what you need to do is go into the 'bin' directory, and the application is right there.  I recommend creating a desktop or taskbar shortcut so you don't have to relocate it wherever it was that you installed it.

However, there's still one more thing you need to install, and that's this folder of textures located as shown below:


Just scroll to the bottom to find them (don't mind the strange fact that these textures take up more space on your computer than the Ivy Generator did :P)

I'm basically going to re-create a tutorial made by Tim Ellis on the Ivy Generator (you can find it right underneath the textures above), but as there have been some changes between 2.49 and 2.5, that tutorial doesn't work any more (at least, the materials part doesn't).  So I'm going to fix that problem, make your render times 3 times faster than they would have been if you followed the other tutorial, and show you the basics of the generator as well.

So let's get started!

First, open up the scene you want to generate Ivy on.  In this case, I have this pillar here that I will be generating my ivy on.


What we need to do is select the object(s) that we want our ivy to cover (don't mind my lighting setup)


Next, click on File at the top, hover over Export, and select Wavefront (.obj).  You will be confronted with a window that is almost the exact same as when you save a file (so you should be familiar with most of the settings on it).  On the lower left, enable Selection Only, Normals, and Triangulate.


Now choose the location you want to export your object file, and then confirm it.  Now open up the Ivy Generator.


The controls may be a little confusing at first; they are as followed:

Dragging the left mouse button will rotate your view; sort of like what it would be like if you rotated the camera in Blender while in camera view.

Dragging the right mouse button will zoom you in and out.

Holding shift and dragging the left mouse button will rotate your view around the object


Holding control and dragging the left mouse button will pan your view (like it would if you held down shift and dragged the middle mouse button in Blender)

Now click on the option Import obj + mtl, and locate your object file.  At first, you won't see anything, but all you have to do is slightly adjust your view using any of the given controls above and it will refresh the viewport.


The functions are also a little confusing, but after you mess with them for a while, they'll start to make more sense.  For now, the only thing I'm going to tweak is the size.  I'll just raise it a little, as my ivy is a bit too small.  Once you've tweaked all the settings you want, double click anywhere on your object.  This will assign a root point for the ivy to grow from; a little green box will appear where you clicked.


Now click the big Grow button on the right, and you get to watch your ivy grow!  Keep in mind that the more ivy you have, the higher your poly count will be, so don't go too far.  Sometimes, the ivy will stop growing on its own, but most of the time you have to click the Grow button again to stop it.


If you're not happy with your ivy, stop the growth by clicking Grow again, and double clicking somewhere else.  However, if you're happy with your growth, click on Birth to create the actual geometry.


Now all you have to do is export your file by clicking the Export obj+mtl, and choose your file location again.

Just a quick notice, if you've double clicked somewhere, and you've started the growth, but don't see anything, it means the ivy is growing on the inside of your mesh.  To fix this, all you need to do is press the Flip Normals button up at the top (by the import and export options).

Now open up blender again, and load your previous scene (the one you exported into an object file before the ivy generation).  All you need to do now is import the ivy object file, and you should get something like this (in my case, I actually had more ivy than I wanted):


You may be thinking, that doesn't look anything like ivy.  Well, you're right.  That's because the ivy leaves are simply triangulated planes (planes with two triangles on each).  We need to assign them their textures in order to get them to be rendered as actual ivy leaves.  If you rendered now, you'd get this.


It looks terrible.  There are no ivy leaves, just grey planes, as I said above.  What we need to do is use the textures that we downloaded earlier, and insert them into the right materials.

We'll start with the leaf_adult material that you'll find if you go to the materials panel.  Go into the textures panel, and rename the current texture Color_A (A stands for adult, in this case).  Press the button to open an image, and locate the textures you downloaded earlier (created generously by Tim Ellis), and open efeu1.jpg.  Make sure that under the Mapping tab, the coordinates are set to UV.  Now scroll down to the bottom and enable Color under the Specular category.


Now add a new texture, and name it Normal_A.  Make it an image texture with UV coordinates, and open the image efeu1_Norm.jpg.  Under Diffuse, turn off Color, and under Geometry, enable Normal.  Then, under Image Sampling, enable Normal Map and set the type to Tangent.


Now add another texture, and name it Specular_A.  Set the type to image, and the coordinates to UV.  Load the texture efeu1_rough.jpg.  Disable Color under the Diffuse category, and enable Intensity under the Specular category.  Set the value to -1.


Now add another texture, and name it Mask_A.  Set the type to image, load the image efeu1_trans.jpg, and set the coordinates to UV.  Under Diffuse, disable Color and enable Alpha.  Set the Alpha value to -1, and enable RGB to Intensity.


Now add one more texture, and name it Bump_A.  Change the type to Image, load the image efeu1_Bump.jpg, and set the coordinates to UV.  Disable Color under the Diffuse section, and enable Normal under the Geometry tab.


Now go back to the Materials tab, change the diffuse type to Oren-Nayar, lower the Specularity to 0.057, and set the Hardness to 100.


Under the Shadow panel, enable Resieve Transp, so the leaf texture will cast a shadow, and not the whole plain.  And last but not least, enable transparency, and lower the alpha to 0.  The rendertime saver was here, as Tim Ellis had enabled RayTransparency in his tutorial.  It probably would have worked in 2.49, but it doesn't in 2.5, and you get really bad results and a longer rendertime if you change the type to RayTransparency.  That's why we kept it on ZTransparency.

Now simply repeat these steps for the other two materials (leaving out the transparency stuff on the branch material), and render it!  That's it, and I hope you enjoyed this tutorial!

If you rendered now, you should get a result like this:


If you have any questions, comments, or you encountered any problems while following this tutorial, post them in the comments below, or email me at ben.amend@gmail.com.  Thanks for reading!

Thursday, December 9, 2010

How to Create a Glazed Doughnut in Blender

Hello, everyone!  In this tutorial, I'll be teaching you how to create a glazed doughnut in blender (yum!)

This is the final result of the tutorial:


This tutorial will teach you how to:

  • Create a realistic doughnut mesh
  • Create a realistic (and tasty looking) doughnut material, with no UV Mapping or image textures
  • Use color bands effectively
So let's get started!  I'll be using Blender version 2.55 beta, which can be downloaded here: Blender 2.55 beta

Begin by pressing X to delete the default cube, and Shift A to add a Torus.


On the toolbar to the left, change the Minor Radius to 0.65.  This will make the doughnut a lot thicker, and the doughnut hole a lot smaller.


Next, under the Shading title, click on Smooth.  This will make it so that the doughnut doesn't look so blocky and sharp.


Now on the right, go to the Modifiers tab (the one that looks like a wrench), click on Add Modifier, and select Multiresolution from the menu.


On the modifier, click the Subdivide button several times.  I've set my subdivisions to 4; whatever you set yours to depends on how much your computer can handle (and yes, mine can handle more than that ;).  This is adding more vertices and smoothing them out, to make the overall mesh much smoother.  After you've subdivided, enable the Optimal Display option.  The optimal display will make it so that when you render, it only renders the faces of the mesh that you can see directly from your point of view, and doesn't render the ones on the back that you can't see.  This speeds up render time and 3D viewport interactivity.


Now click on the Textures button (the button that looks like a checkerboard), and add a new texture.  Name it Displace.  Naming something isn't necessary, but it helps when you have multiple objects, materials, textures, etc. in your scene.


You'll notice that it creates a Clouds texture by default; that's okay, but we need to raise the Depth to 6 (the maximum depth value).  The higher you put the depth, the more detail the texture has.


Now go back to the Modifiers panel, and add a Displace modifier.


Click on the box underneath the Texture title, and select our Displace texture we made just a second ago.


You should now see a result as shown above; this obviously doesn't look anything like a doughnut.  The problem is, the displacement is too strong.  All we have to do is lower the strength down to about 0.05.  You should now see something like this:


We have simply added a tiny amount of detail to make the doughnut look a little more realistic.  But there's still one underlying problem; and that's that the doughnut is still too perfect because we need to add more displacement, but on a larger scale.  In other words, now that we've added some of the smaller bumps, we need to deform it.  A lot.

Start this by going into Top View by pressing 7 on your number pad, then 5 to go into orthographic view.  Before we switched to orthographic, we were in Perspective View.  This means that there's a vanishing point, hence the closer something is to your viewpoint, the larger is is, and the farther, the smaller.  This can be inconvenient while editing our mesh, so switching over to Orthographic View will make it much easier.


Press Tab to enter Edit Mode, then A to deselect everything.


Now press the O key to turn on Proportional Editing.  This way, if we select a couple Vertices (B for Box Select, then click and drag) and move them around (G), other vertices within a set radius (defined by the circle that appears when you move them) will follow it, but they will be drawn less and less the closer they are to the outer rim.  You can adjust the size of the circle by scrolling with your mouse wheel.


Just do this continuously until you think your doughnut is deformed enough.  Remember, if you want it to look realistic, it needs to have a relatively large amount of deformation, as doughnuts often get squashed up against the edges of the box and against other doughnuts.


Remember, since we're working in 3 dimensions, we need to go to the front and side views as well (Front - Numpad 1          Side - Numpad 3).  By now your doughnut should be well deformed, so now we're going to give it another displacement modifier.  But before we do that, we need to apply our current modifiers.  Do this by clicking Apply on both of the modifiers we've added.


Now add your new displacement modifier, and select the Displace texture again.  But this time, go back into the textures panel, and change the Depth to 0, and the Size to 0.5.  Back on the modifier, change the Strength to 0.05 again.

Now out doughnut's looking good, but it's too tall, so press S - Z to scale it down along the Z axis.


That's it for the mesh; now we need to move on to the materials.  Click on the Materials button on the right (the checkered sphere), and add a new material.  Name it Doughnut.  


First things first, set the diffuse Intensity to 1.  This will ensure that our material won't render darker than it actually is.  Put the Specular at 0.24, and the Hardness at 55.  This adjusts how much light our doughnut reflects, and how widely it reflects it.


Next, raise the Emit value to 0.1 (this will make it so that the doughnut is emitting a small amount of light), and enable Mirror.  Under the Mirror panel, set the reflectivity to 0.12, and the Fresnel to 1.8.  The Fresnel decides how much of the material is showing through the reflection.

You should now see something like this in your Material Preview Window:


Now go into the Textures tab, and add a new texture.  Name it Warp.  This texture will warp all of the other textures we're going to add.  Scroll down to the bottom, and disable Color, and enable Warp.  Set the warp value to 0.46.


Now under the Mapping panel, click on the boxes beneath Flat and change them all to Z.  You won't see any difference on the boxes, but this makes it so that the blend texture is going vertically instead of horizontally.  Make sure you do this with all three of them.


Scroll back up to the top, click on the channel underneath the texture we just added, and add a new texture there.  Name it Color, and change the type to Blend.


Under the Colors panel, enable Ramp.  We've just now added a color ramp; with this, we can control the colors in the blend texture, and how sharp the transitions are.  Click on the color band to the far left (you can't see it, but it's there), and click on the black box underneath it.  Raise the Alpha value to 1.


Now we can go in and adjust the colors, and add new ones as needed.  To add a new color band, simply click on the Add option right above the color ramp.  You can then change it's color, and move it around the ramp accordingly.  I won't go through every color band, but this is my result shown below.  Keep in mind that the colors you're seeing in the texture preview window aren't accurate; just pay attention to the way you see them on the actual ramp.


I lowered the alpha value on the really light spot in the middle simply because I couldn't seem to get the color right, so I had to adjust both the color and the alpha values to get the result I wanted.

Now at the bottom again, enable Displace, and raise that value to 0.13, then raise the Normal value to 5 (but don't actually enable the normal).  This will use the color ramp to displace our mesh even more.  Also, if you're using 2.56a or newer, make sure you enable 'Old Bump Mapping'.  Any texture we add where we use the Normal slider, enable this or you may experience a few problems with your textures.


Now add a new texture, change the type to Voronoi, and name it Bump 1.  Now enable the Ramp option again, to allow us to work with the color bands, and switch the color bands around, so that the black is on the left, and the white is on the right.


Now scroll down to the bottom, disable Color and enable Normal (normal, to sum it up quickly, means 'bump'), and set the normal value to 0.25.


Now add another texture and name it Bump 2.  Lower the Depth to 1, raise the Size to 1.55, and enable Ramp so we can work with the color bands yet again.  This time, drag the black one up really close to the white one. This will sharpen it.


At the bottom, keep Color enabled, and also enable Normal.  Drop the color value to 0.065, and drop the Normal value to -0.5.  


Now add one more texture (last one; hang in there!), and name it Bump 3.  Put the Depth at 0, and the Size at 0.65.  Enable the color ramp again, and drag the white a little closer to the left, and drag the black a lot closer to the white, as shown below.


Enable Normal, and raise the value to 0.84.  Lower the Color value to 0.18.


That's it!  If you take a look now at your Material Preview Window, you should see something like this:


If you render now, you should get something like this (results will greatly differ depending on what sort of lighting setup you have):



If you wanted to take this image a little farther, I'd recommend you enable Subsurface Scattering (SSS).  I had to tweak the settings on it a bit, but in the end it turned out.

So that's all!  You've just learned how to create a relatively tasty looking doughnut in Blender!  You may want to mess with a few things; typically the cleaner the mesh, the more tasty it looks, so try different levels of detail and see what you come up with.

If you encountered any problems, or have any questions or comments, post them below.  If I haven't responded for a while, send me an email here: ben.amend@gmail.com