Difference between revisions of "Texture Formats"

From DCEmulation
Jump to navigation Jump to search
(Created page with "This tutorial will explain how you can store image data on the Dreamcast's PVR graphics chip for efficient drawing and compact storage. List of texture formats: http://game...")
 
(Comparison between uncompressed and compressed)
Line 57: Line 57:
  
 
== Comparison between uncompressed and compressed ==
 
== Comparison between uncompressed and compressed ==
To see how useful applying the proper texture format is, check out [[dcemulation.org/phpBB/viewtopic.php?f=29&t=103369&p=1045482 this thread]]
+
To see how useful applying the proper texture format is, check out [http://dcemulation.org/phpBB/viewtopic.php?f=29&t=103369&p=1045482 this thread]

Revision as of 10:11, 15 March 2016

This tutorial will explain how you can store image data on the Dreamcast's PVR graphics chip for efficient drawing and compact storage.

List of texture formats: [[1]]

Color formats

Basic

This table describes the color information that can be stored in textures.

ARGB1555 each color channel has 5 bits, transparency is on or off
ARGB4444 each channel has 4 bits, use if you need a transparent gradient
BUMP bumpmap format (stores angles for vertex displacement effects in lighting calculations), similar to a normal map
YUV422 mostly used for video decoding, uncommonly used

Paletted

There are also paletted texture formats which can be combined with the above color formats as well as ARGB8888.

4BPP_PAL (or 8BPP_PAL)

  1. Define an array of 2^4 = 16 (or 2^8 = 256) color values.
  2. Copy the array to the graphics chip, then send textures that use 4-bit (or 8-bit) indices into that array instead of 16 bit argb as pixel values.

ARGB8888 is slow when used with filtering.

You can set multiple palettes on the graphics chip at the same time (1024 bytes total), so they're not per-texture at all, but global.

Paletted textures are always twiddled and never strided.


Additional attributes

Textures can be twiddled, VQ compressed, strided or mipmapped.

Twiddled

Pixels aren't stored row-by-row, but in a z-shape arrangement which puts neighboring pixels closer together. This makes texture filtering cheaper and you definitely want to use it. Twiddled textures must have power-of-two dimensions (e.g. 512x512, 256x1024).

VQ compressed

Vector Quantization is a lossy texture compression. The Dreamcast graphics chip has special hardware to decode it, so you suffer no performance loss for the decoding step when texture data is read by it for drawing. Textures will use less video memory.

Strided

A way to draw non-power-of-two textures by defining gaps.

Mipmapped

Each texture stores smaller versions of itself (512x256 -> 256x128 -> 128x64..). Makes textures 1/3 bigger, texture filtering cheaper and improves rendering performance when textures are displayed at a smaller than original size.


Converting art assets to Dreamcast texture formats

It is more efficient to convert your PNG/TGA/etc. art assets during the build process of your game instead of during runtime.

There are tools for conversion in the KOS utils folder. Be aware that the KOS conversion tool does not support non-square VQ textures, although it should. This conversion tool by tvspelsfreak offers support for that in addition to a handy preview feature [[2]]


Comparison between uncompressed and compressed

To see how useful applying the proper texture format is, check out this thread