3D Workflow for Designers & Art Directors: Textures

In the real world, pretty much everything has texture; fabric has texture, art has texture, music has texture, even the quality of life has texture.  But in the realm of 3D renders, texture has a very specific and limited definition. A “texture” is a 2D image that is mapped to the surface of a 3D object in order to control variations in color, reflectivity, transparency, specular highlights, sub-surface scattering and perturbations in the surface itself.

When a 3D object is rendered, 3 attributes inherent to that object influence it’s appearance more than any others.  The shape of it’s mesh, the material that’s applied to it, and the texture that’s mapped to it’s surface. Lighting, which certainly influences an objects appearance in a render, is an external influence.

MATERIALS VS TEXTURES

Before we really get into textures, we need to understand the difference between “materials” (also called “shaders”) and “textures”. “Materials” are just that; some type of matter from which the object is constructed. It could be steel, rubber, glass, stone, wood, chrome, paint, formica, plastic or paper…just about any material that actually exists in the real world. Or in your imagination.

Some complex objects that are constructed with a number of individual components might have different materials applied to each of the components. A car, for instance, will have a “rubber” material applied to the tires, “glass” applied to the windshield, “auto paint” and “chrome” applied to body components, and “leather” and “plastic” applied to interior components.

A material (or shader) will have a variety of attributes that describe it’s appearance.

  • Is it glossy or flat?
  • Is it reflective?
  • Is it transparent?
  • What color is it?

When building a material, there are a number of ways to determine it’s color (as well as all the other attributes, but we’ll get into those in the “Shader” post). You could just simply pick a solid color, in which case the entire object is all one solid color.

But there are many instances in which the object is not a solid color. The grain in wood or marble, for instance. The images, text and graphics on a package. A custom paint job on a car, with pin striping and flames. This is where a texture comes in. The texture, which is a simple 2D bitmapped image, would be used to control the variations in color across the surface of the object.  Textures, therefore, are a component of a material and are used to describe the “color” attribute of that material.

But textures can also be used to control any attribute of a material where the value of that attribute changes across the surface of the object: examples could be the reflectivity, the transparency and surface deformations using bump maps or displacement maps.

UV MAPS & TEXTURES

In order to accurately map a texture to the surface of an object, that object must first be UV mapped (see UV Mapping post). The mesh of an object is “unwrapped” and flattened so that it corresponds to a 2D image. Every point on an object is assigned a coordinate in UV space, and the pixel that corresponds to that coordinate is mapped to that location on the surface of the mesh.

For example: Here is a cube with a flat material applied to it.  A solid red color has been chosen as the material’s color attribute.

solid-red-cube

Here are the 3D coordinates of the cube’s mesh mapped to 2D space, showing the vertices, edges and polygons. This is called the UV map.

Cube_UV

Here is a bitmapped image that corresponds to the coordinates in the UV map. This image has a solid red background with the UV map overlaid.  A single white dot has been added which corresponds to the UV coordinates of a single vertex. This image (without the UV overlay) has been saved in a bitmap image format (.psd, .jpeg, .tga, etc.) and that file has been plugged into the “color” attribute of the material, replacing the solid red color.

Cube-color-map

On the left, the image below shows a selected vertex which has the same UV coordinates as the white dot; on the right the view from the UV editor shows the position of the selected vertex in UV space.  As you can see, the white dot maps to the same UV coordinates as the selected vertex.

red-cube-w_white-dot-UV

Finally, here is a render of the cube with the “white-dot-on-a-red-background” texture mapped to it.

red-cube-with-white-dot-render

TYPES OF TEXTURES

When plugging texture maps into a shader network, they can be used to describe almost any attribute of that material.  As a result, texture maps come in many flavors. To demonstrate this, we’ll take this simple scene and build shaders for the 3 different elements; the disk, the cube and the ground plane.

disk-White

Simple scene with 3 objects.

Here, I’ve added a material to the cube that has a simple green color plugged into the “color” attribute.

greenCube

Green material applied to cube.

Next, I’ve added a material to the ground plane that has a stripped texture in the “color” attribute.  This texture is a “procedural” texture, meaning that it’s NOT a bitmapped image, but rather is built by changing attributes in a procedural texture node.

stipedPlane

Material with striped purple pattern appied to ground plane.

To demonstrate the different types of texture types, let’s start by adding a material to the disk, and plugging a color map into the color attribute.

texture-type_disk-color

Material with a color texture map applied to disk.

Color texture map.

Color texture map.

Next, we’ll plug a reflection map into the “reflectivity” attribute of the material. Reflectivity is expressed by a value of 0 to 1; where “0” equals no reflectivity, and “1” equals full reflectivity. In the map, black equals a value of “0”, white equals a value of “1” and grey values equal values between 0 and 1. By studying the reflection map, you can see that there is full reflection (white pixels) at the bottom with the words “REFLECTIVITY MAP TEST” having no reflectivity (black pixels).  Then the reflectivity fades out to nothing, with an area that represents the transparency test having full reflectivity. You can see these values expressed in the render.

