Bookshelf Contents Previous Next Glossary Index Search

Lesson 27: Texturing Polygons

The purpose of this lesson is to learn how to texture polygon models. You learn how to add texture to a game character using a variety of methods and you also assign textures to parts of the polyset. At the end of the lesson, you prelight the model to prepare color per vertex information for a video game environment. You can also export the finished model to VRML.

This tutorial is beneficial to gamers, VRML producers, and people who want to texture imported polygonal geometry.

Initial Setup

The lesson begins by opening an existing file so that you can concentrate on the mapping.

From the File menu, select Open. From the File lister, select the file named L27_polydwarf. Click Open.

A model of a polygonal dwarf opens. The dwarf is built in seven pieces. The model consists of two arms, two legs, a body, head, and helmet.

Using Shade mode

The Shade mode lets you tumble and dolly the camera and move the shaded geometry. It works very well for setting up polygon textures because you can always see the shader applied to a specific polygon. It also makes selecting polygons easier because you only see the polygons on the surface facing you.

Turn on Shade

  1. Click in the Perspective window to make it the current window.
  2. From the DisplayTgls menu, select Shade -. Set Windows to Current. This will shade only the current window. Turn Fast Options off. This option shows us the proper lighting and ensures that you can view textures later. Turn Interruptible off. This option sets the shade mode to prevent switching to wire frame mode while tumbling.
  3. Click Go. The Perspective window updates. The dwarf is shaded in the default blue.

Assigning Shaders to Polysets

A polyset is the equivalent of a NURBS surface. You can shade polysets in the same way you shade NURBS surfaces.

Pick the polyset

  1. Select Pick Object. Click on the polyset that represents the body to make it active.

    Assign the shader

  2. From the Windows menu, select Multi-lister Shaders....
  3. Click on the shader called tunic to make it active. From the Multi-lister's Shading menu select Assign Shader. The model updates in the Perspective window and the body is now brown.

    Assign the remaining shaders

  4. Assign the skin shader to the arms and head, the hat shader to the hat, and the pants shader to the legs, using the method outlined above.

Assigning Shaders to individual polygons

At this point in the lesson, all the complete polysets have been assigned shaders. You can also assign shaders to individual polygons within a larger polyset.

Pick the polygons

  1. Select Polygon Edit Pick Vertex. In the Right window, click-drag a pick box using the middle mouse button to pick the vertices that define the boots.

    Note: You can pick a polygon by picking all of the vertices belonging to a polygon. If you miss one of the vertices, the polygon remains unselected and you can't assign it a shader.

    Assign the shader

  2. In the Multi-lister, click on the shader called boots to make it active. From the Multi-lister's Shading menu select Assign Shader.

    The model updates in the window and the boots are now colored brown. The leg polysets now have two shaders assigned.

Shade more polygons

In the previous step, you picked a series of polygons by selecting surrounding vertices. You can also pick polygons by holding the Shift key and clicking on the polygon.

To make this task easier, you should template some geometry. Templating geometry lets you reference the geometry on your polyset.

  1. Select Pick Object. Pick all pieces of geometry except for the body.
  2. From ObjectDisplay, select Template. The grey color indicates that the geometry is templated.

  3. Tumble and dolly the view, so that you are looking down on the dwarf from his left side.
  4. Select Polygon Edit Pick Vertex. Press the Shift key. Click on the square polygon that is the base of the neck. While still holding the Shift key, click on the polygon right below it (the one which connects to the chest).

  5. In the Multi-lister, click on the skin shader to make it active.
  6. From the Multi-lister's Shading menu, select Assign Shader.

    Add hair to the dwarf's head

  7. Select Pick Object. Click on the dwarf's body.
  8. From ObjectDisplay, select Template. The body is templated.
  9. Select Pick Template. Click on the dwarf's head.
  10. From ObjectDisplay, select Template. The head is now available.

  11. Assign the hair shader to the appropriate polygons on the head polyset. You may have to tumble the view to find and pick the various pieces.

Projecting onto polygons

Assigning shaders to polygons works very well but you can achieve greater detail by using a texture map. Polygons, by default, do not have UV surface definition like NURBS surfaces; therefore the maps won't fit onto the surface in a logical way. The standard for polygon mapping is ST. By using a projection map you can map a polygon like you would map a NURBS surface.

