SFImage


Purpose:

SFImage is a single-value field that is found in the Texture2 node. This field contains an uncompressed 2-dimensional color or greyscale image.

Explanation

This field is written as three integers representing the width, height, and number of components in the image. This is followed by a number of hexadecimal values representing the pixels in the image. This number of hexadecimal values is determined by the formula width * height. This is all separated by whitespace.

A one-component image will have a one-byte hexadecimal value representing the intensity of the image. For example, 0xFF represents full intensity while 0x00 signifies no intensity.

A two-component image puts the intensity in the first, or high, byte and the transparency in the second, or low, byte.

Pixels in a three-component image have the red component in the first byte, followed by the green and blue components. Red would therefore be 0xFF0000.

Four component images put the transparency byte after the red/green/blue. A semi-transparent blue would be 0x0000FF80.

A value of 1.0 is completely transparent and a value of 0.0 is completely opaque. Keep in mind that each pixel is read as a single unsigned number. This means that a 3-component pixel with value "0x0000FF" can also be written as "0xFF" or "255."

Examples

1 1 1 0xFF 0x00

This represents a one pixel wide by two pixel high greyscale image, with the bottom pixel white and the top pixel black.

2 4 3 0xFF0000 0xFF00 0 0 0 0 0xFFFFFF 0xFFFF00

This represents a two pixel wide by four pixel high RGB image, with the bottom left pixel red, the bottom right pixel green, the two middle rows of pixels black, the top left pixel white, and the top right pixel yellow.