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 Toggle Shade

    Toggle 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 Toggle shade

    1. Click in the Perspective window to make it the current window.
    2. From the Display menu, select Toggle 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

    1. From the Windows menu, select Multi-lister Shaders....
    2. 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 window and the body is now brown.

    Assign the remaining shaders

    1. 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 a shader to the polygon.

    Assign the shader

    1. 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.

  • Select Pick Object. Pick all pieces of geometry except for the body.
  • From ObjectDisplay, select Tgl template. Notice that all of the geometry is grey. The grey color indicates that the geometry is templated.
  • Tumble and dolly the view, so that you are looking down on the dwarf from his left side.
  • Select Polygon Edit Pick Vertex. Press the Shift key. Click on the square polygon that is the base of the neck, and hold the Shift key while you click on the polygon (below the square polygon) on the front that connects to the chest.
  • In the Multi-lister, click on the skin shader to make it active.
  • From the Multi-lister's Shading menu, select Assign Shader.
  • Add hair to the dwarf's head

  • Select Pick Object. Click on the dwarf's body.
  • From ObjectDisplay, select Tgl template. The body is templated.
  • Select Pick Template. Click on the dwarf's head.
  • From ObjectDisplay, select Tgl template. The head is now available.
  • 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 Tgl template.
    3. Select Pick Template. Click on the legs.
    4. From ObjectDisplay, select Tgl 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.

    1. 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.
    2. Under 3D Placement, turn Wrap to Off in the Projection Texture Parameters window. 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 icon. The icon becomes bright green 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 promptline. This will move the icon to the top of the boot.
    4. Select Xform Nonp scale. Enter 2 2.5 5 at the promptline. 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 polys

    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. Press 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.
    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 Tgl Shade options under the Display 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.

    1. 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 utilized 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 texture 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. The texture placement 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 Tgl template. The legs appear as grey wires again.
    3. Select Pick Template. Click on the head.
    4. From ObjectDisplay, select Tgl 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. 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 and the nose texture changes. There appears to be no change. You need to update the texture placement.

    Use the Texture Placement Window

    1. From File Texture, select the Texture Placement Window icon. You can find this icon in the bottom left corner. It looks like a square grid.

    In the texture placement window, you will see three vertices overlaying the L27_face_decal texture.

    1. 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.

    1. 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. Choose 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.

    1. In the Texture editor, 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.

    1. Click on the third vertex and drag it to the right side of the nostrils. 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

    1. In the Texture editor, press the Obj button. This updates the selection to show the vertices of the newly selected polygons.

    In the Texture Placement window, you can see the vertices at the side of the texture. The vertices do not contain adequate UV information yet.

    Move a vertex

    1. Press the TVert button.
    2. Using the middle mouse button in the Perspective window, drag a selection box around the vertex at the top of the three polygons.
    3. In the Texture editor, drag the vertex to the left side of the eye.
    4. 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

    1. Repeat the same steps for the left eye. Start by assigning the shader to the three polygons and use the texture editor 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 larger details. To make a texture map of the whole face, you would need either a larger texture or you would have to create a texture map with less detail. The decal sheet method offers more control over texture size for important details.

    Texture the dwarf's moustache.

    1. 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 Template. Click on the dwarf's head.
    2. From ObjectDisplay, select Tgl template. The head appears in shaded mode.
    3. From Polygon Edit, select Pick Vertex. Hold the Shift key and click on the body polyset.
    4. From ObjectDisplay, select Tgl template. The body is now visible.

    Pick the front of the tunic

    1. 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

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

    Add a color texture to the new shader

    1. 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.
    2. In the File editor, click on the Browse button next to Image. In the File lister, choose the texture called L27_shirt.
    3. 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.
    4. Click on the Texture Placement Window icon at the bottom right of the L27_shirt file texture.

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

    1. 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 Centre.
    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 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 promptline says: Force UV installed in Polygon Edit.

    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

    1. Select Pick Object and click on the body.
    2. From ObjectDisplay, select Tgl template.
    3. Select Pick Template. Click on the hat.
    4. From ObjectDisplay, select Tgl template. The hat should appear shaded.

    Duplicate the tunic shader

    1. In the Multi-lister, pick the hat shader. From the Multi-lister's Edit menu, select Copy.
    2. Rename this new shader hat_decal.
    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_hat_decal.

    Assign the shader

  • Select Polygon Edit Pick Vertex. Make a pick box around the hat vertices to pick all the polygons.
  • 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 have not been set properly.
  • Force UV

  • Select Polygon Edit Force UV. 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.
  • 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

  • Select Pick Nothing then select Pick Template. Drag a selection box around all the geometry.
  • From ObjectDisplay, select Tgl template. The entire dwarf is shaded.
  • Save your work

  • From File, select Save As. Name your file my_dwarf and click Save. The dwarf has now been textured. The dwarf 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. 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,<

    Change to Poly draw mode

    1. From the Display menu select Toggle shade.
    2. From the Display menu, select Poly draw mode - . Set the Toggle type to Current Window then turn Colored Display to 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

    1. 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.





    aliasdocs@aw.sgi.com

    Copyright © 1997, Alias|Wavefront, a Silicon Graphics Company. All rights reserved.