You will use a projection map to map a logo on the dwarf's boots.

Untemplate the legs

  1. Select Pick Object. Click on the dwarf's head.
  2. From ObjectDisplay, select Template.
  3. Select Pick Template. Click on the legs.
  4. From ObjectDisplay, select Template.

  5. Tumble and dolly to view the boots up close.

Make a new projection shader

  1. In the Multi-lister, select Edit New Shader. Rename it Projecting. This shader is going to be used to set up the UV coordinates on the boot polygons.
  2. Double click on the shader to open the Shader editor. Click on the Map... button next to Color. The texture library window will open.
  3. From the Solid section, select Projection. The projection texture sets up the UV coordinates.

    Note: It is not necessary to use an actual texture file to complete these steps.

  4. In the Multi-lister, click on the projection icon button found next to the projection name. This turns the icon on so that you can see it in the modeling windows.

  5. In the Projection Texture editor, under 3D Placement, set Wrap to OFF. Turning Wrap off isolates the texture on the upper portion of the boot rather than repeating or tiling it.

Orient the projection icon to the geometry

  1. Select Pick Object and pick the projection icon in the Perspective window. The icon becomes bright yellow to indicate that it is selected.

  2. Select Xform Rotate. Enter 90 -20 90. You have rotated the icon so that it projects from left to right from the side of the dwarf.
  3. Select Xform Move. Enter 2.5 -0.25 0 at the prompt line. This will move the icon to the top of the boot.
  4. Select Xform Nonp scale. Enter 2 2.5 5 at the prompt line. This scales the icon to include both boots' side polygons.

    You must include the vertices of the boot polygons to ensure that they receive mapping coordinates. Anything outside the placement cube will not get mapping coordinates.

Apply the shader to the boot polygons

  1. Select Polygon Edit Pick Vertex. Press the Shift key and select the polygons that define the outer sides of the boots. You will need to tumble the view to pick both polygons.

  2. In the Multi-lister, click on the Projecting shader icon, then from the Multi-lister's Shading menu, select Assign Shader.

    You are applying this shader so that you can edit the mapping of the two polygons.

Apply UV co-ordinates

  1. In the Multi-lister, click on the Projection texture icon. In the Projection Texture editor, go to the Polyset Surface (U,V) Definition section and turn Clean Seams to ON and Normalize Seam to ON.

  2. Click Apply Mapping next to Project to UV. This option makes polygons behave like NURBS surfaces. Projection mapping effects the UV setup of the polygon.

Duplicate the boots shader

  1. In the Multi-lister, pick the boots shader. From the Multi-lister's Edit menu, select Copy.
  2. Rename this new shader boots_logo.
  3. Double-click on the new shader to open the editor. In the Shader Editor, click on the Map button next to Color, then choose Surface File from the Texture window.
  4. In the File's editor, click on the Browse button next to Image. In the File lister, choose the texture called L27_boots, located in the pix directory.
  5. With the boots_logo shader active, go to the Multi-lister's Shading menu and select Assign Shader. You will see the logo placed on the boot polygons.

    Note: If the textures do not appear, make sure that Fast Options is turned off in the Shade options under the DisplayTgls menu.

Adjust mapping

Now that the polygons have a UV type of mapping, you can adjust the shader's mapping parameters.

  1. Double click on the L27_boots file texture icon to open its editor. Under Label Mapping, change U and V coverage to 0.5 and U and V translate to 0.3.

    The texture is updated in the shaded Perspective window. If required, change these values to position the texture.

    The map behaves as if it were applied to a NURBS surface.

  2. Go to the Blur section and turn the Blurmult to 0. Next, go to the File Texture Parameters section and choose Off from the Filter menu.

    With the Filter option on, you may get a misleading perception of the final output in a VRML or game box scenario. If you plan to render this model in Alias instead of exporting to a gaming environment, you can leave these features on.

Working with a Decal Texture

When texturing for a gaming environment, one of the ultimate goals is to make sure that the number and size of your textures stays small. One way of accomplishing this goal is to create decal textures where a few elements can be applied on different parts of the model.

