Changes between Version 1 and Version 2 of TextureFormat


Ignore:
Timestamp:
Sep 10, 2010, 4:36:58 PM (14 years ago)
Author:
Philip Taylor
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TextureFormat

    v1 v2  
    44 * Textures should be in '''PNG format'''.
    55 * Textures must be '''power-of-two sizes''' (width and height must be 64, 128, 256, 512, etc; non-square sizes like 256x512 are fine too).
    6  * Textures go in an '''`art/textures/`''' directory (typically `binaries/data/mods/public/art/textures/`)
     6 * Textures go in an '''`art/textures/`''' directory (typically `binaries/data/mods/public/art/textures/`).
     7 * Everything should work automatically. If you care about the details or want more control over visual quality, see the rest of this page.
    78
    89== Compression ==
     
    1718=== DXTn differences ===
    1819
    19 DXT1, DXT3 and DXT5 all store the RGB channels in precisely the same way. The only difference is the alpha channel. The [http://blog.wolfire.com/2009/01/dxtc-texture-compression/ Wolfire Games blog] (no relation to Wildfire Games) has some examples.
     20DXT1, DXT3 and DXT5 all compress the RGB channels in precisely the same way. The only difference is the alpha channel. The [http://blog.wolfire.com/2009/01/dxtc-texture-compression/ Wolfire Games blog] (no relation to Wildfire Games) has some examples.
    2021
    2122 * DXT1: 1-bit alpha: good for textures that are all solid, or for UI elements with non-antialiased transparency masks. Generally unsuitable for non-solid world textures - even if the texture only needs 1-bit alpha, its mipmaps are likely to need semi-transparent pixels.
    2223 * DXT3: 4-bit alpha: good for textures with a wide range of alpha values in a 4x4 block of pixels; bad for smooth alpha gradients.
    2324 * DXT5: 3-bit alpha gradient: good for smooth gradients; fine for most of the cases where DXT3 is good. You should generally use this instead of DXT3.
     25
     26== Mipmaps ==
     27
     28Graphics hardware can't resize textures downwards (e.g. when zooming out) with high quality, so we pre-compute scaled versions and store them as mipmaps. Textures that are never scaled down (e.g. GUI elements) should not have mipmaps, to save space.
     29
     30There are many ways to do the resizing, with effects on the sharpness of the textures when zoomed out. The [http://code.google.com/p/nvidia-texture-tools/wiki/ResizeFilters NVIDIA Texture Tools page] gives examples of different filtering methods and of gamma-correction.
     31
     32== Automatic texture conversion ==
     33
     34Artists should save and upload textures in PNG format, and the game engine will automatically perform the mipmapping and compression and will cache the result so that it can load quickly next time. This allows us to losslessly edit the textures and tweak the conversion settings, and avoids problems with textures being manually exported with the wrong settings.
     35
     36The texture conversion settings are specified in `textures.xml` files. For example, `art/textures/ui/global/button/textures.xml` might say:
     37{{{
     38<?xml version="1.0" encoding="utf-8"?>
     39<Textures>
     40  <File pattern="*" format="dxt5" mipmap="false" alpha="transparency"/>
     41  <File pattern="button_wood.*" format="rgba"/>
     42</Textures>
     43}}}
     44Each `<File>` line matches some filenames, and applies certain settings to them. If a filename matches multiple lines, later settings will override earlier settings. The `textures.xml` file applies to all files in the same directory, ''and'' in all subdirectories - e.g. you can specify some common default settings in `art/textures/ui/textures.xml` for all UI textures, then override them with specific settings in subdirectories.
     45
     46`pattern="..."` determines which filenames are matched by that line. The pattern can include wildcards: `?` matches any character, `*` matches any sequence of zero or more characters.
     47
     48The available settings are:
     49 * `format="rgba"`
     50 * `format="dxt1"`
     51 * `format="dxt3"`
     52 * `format="dxt5"`
     53 * `mipmap="true"`
     54 * `mipmap="false"`
     55 * `alpha="transparency"`
     56 * `alpha="player"`
     57 * `filter="box"`
     58 * `filter="triangle"`
     59 * `filter="kaiser"`
     60 * `kaiserwidth="3.0" kaiseralpha="4.0" kaiserstretch="1.0"`