Wednesday, July 21, 2010

Blender Tutorial: Creating lemons!


Hey there!  In this tutorial we're going to take a step by step approach to creating a lemon in Blender 2.5.


Modeling the lemon (basic vertex pulling)

Lets start by deleting the default cube (X).  Add a UV Sphere (Shift+A>Mesh>UV Sphere).  Hit T to bring up the toolbox.  In the Operator panel (called "Add UV Sphere" in this case) change both the "Segments" and "Rings" values to 12.


Go to Edit Mode (Tab) and, with all vertices selected (A), scale the sphere up along the Z axis (S+Z).


I now hear you cry out in distress, "It dosen't look like a lemon, it looks like an egg!!!".  Lets fix that.  Turn on Proportional Editing (O <-- that's an O not a zero).  Using the box selection tool (B), select 2 rings of vertices, one at each end of the lemon.  Now scale them (S) a little bit outwards.  Remember to play with the scroll wheel to adjust the proportional influence of the transformation.


That looks a little more like a lemon now.  Finally, with all vertices selected, hit "Set Smooth" in the toolbox.


Sculpting the lemon (O_o details!?!?!?)

A lemon is not perfectly round. So, we're going to bring the it into Sculpt Mode and give it some details and imperfections.  Down in the Mode selector drop down menu (bottom header of the 3D View) change it to Sculpt Mode.  But before we can sculpt, we need to do one more thing; add a Multiresolution modifier.

So lets go ahead and do that. (Modifiers settings>Add Modifier>Multiresolution):


Hit the "Subdivide" button three times.  That should give us enough polygons to sculpt with.

We've come to the fun part.  This is where you can just let your imagineation go wild.  I would suggest looking up a picture of a lemon to use as a reference image, and sculpt based of that.  More ideally, you can use real lemon (raid the fruit basket!!!).

Lets start sculpting.  This part of the tutorial can't be discribed step by step, so I'll just show you the general things I'm doing to my lemon.

First, using a combonation of the Draw and Smooth brush, I'm going to plump out the middle of my lemon.


Next, I'm pulling out the tip of the lemon using mainly the Draw brush.


...and the other end of the lemon...


Now I'm going into detail.  You might want to click the "Subdivide" button on the Multiresolution modifier again just so you have a few more polys to work with.  Some detail on the 'bottom' of the lemon:


And finally some general shaping to make the object look more organic.


Finished!  On to texturing.


Texturing the lemon part 1  (colour!!!)

We're actually going to use Blender to create the most of the lemon texture.  First, SAVE YOUR FILE!!!  Then open up a new Blender (Ctrl+N).

If you look at your reference image, you'll find that (if you look closley enough) lemons are covered with a random assortment of dots.  How do we go about making a random assortment of dots?  Particles!  Once again, get rid of that default cube....because we need a plane.  So Shift+A and make a plane.  Go to top view just so we can see what we're doing (NUMPAD7).  Over in the Particles settings, add a particle system and copy down these settings:

Amount: 6000
Start: 0
End: 1
Dissable "Even Distribution"
Enable "Jittered"


Now we're going to make each particle render as a little circle, rather than a halo.  Add a circle.  In the toolbox, set "Vertices" to 12.  Also enable "Fill".


Scale that circle down to .1 (just type in a value while transforming).  The circle needs to be coloured, so go to the Material settings and click that big button that says "New".  Set the Diffuse colour to #6F8B1C  (<-- that's Hex...just copy/paste it into the "Hex" feild in the colour chooser).  Also, enable "Shadeless".


(and no, your material preview should not have a smiley face on it...I added that)

Next we're going to make each particle render as a circle.  Select the plane (RMB - Right Mouse Button) and, back in the Particles settings, find the Render panel.  Toggle "Object" and select the circle from the "Dupli Object:" dropdown menu found below (mine was called Mesh.001)  Also, uncheck "Emitter". (so that the plane won't render as a solid object)


Yet again I hear you cry out in dismay, "The circles look like lines and not circles?!?!?!".  No sweat.  Rotate the cricle object 90 degrees along the Y axis (R+Y+90).  Now we're ready to render this texture.

Select the camera and clear location and rotation (Alt+G, Alt+R).  Move it up along the Z axis approx. 4 units.  In the Render settings, change the resolution to 1024x1024 and enable "RGBA".


Now switch to the Object Data settings for the camera.  Toggle "Orthographic" and change the "Scale" value to 2.


It's render time!!  Hit F12 and see what happens.  You should get something like this:


Alright, we've got some randomly placed dots, time to bring it into GIMP.


Texturing the lemon part 2 (a little GIMPing)

If don't have GIMP installed, you can download it from here ---> http://www.gimp.org/  You can also use Photoshop if you're more comfortable with that application.

Lets start by opening up the texture in GIMP.  First we need to make the background yellow, so in the layers dialog, hit the "Create new layer" button and select "White" in the pop up window.  Then move the layer down one step by hitting the "down" button (when it becomes avalible, it is greyed out in the image.)