A reflection texture map has been added to the disk material.

A reflection texture map has been added to the disk material.

texture-type_reflection-map

Reflectivity texture map.

Now for transparency.  A transparency map is plugged into the “transparency” attribute.  Like reflectivity, transparency is expressed in values ranging from 0 to 1, with “0” being opaque and “1” being fully transparent.  Here, the map is opaque with an area of full transparency, inside of which the words “TRANSPARENCY MAP TEST” are opaque.  The small transparent circle in the lower right corner represents the back side of the disk in the UV map. In the render, you can see the ground plane and the the green cube through the transparent area, distorted by the lens shape of the disk. The transparent area is still reflective, though reduced by the transparency.

A transparency texture map has been added to the disk material.

A transparency texture map has been added to the disk material.

Transparency texture map.

Transparency texture map.

Finally, we’ll add a bump map (sometimes called “height maps”), which simulates variations in the height of the surface. In this case, we’re simulating the words “BUMP MAP TEST” being embossed off the surface of the disk.  Again, bump attributes use values from 0 to1, but “0” (or black) equates to no change in the surface elevation and “1” (or white) equates to a full change in the surface elevation.  The height of the change in elevation is determined by a separate numerical value, which can include negative values (for a de-bossed look).

A bump map texture has been added to the disk material.

A bump map texture has been added to the disk material.

Bump map texture.

Bump map texture.

As you can see, the final look of this object in a render is determined by building a shader which has 4 different texture maps (color, reflectivity, transparency & bump) plugged into the appropriate attributes and applying that shader to an object that has been accurately UV mapped.

These 4 type of texture maps are a small selection of the different types of attributes into which a bittmapped texture might be plugged. Other types could include: specular highlights, diffuse color, reflection color, transparency color, translucency (color & weight), ambient occlusion and displacement; to name but a few.

BUILDING TEXTURE MAPS

The key to building great texture maps is having a high-quality UV map. By exporting a UV map as a bitmapped image, you now have a template against which to build a texture. The foundation to great textures is a UV map that doesn’t distort the polygons by overly stretching them (which causes the pixels in the texture map to be equally distorted when mapped to the surface of the mesh). Since this is often impossible, especially when UV mapping organic shapes, the solution may be to distort the texture map when fitting it to the UV map, so that the texture is distorted back to it’s correct shape when applied to the surface of the map. There is definitely an art to this and can be labor-intensive.

Textures can be built in a number of ways. Pre-existing images, such as photo, illustrations or graphics, can be fitted to the UV map. New textures can be hand-painted in photoshop, using the UV map as a template. Or for really photorealistic textures, photos can be projected onto the surface of the model.  I’ll demonstrate each of these methods.

Simple Textures Using Pre-Existing Art

Hard-surface models of manufactured items are typically the easiest to UV map and these UV maps are usually distortion free. Client-provided artwork, such as labels, can be cut-up and easily pieced back together to fit into the UV map.

For example, on the left in the image below is a render of the mesh for an unusually-shaped battery case. On the right is the UV map for that mesh.  The lower portion of the UV map represents the 3 cylinders of the case where the label is placed.  Since the rest of the case is a single color, the remaining UVs are contained in a very simple map in the upper portion of the image.
build-texture_battery_01
On the left is the color texture map for the material that was applied to the mesh. The label area was built using client-provided artwork of the label. The rest of the texture map is simply black. On the right is a final render of the battery showing the label placed on the case.
build-texture_battery_02

Hand-Painted Texture Maps

When building the texture maps for the caricature of myself that I’ve been using as an avatar, I wanted a texture that was more cartoonish rather than realistic. A hand-painted texture fit the bill.

Below, the mesh that I built of my head, and the UV map that I generated of that mesh.
buld-texture_handPainted-01
Below, the color texture map that I painted in photoshop, and the final render. Since this mesh was an organic shape, by hand-painting the color texture map to fit the UV map, I didn’t have to worry about distortion of the texture map when applied to the mesh. Each different color of the map was painted on a separate photoshop layer, so that I could use adjustment layers to fine-tune each color as I pulled test renders of the scene.
build-texture_handPainted-02

Texture Maps Using Projected Images

This workflow involves creating an image in which a texture is layered over a render of the mesh, distorting it to fit, then projecting that image back onto the mesh. This projection is then “baked” to create a new image in which the texture has been re-mapped to fit the UVs of the mesh. This workflow has a couple of advantages: first, the texture fits the mesh perfectly. Second, all UV maps have seams; this process lays the texture across the UV map in such a way that no seam is visible in the render.

For this project, I had hired a model and took photos of her front, left and right sides to use as templates in building the mesh.  I also took photos of every square inch of her skin to use in building the color texture map, which I’ll refer to as a skin texture. The only way to achieve a realist skin texture was to project the photos of her skin onto the 3D mesh.

