Texture Importer

From Tombstone Engine Wiki
Jump to: navigation, search
Figure 1. The Texture Importer dialog.

Texture maps used by the Tombstone Engine have the .tex file extension. These texture map resources are created by importing texture images from a subdirectory of the Import directory using the Texture Importer tool.

The Texture Importer tool supports .tga files, which may be in 8-bit grayscale, 16-bit color, 24-bit color, or 32-bit color format, with or without RLE compression.

To import a texture, either choose Import Texture from the Tombstone Menu or invoke the itexture [name] command in the Command Console. If the menu command is chosen, or the name is omitted from the console command, then the Texture Importer tool will open an Import Texture dialog that lets you select a .tga file from a subdirectory of the Import directory. After selecting an image file to import, the Import dialog is opened with the default settings shown in the following figure. These default settings are usually appropriate for ordinary color texture maps.

When a texture is imported, a .cfg file is created in the same folder as the imported texture, and it contains all of the settings that were applied. This file is recognized the next time the texture is imported and used to populate the Import Texture dialog with the settings that were previously used.

Note: All resources imported into the Tombstone Engine should be placed in a subfolder of the Import folder, not directly in the Import folder itself.

Import Settings

Setting

Description

Texture Format

Texture type

Selects the OpenGL texture target for this texture map. It can be one of the following values.

  • 2D An ordinary 2D texture whose coordinates lie in the range [0, 1] in both dimensions. The width and height of a 2D texture must be a power of two.
  • Rect A rectangle texture whose coordinates lie in the range [0, width] and [0, height]. The width and height do not need to be a power of two. The rectangle texture type should not be used for texture maps that are to be used in a 3D setting because they will adversely affect performance when minified. Rectangle textures are primarily used for things like user interface images that appear in a 2D setting.
  • Cube A cube map texture. See below.
  • Array 2D A texture containing an array of 2D images.

Image format

Selects the output pixel format for this texture map. It can be one of the following values.

  • RGBA Color The image has four channels: red, green, blue, and alpha.
  • Luminance Alpha The image has two channels: grayscale luminance and alpha.
  • Luminance The image has one grayscale channel, and the alpha is always interpreted to be the maximum value.
  • Intensity The image has one grayscale channel, and the alpha is always interpreted to be equal to the gray value.

Alpha channel

Specifies what kind of information is stored in the alpha channel of the texture. It can be one of the following values. (If alpha channel information is specified, then the TGA file being imported must use a 32-bit format.)

  • None There is no information stored in the alpha channel.
  • Transparency The alpha channel contains transparency information.
  • Gloss The alpha channel contains a gloss map. Whenever a texture containing a gloss map in the alpha channel is used in a material, any specularity, environment map, or reflection term is modulated by the gloss map.
  • Opacity The alpha channel contains an opacity map. Whenever a texture containing an opacity map in the alpha channel is used in a material, the opacity is used to linearly interpolate between the diffuse term and the refraction term.
  • Glow The alpha channel contains glow intensity values that are used by the glow post-processing effect. This should only be used for emission maps.
  • Occlusion The alpha channel will contain ambient occlusion information. This can be a precomputed channel, or it can be generated when the texture is imported. See the description of the Calculate ambient occlusion in alpha box below.
  • Parallax The alpha channel of the import texture contains a height map from which parallax mapping information should be calculated. This is selected automatically if the Generate parallax data box is checked. If the alpha channel of a normal map in a material contains parallax information, the parallax mapping is applied during all rendering passes.

S wrap mode

T wrap mode

Specifies what wrap modes to apply to the texture map. They can each be one of the following values.

  • Repeat The texture is addressed using the GL_REPEAT wrap mode.
  • Clamp The texture is addressed using the GL_CLAMP_TO_EDGE wrap mode. If this mode is not available, the GL_CLAMP is used instead.
  • Clamp to Border The texture is addressed using the GL_CLAMP_TO_BORDER wrap mode.
  • Mirror Repeat The texture is addressed using the GL_MIRRORED_REPEAT wrap mode.
  • Mirror Clamp The texture is addressed using the GL_MIRROR_CLAMP_TO_EDGE wrap mode.
  • Mirror Clamp to Border The texture is addressed using the GL_MIRROR_CLAMP_TO_BORDER wrap mode.

Use block compression

The output texture is stored in a hardware-recognized compression format. This should be turned on for almost all texture maps for best performance and memory usage. (This setting is ignored if the image format is not RGBA Color or if generating a normal map with parallax data.)

Texture Flags

Disable filtering

No filtering is applied to this texture map, and point sampling is used instead.

Disable anisotropic filtering

Anisotropic filtering is disabled for this texture map, but ordinary bilinear or trilinear filtering is still applied.

Require high-resolution rendering

The texture map is always rendered using the highest resolution available, even if the user has selected a lower-quality option in the Graphics Settings dialog.

Map/Channel Generation

Calculate normal map

The import texture is treated as a height map from which a normal map should be calculated. Each height is multiplied by the value specified in the Height map scale field and used to determine the normal vector at each pixel.

In order to access all features of the engine, normal maps should be created by the Texture Importer tool, and not by external programs. You can still use normal maps generated by external tools, but if you do, then you can't have associated parallax maps, horizon maps, or ambient occlusion maps. External normal maps can still be block compressed, but you must check the Treat RGB channels as vector box.

Generate parallax data

When checked in addition to Calculate normal map, the height in the alpha channel is converted into special parallax data used by the engine. The same height map must be stored in all four channels of the import texture.

Generate horizon maps

When checked in addition to Calculate normal map, a separate texture is generated that contains horizon map data. This texture has the same name as the normal map, but with a different suffix. If the name of the normal map ends in -nrml, then this suffix is changed to -hrzn. Otherwise the suffix -h is added to the full name of the normal map (excluding the extension .tex).

A horizon map is applied to a material when the Enable horizon mapping box is checked in the Material Editor.

Calculate ambient occlusion in alpha

The heights stored in the alpha channel are scaled by the value specified in the Height map scale field and used to calculate an ambient occlusion factor that is applied in the ambient rendering pass.

Height map scale

Specifies a scale that is applied to all height values. A scale factor of 1.0 corresponds to the width of a single texel in the import texture.

Height map channel

Selects a channel to be used as the source of the height map for all calculations.

Options

Output file name

Specifies the name of the texture file that will be created. (It should not include the extension.) This usually does not need to be changed from the default setting.

Calculate mipmap levels

All mipmap levels for this texture are calculated and stored in the texture resource. Turning this off for textures that are used in a 3D environment can have a negative effect on performance.

Bleed colors for alpha test

Causes texels that would fail the alpha test to pick up the color of the nearest texel that passes the alpha test. This process helps remove borders that can appear when alpha-tested textures are rendered. When this setting is checked, the alpha values in lower-resolution mipmaps are also boosted to prevent fade-out of alpha-tested geometries.

Treat RGB channels as vector

Mipmaps are calculated for vector data instead of color data. This is useful if you're importing a precomputed normal map as opposed to calculating a normal map from a height field. This box must be checked in order to get block compression for an externally generated normal map.

Invert green channel

The green channel of the import texture image is inverted. This is useful for changing handedness in externally generated normal maps.

Scale texture to half resolution

The import texture image is reduced to half size in each direction before being processed.

Scale horizon maps to half resolution

The horizon map is generated from an import texture image that has been reduced to half size in each direction. Using this option can usually save a significant amount of memory without a noticeable reduction in rendering quality. (If Scale texture to half resolution is also checked, then both scales are applied, so the horizon map is only one-quarter the size in each direction.)

Flip image vertically

The import texture image is flipped in the vertical direction before being processed.

Array Texture

Cell count

When the Texture type is set to Array 2D, the cell count setting specifies how many layers the array texture has. The layers should be stacked vertically in the input image, and the total height divided by the cell count must be an integer.

Skybox Haze

Haze color

When checked, the haze color is applied at the bottom of the texture image with the appropriate warping for use as a skybox texture.

Haze elevation

Specifies the relative height to which the haze extends above the horizon. (Ignored if Haze color is not checked.)

Cursor Data

Image center X

Image center Y

If importing a cursor texture, these settings specify the coordinates, in pixels, where the center, or hot spot, of the cursor is located.

Cube Maps

A cube map can be imported by creating a single TGA file that contains all six faces of the cube. Each cube face must be square and have a width that is a power of two. The importer supports the four layouts shown in the following table. Each face must have the correct orientation in order for the cube map to work properly, and these are shown in the figures. The z axis always represents the up direction, and the direction specified in the center of each face represents the axis that points into the image.

Layout

Description

Cube hcross.png

Horizontal Cross. The image should be exactly 4 faces in width and 3 faces in height.

Cube vcross.png

Vertical Cross. The image should be exactly 3 faces in width and 4 faces in height.

Cube hstrip.png

Horizontal Strip. The image should be exactly 6 faces in width and 1 face in height.

Cube vstrip.png

Vertical Strip. The image should be exactly 1 face in width and 6 faces in height.

See Also