Prim Package Format

From Second Life Wiki
Jump to navigation Jump to search

This document describes the PrimPackage format of serialized object data (prim shapes and textures) from Secondlife.

PrimPackage

A PrimPackage is a zip file containing a single XML file and zero or more texture files. The XML files contains a Linden Lab Structured Data (LLSD) structure serialized with the LLSD XML serializer, and the textures are Targa or JPEG2000 format.

Zip File

Any level of compression may be used, but the file may not have a password or any extended zip features. The file extension must be either .zip or .primpackage. The zip file must contain a file called prims.xml and may contain texture files in either Targa or JPEG2000 format, or a mix of the two. No sub-folders are allowed inside the zip file.

XML File

The prims.xml file must contain one or more prim definitions in a particularly [FINISHME]

Example

(XML Data)

Textures

Textures are in either Targa or JPEG2000 format. Targa files can have one (grayscale), three (red/green/blue), or four (red/green/blue/alpha) layers. JPEG2000 files can have either one (grayscale), two (grayscale/alpha), three (red/green/blue), or four (red/green/blue/alpha) layers but must also be compatible with the official Second Life grid and viewer. In other words, you must be able to upload the exact binary data contained in each JPEG2000 file to the official Second Life grid run by Linden Lab and have that texture show up in-world using the official Linden Lab Second Life viewer. Any size, compression, etc. settings are allowed as long as this requirement is met.

Texture Naming

Texture files must have a UUID for the file name. Random UUIDs should be generated for assets created outside of Second Life, and the asset IDs of textures exported from the Second Life grid should be preserved. The file extension must be either .tga for Targa files or .jp2 for JPEG2000 files. For example, a texture with the UUID a822ff2b-ff02-461d-b45d-dcd10a2de0c2 exported from the grid as a raw JPEG2000 file should be named a822ff2b-ff02-461d-b45d-dcd10a2de0c2.jp2.

Texture Loading

The LLSD structure only contains a UUID for textures, not a full file name. Applications must look for both .tga and .jp2 versions of the texture file, but may prefer to load one over the other. For example an editing application might choose to load Targa files over JPEG2000, but an importing application might prefer the raw JPEG2000 data that can be uploaded directly to a grid.