Here’s a quick overview of the projection process:

  • Set up a special camera in the 3D scene which would also be used as a projector.
  • Pull a render from this camera/projector and open in photoshop.
  • Small portions from several photos of the skin are pieced together and distorted so that they fit the render of the mesh.
  • This new image (with the skin textures) is then loaded into the camera/projector in the 3D scene and projected onto the mesh.
  • The result is then “baked” into a new texture, with the pixels mapped to their correct position on the UV map.
  • Back to photoshop, this new texture is opened and copied into the final skin texture file,
    which includes the UV map template of the mesh.
  • Everything but the relevant portions are masked out, and the first piece of a new skin texture is done.
  • Back in the 3D scene, the camera/projector was moved to frame the next portion of the mesh to be mapped
    and the entire process was repeated.
  • Iterations of this process were repeated until the entire skin texture was complete.

As always, the key is a very high-quality UV map. In the image below, on the left is the UV map for the mesh. In the middle is the first render from the camera/projector in the 3D scene that I brought into photoshop, with the mesh wireframe overlaid.  On the right is the first image (of the eyes and mouth) that I created for projection back onto the mesh in the 3D scene. Since this image was projected back onto the surface of the mesh with the same camera/projector that was used to capture the render, the image fit the mesh perfectly.

As always, the key is a very high-quality UV map. In the image below, on the left is the UV map for the mesh and on the right is the first render from the camera/projector in the 3D scene that I brought into photoshop, with the mesh wireframe overlaid.

buld-texture_projected-01

Left: UV map of mesh. Right: Render from camera/projector in 3D scene.

This is the first image (of the eyes and mouth) that I created for projection back onto the mesh in the 3D scene. Since this image was projected back onto the surface of the mesh with the same camera/projector that was used to capture the render, the image fit the mesh perfectly. Next is the result of baking out the texture map. Since the image is projected all the way through the mesh, the image repeats itself on the back side of the mesh. Finally, the image copied into the file with the UV map template. Everything except the portion that I need has been masked out. The green area helps to separate out area that are not yet textured in the test renders.

buld-texture_projected-02

Left: Camera/projector render with skin texture overlay.
Middle: Resulting baked texture.
Right: Baked texture in final skin texture file with UV map overlay.

The next few images will show a few interations of this process. On the left is the next render from the camera/projector in a new position, with the new image for projection. In the middle is the resulting baked texture, masked and copied into the UV template file, and on the right, the new texture combined with the first texture. Once all the textures are copied in, I’ll blend them together.

Left: Middle: Right:

Left:Camera/projector render with skin texture overlay.
Middle: Baked texture in final skin texture file.
Right: New texture combined with previous texture.

Repeating the same process from the right.

Left:Camera/projector render with skin texture overlay. Middle: Baked texture in final skin texture file. Right: New texture combined with previous textures.

Left:Camera/projector render with skin texture overlay.
Middle: Baked texture in final skin texture file.
Right: New texture combined with previous textures.

The next iteration capturing skin detail from below the chin.

Left:Camera/projector render with skin texture overlay. Middle: Baked texture in final skin texture file. Right: New texture combined with previous textures.

Left:Camera/projector render with skin texture overlay.
Middle: Baked texture in final skin texture file.
Right: New texture combined with previous textures.

Another iteration capturing skin detail below the upper lip, nose and eyes.

Left:Camera/projector render with skin texture overlay. Middle: Baked texture in final skin texture file. Right: New texture combined with previous textures.

Left:Camera/projector render with skin texture overlay.
Middle: Baked texture in final skin texture file.
Right: New texture combined with previous textures.

Here is the skin texture with most of the face copied in and blended on the left, and the resulting test render on the right. Here you can see how the green area shows the parts of the skin texture that still needs to be developed.

Left: Blended skin texture. Right: Test render.

Left: Blended skin texture.
Right: Test render.

The final skin texture for the head. The render on the right shows the completed material applied to the head; including reflection, specular and bump maps, as well as sub-surface scattering maps. One of the things worth noting in the skin texture: as much as possible all shadows have been neutralized in the skin texture. I want shadows coming from the lights in the scene, not from the skin texture.

Left: Final skin texture. Right: Test render.

Left: Final skin texture.
Right: Test render.

For any texture artists who would like to learn the projection method of building skin textures, I plan on posting a tutorial in the future which explains this process in detail.

FOR THE DIRECTOR

As the director of a 3D project, one of your responsibilities is to get high-definition samples of any texture or artwork to the texture artist; or to direct the texture artist in building an original texture. Remember that when applied to a material, lights and reflections will make the material look different than the original artwork and that the same texture will look different on different materials.

Also remember that you want light & shadow to come from the lights in the 3D scene, not from the texture.  So make sure that if you use photos, the lighting is very flat.

IN CONCLUSION

To get a texture to look great in a 3D render, 2 things are required; a superior UV map and high-caliber textures. Poorly mapped UVs are going to distort the texture, so it’s worth it to take the time to build a great UV map. And a texture is only going to look as good as the original artwork or photo used as the source of the texture. If a photo is slightly out-of-focus or grainy, that’s how it’s going to look in the render. If a low resolution texture is used in a high resolution render, the texture is going to look soft or pixelated.

 

Success, your comment is awaiting moderation.