For the dwarf's face, you will use a decal texture to map the eyes, nostrils, and moustache. As you can see, the texture shows only one eye, the nostrils and the hair. You need to apply this texture to various pieces on the dwarf's head then set the UV mapping by hand to ensure that the texture is used efficiently.

The Texture Placement Window

Another solution for mapping polygons is the Texture Placement Window. This window lets you look at your polygons roadkill-style. That is, the texture is flat and the polygon vertices are laid flat on the texture so that you can pull and stretch to line up your textures.

The Texture Placement Window applies most to specialized applications where a low polygon count is essential.

You will also use what is called a decal sheet. A decal sheet is a conglomeration of textures. By putting a number of images together into one image texture, memory requirements can be reduced (this is of greatest concern to low poly count applications - someone texturing a high poly count model should not worry about decal sheets).

Template Geometry

  1. Select Pick Object and pick the legs.
  2. From ObjectDisplay, select Template. The legs appear as grey wires again.
  3. Select Pick Template. Click on the head.
  4. From ObjectDisplay, select Template. The head should be shaded.
  5. Tumble and dolly the view so that you see the underside of the dwarf's nose.

Duplicate the skin shader and assign it

  1. In the Multi-lister, pick the skin shader. Select Copy from the Edit menu in the Multi-lister.
  2. Rename this new shader dwarf_face.
  3. Double-click on the new shader to open the editor. In the Shader editor, click on the Map button next to Color, then choose Surface File from the Texture window.
  4. In the File's editor, click on the Browse button next to Image. In the File lister, choose the texture called L27_face_decal, located in the pix directory. This texture is the decal texture.
  5. From Polygon Edit, select Pick Vertex. Press the Shift key and click on the polygon that makes up the underside of the nose.
  6. Click on the dwarf_face shader to make it active. From the Multi-lister's Shading menu select Assign Shader. The model updates in the window but there appears to be no change to the nose texture. To fix this, you need to update the texture placement.

Use the Texture Placement Window

  1. From the File Texture, select the Texture Placement Window icon at the bottom right corner. It looks like a square grid.

  2. Use the dolly icon in the top right of the Texture Placement Window to dolly out and view the edge of the texture.

    You will see a white border around the texture and two yellow dots in the top right. The yellow dots represent the vertices of the selected polygon. This can be confusing, because the nose polygon has three vertices, yet only two are displayed. However, since the UV mapping of the texture has not been set, two of the vertices overlap.

  3. From the Texture Placement Window's Vertex menu, select Move. Click on the vertex in the top right. Drag the vertex within the texture window, until it lies just above the two nostrils.

    By moving the vertices around in the texture window, you are choosing the part of the decal texture that you want to apply to the nose.

    Note: The selected vertex will be the only active vertex in the texture window and the modeling windows. In this case, it should be the vertex at the tip of the nose.

Separating Overlapping Vertices

Vertices can be separated by switching the pick mode of the Texture Placement Window from TVert to Obj and switching back and forth from the texture window to the modeling window.

  1. In the Texture Placement Window, click on the other vertex. In the modeling windows, you can see that both vertices at the base of the nose are active. These are the overlapping vertices.
  2. Click TVert. This changes the Pick mode. You can now pick vertices through the modeling windows.

  3. In the Perspective window, drag a selection box with the middle mouse button around the vertex on the right side of the dwarf's nose. That vertex is now selected.

    Note: By using the middle mouse button to replace the old selection, you are using standard pick options with polygons. The left button toggles geometry from active to inactive while the right button removes the chosen elements from the pick list.

  4. In the Texture Placement Window, drag the selected vertex to the left side of the nostrils.

    The nose texture is starting to appear on the nose polygon in the perspective window.

  5. Select the third vertex in the Perspective window. In the Texture Placement Window, drag the third vertex to the right side of the nostrils.

    Note: To separate the third vertex from the second vertex, click-drag anywhere in the window.

    Adjust the other vertices as needed to map the nostrils properly.The nostrils should now be properly mapped onto the bottom of the nose.

    You have used one portion of the decal sheet to texture this particular polygon.

    Keep the Texture Placement Window and the Multi-lister open so that you can texture the eyes.

Texturing Several Polygons

