Game Creation Kit: Last modified 02/02/07 17:04:05 cw
Prev | Chapter 25. Real-time Materials | Next

# 25.3. The UV Editor

The UV editor is fully integrated into Blender and allows you to map textures onto the faces of your models. Each face can have individual texture coordinates and an individual image assigned. This can be combined with vertex colors to darken or lighten the texture or to tint it.

To start UV editing, enter FaceSelect mode with the FKEY or the FaceSelect icon in the 3DWindow Header. The mesh is now drawn Z-Buffered. In textured mode (ALT-Z) untextured faces are drawn in purple to indicate the lack of a texture. Selected faces are drawn with a dotted outline.

To select faces use the right mouse button, with the BKEY you can use BorderSelect and the AKEY selects/deselects all faces. While in FaceSelect mode you can enter EditMode (TAB) and select vertices. After leaving EditMode the faces defined by the selected vertices are selected in FaceSelect mode. The active face is the last selected face: this is the reference face for copy options.

RKEY allows you to rotate the UV coordinates or VertexColors.

## 25.3.1. Mapping UV Textures

When in FaceSelectMode (FKEY) you can do a calculate UV textures for selected faces by pressing UKEY. A menu will give you the following choices:

Cube

  Cubic mapping, a requester asks for a scaling property

Cylinder

  Cylindrical mapping calculated from the center of the selected faces

Sphere

  Spherical mapping calculated from the center of the selected faces

Bounds to...

  The UV coordinates are calculated using the projection of the 3DWindow and then scaled to a bound box of the desired size

Standard...

  Each face gets the default set of square UV coordinates

From Window

  UV coordinates are calculated from the active 3DWindow

## 25.3.2. The ImageWindow

To assign images to faces you need to open an ImageWindow with SHIFT-F10.

Figure 25-2. The Image Window

  The first Icon keeps UV polygons square while editing this is a big help while texturing. Just drag one or two vertices around and the others follow to keep the polygon square. The second one keeps the vertices inside the area of the image.

  With the UserBrowse (MenuButton) you can browse, assign and delete loaded images on the selected faces.

  "Load" loads a new image and assigns it to the selected faces. "Replace" replaces (scene global) an image on all faces assigned to the old image. The small buttons to the right of the "Load" and "Replace" buttons open a FileWindow without the thumbnail images.

  The grid icon enables the use of more (rectangular) images in one map. This is used for texturing from textures containing more than one image in a grid and for animated textures. The following two number buttons define how many parts the texture has in X and Y direction. Use SHIFT-LMB to select the desired part of the image in GridMode.

  The "Anim" button enables a simple texture animation. This works in conjunction with the grid settings, in a way that the parts of the texture are displayed in a row in game mode. With the number buttons to the right of the "Anim" button you define the start and end part to be played. "Speed" controlls the playback speed in frames per second.

  With the lock icon activated, any changes on the UV polygons in the ImageWindow are shown in real-time in the 3DWindows (in textured mode).

Vertices in the ImageWindow are selected and edited (rotate, grab) like vertices in EditMode in the 3DWindows. Drag the view with the middle mouse, zoom with PAD+ and PAD-.

## 25.3.3. The Paint/FaceButtons

When in FaceSelect mode, you can access the Paint/FaceButtons with the Icon in the ButtonsWindow Header. In the Paint/FaceButtons you'll find all functions to set the attributes for faces and access the VertexPaint options.

Figure 25-3. The Paint/FaceButtons

The following modes always work on faces and display the setting of the active face. Two colored lines in the 3DWindow and the ImageWindow indicate the active face. The green line indicates the U coordinate, the red line the V coordinate. To copy the mode from the active to the selected faces use the copy buttons ("Copy DrawMode", "Copy UV+tex" and "Copy VertCol") in the Paint/FaceButtons. In FaceSelect mode the special menu has some entries to quickly set and clear modes on all selected faces, see Figure 25-4.

Figure 25-4. The special menu for the FaceSelectMode

Face modes

Tex

  This enables the use of textures. To use objects without textures, disable "Tex" and paint the faces with VertexPaint.

Tiles

  This indicates and sets the use of the tile mode for the texture, see Section 25.3.2.

Light

  Enables real-time lighting on faces. Lamps only affect faces of objects that are in the same layer as the lamp. Lamps can also be placed on more than one layer, which makes it possible to create complex real-time lighting situations. See also Section 26.7.

