Data types

From Tech Artists Wiki

Jump to: navigation, search

Contents

Signed/Unsigned

Data - whether a pixel, float, or integer - can only have a certain range of accuracy. A signed number has a sign (positive or negative) assigned to it. So half of the range of accuracy is positive, and half is negative. For an unsigned number, the entire range of accuracy is in the positive range (minimum value of 0).

For a discussion of signed images, see Signed/Unsigned DDS formats.

Numbers

Integer

  • byte (1 byte)
  • Signed: −128 to +127
  • Unsigned: 0 to +255
  • short/half (2 bytes)
  • Signed: −32,768 to +32,767
  • Unsigned: 0 to +65,535
  • integer (4 bytes)
  • Signed: −2,147,483,648 to +2,147,483,647
  • Unsigned: 0 to +4,294,967,295
  • double/long (8 bytes)
  • Signed: −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
  • Unsigned: 0 to +18,446,744,073,709,551,615

Note: some languages have an integer type available that will store it as large as available computer memory

Float

Note that floating point numbers are 'higher level' than integers- when doing math between an integer and a float, the result will always be a float.

  • float (8 bytes)
  • Range: 1.5*10-45 to 3.4*1038
  • double (8 bytes)
  • Range: 5.0*10-324 to 1.7*10308

Float2/3/4 (Vector)

Vector values are simply a series of floats to represent floating point values in 2, 3, or 4 dimensional space. They are sometimes called "point" values in 3ds max (point2, point3, etc.).

Color

Some programs treat color values separately. Colors work differently in different apps and languages, so it is important to understand how your app uses them, if at all.

See also: Color space

Matrix

A matrix is rows and columns of integer or floating point numbers of an arbitrary size. The most common matrices are for transforms, and are 4x4. Matrices are indexed by the row, then the column, and usually by 0 (depending on language). For example, theMatrix[1][3], would return the value in the second row, fourth column, of the matrix theMatrix.

See also: Transform and Matrix Primer

Boolean

A boolean is true or false (sometimes on or off as well). Some languages (such as Python) treat booleans as 1 and 0 for true and false, while some (such as MAXScript) treat booleans as a unique data type.

Data

Character (char)

A char is a single character, and only a single character. Behind the scenes, it is an integer that is assigned to some sort of chart or lookup for an encoding, such as ASCII or Unicode. They behave different from strings (adding two chars, for example, adds their integers, and does not concatenate their values). Many scripting languages don't have support for chars, and the uses for a technical artist are few.

String

A string is a series of characters (or just one). Different languages treat strings differently (such as what methods are available, what string literals are used, etc.), but their use is too important, too varied, and too obvious to document here. Refer to your language's reference on strings for more info.

Collections

Collections refer to groupings of data into a single variable. Different languages call different types of collections by different things, so it is not possible to classify them by name, as it is for number types. But even though their names are different, most collections in various languages follow the same concepts.


Sets

Personal tools