To map the eyes of the dwarf, you can use the same decal texture. Since the detail on the eyes need to be placed on multiple polygons, you will repeat the steps used to texture the nose in a more complex situation.

Assign a shader

  1. Select Pick Nothing.

  2. From Polygon Edit, select Pick Vertex. Press the Shift key and click on the three polygons that make up the right side of the dwarf's face.

  3. Click on the dwarf_face shader to make it active. From the Multi-lister's Shading menu, select Assign Shader. These polygons need to be updated in the texture placement.

    Open the Texture Placement Window

  4. In the Texture Placement Window, press the Obj button. This updates the selection to show the vertices of the newly selected polygons.

    You can see the vertices on the right side of the texture. The vertices do not contain adequate UV information yet.

    Move a vertex

  5. Press the TVert button.
  6. Using the middle mouse button in the Perspective window, drag a selection box around the vertex at the top of the three polygons.

  7. In the Texture Placement Window, drag the vertex to the left side of the eye.

    Tip: If you can't see the selected vertex in the Texture Placement window, click-drag anywhere in the window. The selected vertex will become visible.

  8. Use the same procedure to move all the vertices so that they surround the eye as shown below. The vertices in the modeling view have been labeled to match the vertices in the Texture Placement Window.

    You have used another portion of the decal sheet to texture the character's right eye.

    Repeat for the left eye

  9. Repeat the same steps for the left eye. Start by assigning the shader to the three polygons and use the Texture Placement Window to edit the mapping. You can use the same decal texture for both eyes.

    Note: By re-using the eye portion of the decal, you can use smaller textures with a larger amount of details. To make a texture map of the whole face, you would need either a larger texture or a texture map with less detail. The decal sheet method offers more control over texture size for important details.

    Texture the dwarf's moustache.

  10. Use what you have learned so far to texture the dwarf's moustache using the third part of the decal texture. You can also add this part of the decal sheet to the dwarf's head as hair. Experiment with the possibilities.

Texturing a polygon quadrilateral

Now, you can add detail to the dwarf's chest. Using basic mapping techniques, you can apply a texture map to the chest polygon.

Assign a shader to the chest

  1. Select Pick Object. Click on the dwarf's head.
  2. From ObjectDisplay, select Template. The head appears as grey wires.
  3. Select Pick Template. Click on the body polyset.
  4. From ObjectDisplay, select Template. The body appears in shaded mode.

    Pick the front of the tunic

  5. From Polygon Edit, select Pick Vertex. Press the Shift key and click on the polygon that defines the dwarf's chest area.

    Duplicate the tunic shader

  6. In the Multi-lister, pick the tunic shader. From the Multi-lister's Edit menu, select Copy.
  7. Re-name this new shader shirt.

    Add a color texture to the new shader

  8. Double-click on the new shader to open the editor. In the Shader editor, click on the Map button next to Color, then choose Surface File from the Texture window.
  9. In the File editor, click on the Browse button next to Image. In the File lister, choose the texture called L27_shirt, located in the pix directory.
  10. Click on the shader called shirt to make it active. From the Multi-lister's Shading menu select Assign Shader. The model updates in the window and the chest texture changes. The model needs to have its texture positioning updated.
  11. Click on the Texture Placement Window icon at the bottom right corner of the L27_shirt file texture.

    Note: You may need to close and open the Texture Placement Window to refresh its display.

  12. Position the texture vertices so that the shirt is properly positioned on the dwarf's chest.

    Something seems to be wrong! The texture appears skewed down the center. This needs to be fixed.

Adjust the texture vertices

The texture on the dwarf's chest is skewed because quadrilateral polygons break into triangles when rendered. You can try to work around this obstacle using a couple of methods.

One option is to paint the texture to take advantage of the shearing of it. The other option is to add more polygons into the character. Changing the texture is more memory efficient for a game system while adding polygons is faster. For this example, you will add some polygons.

  1. Select Pick Nothing.

  2. Select Polygon Edit Split Polygon Split - . Set the Split Type to Corners To Center.

  3. Click Go. Click in the middle of the chest. An axial marker and a Go button appear. The marker defaults to the center of the polygon. You can move the marker to any point you'd like to have as the center of the polygon. For this exercise, however, the default position works fine.

  4. Again, click Go. The quadrilateral polygon splits into four triangles meeting at the centre and the texture updates. The texture is now mapped in a more symmetrical manner.

    It is important to remember that polygon quadrilaterals render by splitting into triangles. This problem exists in most game rendering engines. It is a good idea to set up your model to work around the issue before exporting to your game environment.

