Showing posts with label Materials. Show all posts
Showing posts with label Materials. Show all posts

Tuesday, December 14, 2010

The Basics of Terragen 2 - Part 4

Hello, everyone!  In this tutorial, I'll be covering the materials of our landscape, or Shaders as they are (inaccurately) termed in Terragen 2.  I'll be using the same landscape that I used in our last tutorial on Rendering (you can find that here).

This is the final result of this tutorial (rendered, obviously):


So let's get right into it!

Begin by clicking the big Shaders button on the toolbar at the top.


In the outline, you'll see something that says Base colours.  This is, as it states, the base color of our landscape; it's the color that's being displayed when we render our scene.  Some people use it, and some don't.  In this case, I won't; click on Add Layer and choose Surface Layer from the menu.


In the 3D viewport, your whole landscape will be shrouded in white.  Or at least, it looks like white; it's actually just a light gray.  We're going to make this layer our dirt (every landscape should have at least a tiny bit of dirt; it looks more natural), so name it dirt in the box next to the word Name.


Next, choose a color for your layer by selecting the box with the gray color in it, and changing it to a dark brown.


Now click on the + button next to the Color Function box, and go to Create New Shader - Color Shader - Power Fractal v3.  This will add color variation, and break up the dirt a little more to make it look a lot more realistic.


Now that the dirt's done, we can add on another surface layer; so let's do that.  Add another Surface Layer, and name it Grass.  Select a green color in the color box, and give your grass a Power Fractal v3 shader as well.


But there are two problems here; one is, we want to be able to see some of our dirt poking through the grass (I know it sounds like it should be the other way around, but I know what I'm doing :D), so go to the Effects tab in the properties panel, and enable Intersect Underlying.


If we take a look at our 3D Preview window, we should see something like this:


As you can see, the dirt is breaking through the grass based on slope angles; this is especially handy when creating a snow-capped mountain (or even just a mountain completely covered in snow) and you want the rock underneath to poke through.

Let's add another Surface Layer; name it Rock, and select a dark grey color from the color box.  Give this one a power fractal shader as well.  You'll notice that the rock is covering the entire mountain, but we only want it to cover a certain portion of it, and starting at a certain point in elevation.  This can be fixed by going into Altitude Constraints and selecting Limit Minimum Altitude.


The Minimum altitude determines what height we should limit the rock to, and the Min alt fuzzy zone is what controls how sharply we want the grass and the rock to blend together.  In my case, the defaults work fine (surprise, surprise!  That's a first :D), but you may need to tweak the altitude a little bit until you're happy with it.


As you can see, the rock now only starts at a certain altitude, instead of covering the entire mountain.  I'm going to add a snow layer on top, but I won't describe everything I do with it, as I'll be using the Intersect Underlying option and the Limit Minimum Altitude as well, and I just covered these two aspects.


And that's all!  I hope you enjoyed this tutorial, and if you have any questions, comments, or encountered any problems while following this tutorial, post them in the comments below or send me an email 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

Monday, August 23, 2010

How to Create a Lightsaber in Blender - Part 2 (Materials)

Hello again!  This is the second part of the lightsaber creation tutorials; in this tutorial, I will be teaching you how to add materials to the handle, and how to create the blade.  I am using Blender version 2.53 beta in this tutorial.

This is the final result of this tutorial:


So let's get started!

First, open up your previous .blend file with the handle in it.  As you can see in this image, I have rotated the handle and moved it around to produce the final image shown on the last tutorial.



To put it back to it's original position, I'm going to clear it's rotation (Alt R), clear it's scale (Alt S), and clear it's location (Alt G).  Now when I go back to front view (Numpad 1), I'll see this:


Next we're going to deselect the handle (A), and zoom out (Scroll your mouse wheel or use the '-' key).  Pan your view up some (Ctrl - Numpad 8) so you get something like this:


Ass you may have guessed, we're now going to work on the blade.  Add a plane (Shift A - Mesh - Plane), and go into Edit Mode (Tab).  Go to the top view (Numpad 7), and deselect all of the vertices (A).  Add a loop (Ctrl R) in the middle of the plane as shown below:


Now invert the selection (Ctrl I), and delete the selected vertices (X).  Go back into front view (1) and zoom out some.  Rotate the line 90 degrees along the Y axis (R - Y - 90), tab back into Object Mode, and move the line up along the Z axis (G - Z - 35).


Now scale it up along the Z axis (S - Z - 20).


We're going to give the blade it's materials now.  Click on the materials button on the right side of the window:


Click on the big button that says 'New'.  Next, select the button that says 'Halo'.


Now go go into Edit Mode (Tab), and subdivide the blade (W - Subdivide).  On the left, set the number of cuts to 10.  Next, subdivide it again, and set the number of cuts to 5.  If we tab back into Object Mode now, we should see this:


Now, back in the materials panel, raise the 'Add' value to 1 (the maximum), and change the color from light-grey to white.


Now, we won't have an exact idea of what we want the halo size to be until we render it, so we'll leave the material settings at that for the time being.

Moving on, we're now going to duplicate the blade (Shift D - Right Click).  Now scale the second blade up slightly (S - 1.03), and subdivide it once.  There's a small '2' next to the name of your material; click that to make the material a single user.


Now make the color of this material the color you want your lightsaber to be; I'm going to make mine blue.  Next we'll work on the handle materials.  Select the handle, and press the 'Add' button to give it a new material.  I'll just be giving it a basic shiny metal material; set the specularity's intensity at 1 (the maximum value), and set the Hardness value at 100.  Next, change the specularity type from 'Cook-Torr' to 'Wardiso'.  Finally, enable Tangent Shading, and make the material a darker grey color.  Your material settings should now look like this:


Now tab into Edit Mode, and zoom in on the two rings and the upper part of the handle.  Select these portions of the mesh:


Add a new material, click the little '2' again, name the new material 'Gold' and the other material 'Silver'.  Now change the color of the Gold material to gold, and click the 'Assign' button at the top of the materials panel.  If you tab back into Object Mode, you should see that the edges of our rings are now gold:


Tab into Edit Mode again, and deselect the rings (A).  Add a new material by pressing the '+' button, click the '2', and name the new material 'Black'.  Change the color to black, deselect 'Tangent Shading', change the specular type back to Cook-Torr, set the specularity intensity at 0.1, and set the hardness value at 50.  Your material settings should look like this:

Now select the parts you want to be black.  I'm changing these parts:


Click 'Assign' once you've selected the parts you want.  I've noticed that the black is leaking into a part that I want to be silver:


This can be fixed by adding a loop underneath it:


Now deselect the loop (A), and select the lightsaber button by pressing 'B' on your keyboard and dragging a box around it with your mouse.  Add a new material by clicking the '+' button, click the little '2', rename the material 'Red', change the color to red, and click 'Assign'.

Congratulations!  You have just finished part two of this tutorial series!  In the next part I will be showing you how to light and render the lightsaber in a simple scene.  If you have any questions, comments, or problems, post them in the comments below.  Thanks for reading!