File Formats, Channels and Colour Depth

When choosing the correct file formats to work with, people will tend to either use .jpg or .tga because they’ve been using it for years, or have no idea what to use out of the tens of formats available. The aim of this section is to demystify file formats by breaking them down into four main areas of consideration: type, number of channels, colour depth and compression.

2D File Formats

2D film formats are those formats that hold only 2D image data and metadata, not 3D information.

Below are a list of the more common 2D film formats used in the visual effects industry:

.avi (Audio Video Interleave)
.cin (Kodak Cineon Bitmap)
.dpx (Digital Picture Exchange)
.dtex (Deep Textures)
.exr (openEXR)
.hdr (High Dynamic Range Image)
.jpg (Joint Photographic Group)
.iff (Interchange File Format)
.png (Portable Network Graphic)

.psd (Adobe Photoshop Document)
.mov (QuickTime)
.r3d (RedCode Raw)
.sgi (Silicon Graphics Image)
.ptex (Per-Face Texture Map)
.tif (Tagged Image File Format)
.tga (Truevision Targa Graphics)
.rla (Wavefront RLA)
.psd (Adobe Photoshop Document)

2D Colour Depths

When it comes to talking about colour depths there is an old school mindset that can sometimes bring confusion. Below is a screen grab from the 2014 Autodesk 3dsMax manual (Managing Scenes, Files, and Projects > Image File Formats > TGA (Targa) Files). Note the wording on the left, 24 or 32 bits. This is assuming 24 bits is RGB and 32 bits is RGB + Alpha.

3dsMaxBits
The thought behind this is that 8 bits (256 colours per channel) + 8 bits + 8 bits = 24 bits. Then when you add in another 8 bits for the Alpha you get 32 bits – this seems to make sense, but it’s wrong! We know this because a .tga file can only support 16.7 million colours.

The correct bit depths are listed below.

Working out the maths…
2^bit depth, ie 2^8 = 256 Colour Per Channel
256³ (or 256x256x256) = 16,777,216 (16.7 million)
Based on the ‘Short scale, U.S. and Modern British’

The next question is, which file formats support which bit depths?

8 bit
.bmp (integer)
.jpg (integer)
.png (integer)
.rla (integer)
.sgi (integer)
.tif (float)
.tga (integer)
.yuv (integer)

10 bit
.cin (float)
.dpx (float)

16 bit
.cin (float)
.dpx (float)
.exr (float)
.iff (integer)
.psd (float)
.png (integer)
.rla (integer)
.sgi (integer)
.tif (float)

32 bit
.exr (float)
.hdr (float)
.psd (float)
.rla (integer)
.tif (float)
.dtex (float)
.ptex (float)

Float vs. Integer

Some file formats can support both Integer and Float (or Log) whereas others are only Integer. With 16 bit for example, both formats still hold the same number of colours but Float can vary the range of data (HDR support) whereas Integer can only support values from 0 to 1.

In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16. A number is typically represented in the form:
Significant digits × base exponent

The term floating point refers to the fact that the radix point (decimal point, or, more commonly in computers, binary point) can “float”; that is, it can be placed anywhere relative to the significant digits of the number. This position is indicated separately in the internal representation, and floating-point representation can thus be thought of as a computer realisation of scientific notation. Over the years, a variety of floating-point representations have been used in computers. However, since the 1990s, the most commonly encountered representation is that defined by the IEEE 754 Standard.

The advantage of floating-point representation over fixed-point and integer representation is that it can support a much wider range of values. For example, a fixed-point representation that has seven decimal digits with two decimal places can represent the numbers 12345.67, 123.45, 1.23 and so on, whereas a floating-point representation (such as the IEEE 754 decimal32 format) with seven decimal digits could in addition represent 1.234567, 123456.7, 0.00001234567, 1234567000000000, and so on. The floating-point format needs slightly more storage (to encode the position of the radix point), so when stored in the same space, floating-point numbers achieve their greater range at the expense of precision.

The speed of floating-point operations, commonly referred to in performance measurements as FLOPS, is an important machine characteristic, especially in software that performs large-scale mathematical calculations.

Channels

The next option for file formats after how many colours they can support, is the number of channels they can hold. For example a .jpg can support only colour (RGB) so it has 3 channels. Where as a .tga can support RGB and Alpha, so it can hold up to 4 channels of data.

Below is a chart showing the various Visual Effects file formats arranged by the number of channels each can support.

3 channels
.avi
.cin
.hdr
.jpg

4 channels
.dpx
.mov
.pic
.png
.ptex
.tga

6 channels
.ptex

18 channels
.rla

500 channels
.psd
.tif

1,023 channels
.exr

3D File Formats

When it comes to 3D interchangeable file formats, the options are much smaller than 2D. Each 3D program has its own format of course, but moving data between applications requires a format that can be read on multiple systems. Below are a list of 3D file formats and the data they support.

3dFormats