Image System

See Also

Notes

Overview

The image system handles the requesting, loading, and decoding of texture data. It also handles passing the data to OpenGL, and discarding unwanted data. It uses a priority scheme to determine what data to load and to discard.

Definitions

Format

SecondLife transmits JPEG 2000 image codestreams as described in Appendix A of JPEG 2000 Part I Final Committee Draft Version 1.0 which are decoded in the client and sent to OpenGL as uncompressed 24 bit or 32 bit textures.

JPEG-2000 is a highly efficient compression method, allowing for very small compressed file sizes, which in turn helps to reduce Linden Lab's asset storage. However, the cost to users of the Second Life client is that JPEG-2000 is much more processor intensive than other compression image methods, and so is a major contributing factor for the slow "rezzing" of textures by the client, even when these compressed textures exist in a local disk cache.

After the image data has been decompressed, it is stored only in system memory of the client. When the avatar teleports to a new but similar location using similar textures, the decompressed data is simply discarded and every texture is regenerated from the original compressed JPEG-2000 textures. No attempt is made to write the decoded image data to a secondary image cache to eliminate the decompression penalty.

Discard Level and Mip Mapping

Discard level 0 represents the highest resolution version of a texture. Discard level 1 represents a texture half the resolution of discard level 0 in each dimension, so one quarter of the pixel area and one quarter of the required texture memory. It is primarily a function of total pixel area, e.g. if a 256x256 texture is covering a 128x128 portion of the screen, the desired discard level is 1.

Prioritization

This is an approximation of the total number of pixels of a texture from all faces that are currently being rendered. This is a factor in determining the priority (see below) of a texture.

This is an approximation of the maximum number of pixels of a texture on a single face that are currently being rendered. This is the primary factor in determining the desired discard level (see below) of a texture.

This is used to increase the prioritization of some textures over others. For example, textures on selected faces are boosted.

Also referred to as decode priority, this is used to determine in what order texture data is downloaded and decoded. It is a function of the total pixel area, the boost level, and the difference between the current discard level and the desired discard level.

Feature Description

Texture Pipeline

  1. Requests are sent to the texture fetcher for texture data
  2. The texture fetcher does the following with each request:
    1. Load data from cache if available
    2. Send requests to the servers for additional texture data if needed
    3. Receive data from the servers
    4. Cache received data
    5. Decode the texture
  3. When the texture data is ready the render pipeline is notified
  4. The decoded texture data is passed to OpenGL for rendering

Code Description

LLImage

LLViewerImage

LLTextureFetch

LLTextureCache

More information can be found in the Texture cache article