Force UV Plug-in

Force UV is a plug-in that maps multiple polygons simultaneously. In the case of the Dwarf's hat, you may want to set the UV mapping of all the facets so that a rivet texture can be applied.

Note: Plug-ins are unsupported extra features that may help you solve a particular problem. Be sure to explore and use the many plug-ins available to you.

Load the Force UV plug-in

  1. From Utilities, select Plug-in Manager....
  2. Check mark the Load/Unload field next to force UV and close the Plug-in Manager. Notice that the prompt line says: force UV installed on Palette `Poly Shading'.

    Note: If a plug-in is not listed in the Plug-in Manager, you can use the Plug-in Browse button to look for it. You may also need to review the installation instructions for more information on installing and loading plug-ins.

    Note: When installing plug-ins you can check the installation by pressing the <> button at the left of the prompt line window. This will open the Promptline History window.

    Untemplate the hat

  3. Select Pick Object and click on the body.
  4. From ObjectDisplay, select Template.
  5. Select Pick Template. Click on the hat.
  6. From ObjectDisplay, select Template. The hat should appear shaded.

    Duplicate the tunic shader

  7. In the Multi-lister, pick the hat shader. From the Multi-lister's Edit menu, select Copy.
  8. Rename this new shader hat_decal.
  9. Double-click on the new shader to open the editor. In the Shader editor, click on the Map button next to color, then choose Surface File from the Texture window.
  10. In the File's editor, click on the Browse button next to Image. In the File lister, choose the texture called L27_hat_decal.

    Assign the shader

  11. Select Polygon Edit Pick Vertex. Make a pick box around the hat vertices to pick all the polygons.
  12. Click on the shader called hat_decal to make it active. From the Multi-lister's Shading menu select Assign Shader. The model updates in the window but the UV coordinates are not set properly.

    Force UV

  13. Select Poly Shading ForceUV. The options are not necessary in this case. The texture should map onto each polygon on the hat in the same way. The Force UV simply pushes the UV mapping to the corners of the texture. The result may need some editing.

  14. Open the Texture Placement Window and move the vertices so that each surface of the hat polygon has the crest and the rivets.

    Note: You should be seeing four vertices in the Texture Placement Window. Force UV works based on a UV mapping style which requires four points. One of the vertices will be redundant, so you can ignore it.

    Untemplate the other body parts

  15. Select Pick Nothing then select Pick Template. Drag a selection box around all the geometry.
  16. From ObjectDisplay, select Template. The entire dwarf is shaded.

    Save your work

  17. From File, select Save As. Name your file my_dwarf and click Save.

    The dwarf has now been textured and is almost ready to output to a VRML file, or to a game environment.

VRML

At this point you may want to export your work to the web. VRML output allows you to send polygonal models directly to WebSpace by going to the File menu and selecting Export VRML 2. Shown below is the textured dwarf imported into WebSpace.

Prelight the model

In addition to the web, you may need to export your model to a game system. Before exporting, you may need to prelight your model. This gives the gaming environment important color per vertex information about the model. It also sets up a lighting condition that is baked into the model, thereby allowing the game system to not have to light the model interactively.

Change to Poly draw mode

  1. From the DisplayTgls menu select Shade.
  2. From the DisplayTgls menu, select Polygon control - . In the Window Display Options section, set the Toggle Type to Current Window then turn Colored Display on. From the Display Style menu, select Filled.

    The model is now displayed as filled polygons. The textures do not appear since only color per vertex information is shown.

    Prelight the model

  3. From the Render menu, select Polyset prelight. By prelighting, you have assigned color per vertex information to the polygons. Lighting information is also applied to the vertices.

The dwarf is now ready to export using one of the game export translators. The texturing information you have added in this lesson can give your polygon character life in a larger gaming environment.



Bookshelf Contents Previous Next Glossary Index Search

[email protected]
Copyright © 1998, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved.