Texture Format
Texture data can be stored in a number of different formats, and various formats are used for various purposes by UnrealEd and the game itself. The following is a list of the texture formats available for use by the Unreal Engine, sorted by the format code you'll see in the Texture Browser.
- RGBA8 – 32-bit RGB with Alpha
- This is the simplest "raw" format. Each pixel is represented by one byte each for the red, green, blue, and alpha channels. This format allows for the widest possible range of color and alpha information, but at the expense of very large image size in memory and on disk (a 512x512 texture takes up 1MB of memory). For this reason, it is recommended that this format not be used unless absolutely necessary. (Import/export formats: BMP, PCX, TGA, UPT)
- DXT1 – DXT Compressed, opaque/one-bit alpha
- The most compact format for texture data supported by the Unreal Engine. DXT1 can store full-color textures with a total image size of 4 bits per pixel (half that of P8), but does suffer from some loss of image quality. DXT1 textures have either no transparency at all or just a single transparent color.(Import/export formats: DDS)
- DXT3 – DXT Compressed, linear alpha
- DXT3 textures offer the same image quality as DXT1, but add sixteen-level (4-bit) alpha information for each pixel, making this format good for textures with sharply contrasting translucent/opaque areas. This does, however, have the drawback of doubling the image size (to 8 bits per pixel) over DXT1. (Import/export formats: DDS)
- DXT5 – DXT Compressed, interpolated alpha
- DXT5 is another variation of DXT1 with additional alpha information. Like DXT3, DXT5 features an image size of 8 bits per pixel (twice that of DXT1), however DXT5 uses an interpolated alpha scheme which allows for smoother transitions in alpha values than DXT3 (but has less precision for sharp changes in alpha). (Import/export formats: DDS)
- P8 – 8-bit Palletized
- P8 textures store each pixel as an index into a table of 256 possible colors (similar to the GIF file format). P8 textures can also optionally have 1-bit (on or off) transparency information, which is done by considering the color index 0 to represent "transparent". P8 is one quarter the size of RGBA8, while potentially offering substantially better color representation of DXT, often offering a good compromise in the middle of the size/quality spectrum. (Import/export formats: BMP, PCX)
- ??? – 8-bit Palletized with Alpha
- A special variation on P8 is the alpha-palettized format where each one of the 256, 32-bit palette entries holds an RGBA value instead of RGB. This is mostly relevant only for the PSX2 builds of the engine; given the PSX2 architecture, it's the most efficient form of storing a variable-alpha texture. The catch is that having to put variable alpha in a palette diminishes the already limited color variety available; but in many cases this isn't significant, and several font-and user interface textures have been created this way. (Import/export formats: Special form of BMP?)
- G16 – 16-bit Grayscale
- Primarily used for terrain heightmaps, G16 textures offer 65536 levels of gray, providing greatly increased precision of grayscale information for those rare cases where it is needed. Most external graphics applications are not able to handle 16-bit grayscale information, however, so manipulating G16 images outside of UnrealEd may require specialized software, such as G16ed. RGBA8 and P8 textures can be converted to G16 in UnrealEd by setting the texture as a heightmap for a terrain, and once it's visible in the Terrain Mode window, right-clicking on its thumbnail and selecting "convert to G16" from the pop-up menu. (Import/export formats: BMP Note: The G16 "BMP" format is not actually a valid BMP file, and will not work correctly with most programs)
Notes
- There is apparently a hardware bug in some nVidia chipsets, including the NV20 (GeForce3), which potentially makes DXT1 textures display poorly onscreen. Specifically, decompression is performed in 16-bit color mode internally, making the resulting texture potentially unacceptable for use, especially when combined with other operations. Test your DXT1 textures on nVidia hardware before committing to their use. All other DXT formats on nVidia hardware are okay, as textures are decompressed in 32-bit color internally.
- RGBA8 and P8 textures can be converted to DXT1/3/5 in UnrealEd by right-clicking on the texture in the texture browser and selecting the desired format from the "Compress" item of the pop-up menu.
- Using DXT textures can greatly reduce file sizes. For example 512x512 32bit RGBA8 file is 1MB big. DXT1 compressed file will be ~128KB big, image quality may not be noticeably decreased, 1-bit alpha may be present. Zipped DXT1 file will be ~28KB big. That's only 2.7% of the original file size.
Recommendations
DXT compression can offer substantial space savings and should be used whenever feasible. See the DXT page for more information on which type to use when. When DXT compression does not provide sufficient image quality, P8 textures should be used if possible. RGBA8 textures should only be used when absolutely necessary due to their extremely large size.
Related Topics
- Texture Topics
- Texture Compression
- Texture Import and Export
- DXT – has a more detailed discussion of how DXT textures are represented internally, as well as some general rules of thumb for when to use which format.