Search This Blog

Labels

Sunday, December 5, 2010

Blender 2.5: Creating a UV Texture

Many times, objects contain numerous attributes that define how they look, and they're not always perfectly uniform in relation to the object. For example, a used paint can would have paint dripping down the sides of the can—if we were creating this can in 3D, we'd have to tell Blender that there is a specific spot on our 3D mesh that contains different attributes than the rest of the mesh. This is where UV mapping comes in handy. UV coordinates are, in simple terms, a two-dimensional representation of the texture coordinates of a three-dimensional object. They allow us to tell Blender specific properties about specific areas of our objects in a scene.

In this article by Aaron W. Powell, author of Blender 2.5 Lighting and Rendering, we're going to talk about creating custom textures for our scene and how to bring them into Blender. We will learn how to create a custom UV map and texture for an object in our interior scene.

Exporting our UV map

If we have GIMP downloaded, we can export our UV map from Blender to a format that GIMP can read. To do this, make sure we can view our UV map in the Image Editor. Then, go to UVs | Export UV Layout.

Blender 2.5 Lighting and Rendering

Then save the file in a folder you can easily get to, naming it UV_layout or whatever you like.

Now it's time to open GIMP!

Downloading GIMP

Before we begin, we need to first get an image manipulation program. If you don't have one of the high-end programs, such as Photoshop, there still is hope. There's a wonderful free (and open source) program called GIMP, which parallels Photoshop in functionality. For the sake of creating our textures, we will be using GIMP, but feel free to use whatever you are personally most comfortable with.

To download GIMP, visit the program's website at http://www.gimp.org and download the right version for your operating system.

Mac Users will need to install X11 so GIMP will run. Consult your Mac OS installation guide for instructions on how to install.
Windows users, you will need to install the GTK+ Runtime Environment to run GIMP—the download installer should warn you about this during installation. To install GTK+, visit
http://www.gtk.org.

Hello GIMP!

When we open GIMP for the first time, we should have a 3-window layout, similar to the following screen:

Create a new document by selecting File | New. You can also use the Ctrl+N keyboard shortcut. This should bring up a dialog box with a list of settings we can use to customize our new document.

Blender 2.5 Lighting and Rendering

Because Blender exported our UV map as an SVG file, we can choose any size image we want, because we can scale the image to fit our document.

SVG stands for Scalable Vector Graphic. Vector graphics are images defined by mathematically calculated paths, allowing them to be scaled infinitely without the pixilation caused when raster images are enlarged beyond a certain point.

Change the Width and Height attributes to 2000 each. This will create a texture image 2000 pixels wide by 2000 pixels high. Click on OK to create our new document.

Getting reference images

Before we can create a UV texture for our wine bottle, which will primarily define the bottle's label, we need to know what is typically on a wine bottle's label. If you search the web for any wine bottle, you'll get a pretty good idea of what a wine bottle label looks like. However, for our purposes, we're going to use the following image:

Blender 2.5 Lighting and Rendering

Notice how there's typically the name of the wine company, the type of wine, and the year it was made. We're going to use all of these in our own wine bottle label.

Importing our UV map

A nice thing about GIMP is that we can import images as layers into our current file. We're going to do just this with our UV map. Go to File | Open as Layers... to bring up the file selection dialog box.

Blender 2.5 Lighting and Rendering

Navigate to the UV map we saved earlier and open it. Another dialog box will pop up—we can use this to tell GIMP how we want our SVG to appear in our document.

Blender 2.5 Lighting and Rendering

Change the Width and Height attributes to match our working document—2000px by 2000px. Click on OK to confirm.

Not every file type will bring up this dialog box—it's specific to SVG files only.

We should now see our UV map in the document as a new layer.

Blender 2.5 Lighting and Rendering

Before we continue, we should change the background color of our texture. Our label is going to be white, so we are going to need to distinguish our label from the rest of the wine bottle's material. With our background layer selected, fill the layer with a black color using the Fill tool.

Blender 2.5 Lighting and Rendering

Next, we can create the background color of the label. Create a new layer by clicking on the New Layer button. Name it label_background.

Blender 2.5 Lighting and Rendering

Using the Marquee Selection tool, make a selection similar to the following image:

Blender 2.5 Lighting and Rendering

Fill it, using the Fill tool, with white. This will be the background for our label—everything else we add with be made in relation to this layer.

Keep the UV map layer on top as often as possible. This will help us keep a clear view of where our graphics are in relation to our UV map at all times.

Adding text

We're almost there! All we need to do is add some text. Before we do that, though, we want to make sure that our text is centered with our image. To do that, we need to add Guides in GIMP. To create a Guide, simply click on one of the rulers to the side of our image and drag.

Move the Guide until it's positioned 1000 pixels from both sides. We will use this to align our text.

To start, we need to create some title text for our wine bottle. For this tutorial, we are going to use the name Henrietta Blue. We want to create a feeling of elegance, so let's look for a font with curves and serifs. We're also going to want to use a different color for the word Blue to emphasize it, so we're going to have to use two separate text layers for the title—unlike Photoshop, GIMP doesn't support using multiple colors on one text layer.

Using the Text tool:

  1. Click within our image to add a new text layer.
  2. Type the word Henrietta.
  3. Change the font size to 68.
  4. Change the font color to black.
    Now we need to change the font to one that suits our needs. Change the font to the one you choose earlier—in our case, I'm going to use Didot Italic.
  5. Change the font to Didot Italic (or the font of your choosing).
  6. Move the font so it matches the position in the image below.

Save often!

Before we continue, we should save. Make frequent saves to avoid losing work. In GIMP, go to File | Save As and save the image as UV_texture.xcf. XCF is GIMP's extension for files, comparable to Photoshop'sPSD file type.

Now let's continue...

Now that we're sure our file is safe, let's continue. Duplicate the Henrietta text layer and move it over so it's on the opposite side of the Guide. Our image should now look like the following image:

But, remember our wine is called "Henrietta Blue", not "Henrietta Henrietta". Using the Text tool again, edit the text of our new text layer so it reads Blue. Then, change the color of the text to a blue hue—we can use the hex value #49a4e3.

Next, we need to create a logo for our wine brand. For this logo, we're going to use the design found on the flag of the Republic of Kosovo—make sure it's downloaded from the website athttp://www.cgshark.com/lighting-and-rendering.

Blender 2.5 Lighting and Rendering

Now that we have our "logo", we need to import it as a new layer into GIMP. To do this:

  1. Press File | Open As Layers.

    Blender 2.5 Lighting and Rendering

  2. Navigate to the folder where we downloaded the "logo" image.
  3. Press Open.

Now we can see that our "logo" has been brought into GIMP as it's own layer! Let's position it so it's directly below our Henrietta Blue text. To do this:

  1. Make sure GIMP's Move Tool is selected and click and drag our "logo" until it is positioned underneath our Henrietta Blue text, centered with the image.
  2. If needed, use the Scale Tool to make the logo smaller, so that it fits within our whitespace.

Our last step is to add what kind of wine our bottle contains. This can be whatever you choose—for the sake of this lesson, we're going to make it champagne. Using the text tool, create a new Text layer with the word "champagne", written in all-caps. Adjust the font so it's a nice serif font, like the one below.

Blender 2.5 Lighting and Rendering

Now all we have to do is position it properly and we're done! Using the Move Tool, position the wordchampagne so it's centered underneath our logo.

Summary

In this article we've created a custom UV map for our wine bottle. We used custom-made textures and mapped them to the wine bottle's UV set.

No comments:

Post a Comment