Next, select the "Bucket Fill" tool (from the Toolbox or hit Shift+B) and chose a yellowish colour.  (I used #FFDB00)  Click in somewhere on the image and watch the yellow appear.  Select the original layer (click on it) and go Filters>Blur>Gaussian Blur.  Change both the "X" and "Y" values to 6.

One last thing before we get back into Blender, with the dot layer still selected, go Colors>Levels, change the "Channel" to "Red" and set the "Input Levels" slider to about 1.5.  (or whatever you think looks more lemonie...)


You can also play with the "Opacity" slider (in the Layers dialog).  I set mine to around 60, just so the dots blend in more with the yellow.

Alright, the base texture is completed.  SAVE YOUR FILE!!!!!  Time to UV unwrap the lemon.


UV Unwrapping

Back to Blender now.  Select the lemon and go into Edit mode.  Go to top view (NUMPAD7).  While holding down an Alt key, right click on the edgeloop on the back of the lemon.  (if you're on Ubuntu, this may not work.  As an alternative, you can select two vertices of the edgeloop, go Ctrl+E and select "Edge Loop")  Now hit Ctrl+E and select "Mark Seam".


In the Timeline below the 3D view, change the window type to UV/Image Editor.


Make sure all vertices are selected (A) and, with your mouse in the 3D view, go U>Unwrap.  What just appeared in the UV editor is your UV layout, but it dosen't look quite right.  Remember Proportional editing mode?  Yeah, we're going to use that again.  Turn it back on if it isn't still enabled.  Select a vertex in the middle of the UV layout and hit S.  (remember to use the scroll wheel to change the proportional influence)  Make the UV's look like this:


Now move the UV's around (scale or rotate too) to get them to fit nicely into the lighter grey grid.  Go Image>Open, navigate to your lemon texture an open it.  With your mouse in the 3D view, hit Alt+Z to enable textured draw mode.  Looks lemonie eh?  Lets make it look even more lemonie. (I wonder if lemonie is even a word....?)


Texturing the lemon part 3 (Texture painting!!!)

With our beloved lemon selected, go into Texture Paint mode (remember that dropdown menu on the bottom header of the 3D view?).  This section of the tutorial, like the sculpting part, can't really be explained step by step.  All we're doing is painting some imperfections onto our existing, perfect texture.  But first, we need to do some cloning to get rid of that nasty texture seam at the back of the lemon.  I already wrote a tutorial about cloning, so to reduce the size of this tutorial, I'll ask you to refer to it for step by step instructions on how to use Blender's clone tool.  You can find the tut here --->  Blender Tip: Removing texture seams

First I clone away the texture seam.  (remember not only to save your blend file often, but also SAVE YOUR IMAGE as well (Image>Save)


Next, some subtle colour variation using a low strength draw brush.  (dark yellows, greens and browns)  My subtle colour variations are so subtle that you almost can't see them.  So no point in showing you a screen capture.

Now for some serious colouring.  Turn up the Strength value.  Starting with the tip:


...the other end...


And finally, some dents and bruses that some lemons suffer on their journey from tree to grocery store :)


The texture is now 100% complete.  Yay!  Here's what mine looks like:




Materials part 1 (basic settings, adding the texture)

Go to the Materials settings for the lemon and click the "New" button.  You can name the material if you like.  Copy these settings:


Diffuse Intensity: 1
Specular Intensity: .5
Hardness: 150


Now in the Texture settings, add a new texture, name it, and change the "Type" from "Clouds" to "Image or Movie".  Load in the lemon texture using the dropdown beside where it says "New" and set the texture to map to "UV" corrodinates.


Lets do a test render now.  Add a plane and scale it up a bit.  Move the lemon up so that it just rests above the plane.  Also, position the camera to get a better view.  (go to camera view, select the camera (right click on the outermost outline) and use G to move it.  Also, use Shift+F to zoom.)


Now enable "Ambiant Occlusion" and "Environment Lighting" in the World settings.


It's render time!!!!  Finally, something to show for our efforts.  (I hear you shouting YAY!!)  Hit F12 and be prepared to wait a while (depenging on the speed of your CPU) as Ambiant Occlusion is a time consuming rendering process.

Well, it does look like a lemon, but let's make it look even more like a lemon.


Texturing the lemon part 4 (Bump maps)

Find your lemon texture image in a file explorer and copy to the same location (duplicate it).  Name it something meaningful like "lemonBump".  Open it up in GIMP.  Go Colors>Desaturate and chose the "Luminosity" option.  Now go Colors>Brightness-Contrast.  Change the "Brightness" value to -60 and "Contrast" to 80.  You may need to use slightly different values depending on the initial values of your texture.  The idea is to get a high contrast B&W image that looks something like this:


Back in Blender, were going to use this new image as a bump map.  Click the texture channel below the first lemon texture and add a new texture datablock.  Name it something so you can tell easily it apart from the color map.  Load in the bump map and once again, map it to UV coordinates.  Finally, in the "Influence" panel, unclick "Color" and click "Normal".  Set "Normal" to -2.

We'll need another bump map as well.  Select a new texture channel and add a new texture.  We're going to use the default "Clouds" texture this time.  In the "Mapping" panel, keep "Coordinates:" set to "Generated" but set "Projection:" to "Sphere".  In the "Clouds" panel, set the "Size" variable to .15 and "Depth" to 4.  Set the "Normal" influence to .8.

Now try rendering.  Looks good eh?  One last thing.



Materials part 2 (Subsurface Scattering)

SSS lets light penetrate the surface of the model making a polagonal object look soft and organic.  Go to the Material settings and enable "Subsurface Scattering".  Copy down these settings:


IOR: 1.3
Scale: .013
[colour selector]: #DAB600
Color: .7

Go ahead and hit F12.  We're finally finished!!!!!  YAY!

I hope you learned something from this tutorial.  Feel free to leave a comment if you have a question, or if you want to share you own lemon render.  Happy blending :D

(final render with adjusted lighting)

2 comments:

  1. Nice! Thanks for the tutorial; it was very clear, and I didn't have any trouble following it.

    ReplyDelete
  2. Great tutorial, very informative; I shall have to try this out!

    ReplyDelete