Invisible

  Makes faces invisible. These faces are still calculated for collisions, so this gives you an option to build invisible barriers, etc.

Collision

  The faces with this option are evaluated by the game engine. If that is not needed, switch off this option to save resources.

Shared

  With this option vertex colors are blended across faces if they share vertices.

Twoside

  Faces with this attribute are rendered twosided in the game engine.

ObColor

  Faces can have color that can be animated by using the ColR, ColG, ColB and ColA Ipos. Choosing this option replaces the vertex colors.

Halo

  Faces with this attribute are rendered with the negative X-axis always pointing towards the active view or camera.

Billboard

  Faces with this attribute are pointing in the direction of the active view with the negative X-axis. It is different to "Halo" in that the faces are only rotated around the Z-axis.

Shadow

  Faces with this attribute are projected onto the ground along the Z-axis of the object. This way they can be used to suggest the shadow of the object.

Text

  Faces with this attribute are used for displaying bitmap-text in the game engine, see Section 25.4.

Opaque

  Normal opaque rendered faces. The color of the texture is rendered as color.

Add

  Faces are rendered transparent. The color of the face is added to what has already been drawn. Black areas in the texture are transparent, white are fully bright. Use this option to achieve light beam effects, glows or halos around lights. For real transparency use the next option "Alpha".

Alpha

  The transparency depends on the alpha channel of the texture.

## 25.3.4. Avaible file formats

Blender uses OpenGL to draw its interface and the game engine. This way we can provide the such great cross-platform compatibility. In terms of using textures, we have to pay attention to several things before we're able to run the game on every Blender platform.

- The height and width of textures should be to the power of 64 pixels (e.g. 64x64, 64x128, 128x64 etc.) or Blender has to scale them (in memory not on disk!) to provide OpenGL compatibility

- The use of textures with a resolution above 256 x 256 pixels is not recommended if you plan on publishing your game, because not all graphic cards support higher resolutions.

Blender can use the following file formats as (real-time) textures:

Targa

  The Targa or TGA (*.tga extension) file format is a lossless compressed format, which can include an alpha channel.

Iris

  Iris (*.rgb) is the native IRIX image format. It is a lossless compressed file format, which can include an alpha channel.

Jpeg

  A lossy compressing (it uses a compression which leaves out parts of the image which the human eye can hardly see) file format (*.jpg, *.jpeg) is designed for photos with very small file sizes. Because of its small footprint it is a very good format for distribution over the net. It has no support for alpha channels and because of the quality loss due to compression it is not a recommended format to work with during the design phase of a game.

## 25.3.5. Handling of resources

For publishing and easier handling of Blender's files, you can include all resources into the scene. Normally textures, samples and fonts are not included in a file while saving. This keeps them on your disk and makes it possible to change them and share them between scenes. But if you want to distribute a file it is possible to pack these resources into the Blendfile, so you only need to distribute one file, preventing missing resources.

Figure 25-5. The ToolsMenu

The functions for packing and unpacking are summarized in the ToolsMenu. You can see if a file is packed if there is a little "parcel" icon to the right of the ToolsMenu. After you packed a file, all new added resources are automatically packed (AutoPack).

When working with textures, sounds or fonts you will notice a pack-icon near the File- or Datablock-Browse. This icon allows you to unpack the file independently.

The Tools Menu entries

Pack Data

  This packs all resources into the Blendfile. The next save will write the packed file to disk.

Unpack Data to current dir

  This unpacks all resources to the current directory. For textures a directory "textures" is created, for sounds a "samples" directory and fonts are unpacked to "fonts".

Advanced Unpack

  This option calls the Advanced Unpack Menu.

  Figure 25-6. Advanced Unpack Menu

  Advanced Unpack Menu entries

  Use files in current directory

    This unpacks only files which are not present in the current directory. It creates files when necessary.

  Write files to current directory

    This unpacks the files to the current directory. It overwrites existing files!

  Use files in original location

    This uses files from their original location (path on disk). It creates files when necessary.

  Write files to original location

    This writes the files to their original location (path on disk). It overwrites existing files!

  Disable AutoPack, keep all packed files

    This disables AutoPack, so new inserted resources are not packed into the Blendfile.

  Ask for each file

    This asks the user for the unpack options of each file.

Prev | Home | Next
TexturePaint | Up | Bitmap text in the game engine