Difference between revisions of "Mesh/Mesh Asset Format"

From Second Life Wiki
Jump to navigation Jump to search
Line 20: Line 20:
* "offset" -- integer -- the offset (in bytes) of the level of detail block in the asset starting from the end of the header
* "offset" -- integer -- the offset (in bytes) of the level of detail block in the asset starting from the end of the header
* "size" -- integer -- the size (in bytes) of the level of detail block
* "size" -- integer -- the size (in bytes) of the level of detail block
=== Physics ===
Each physics entry must contain a "hash" for validation purposes.  The hash is filled in by the simulator at the time of upload and used for every subsequent load to verify that the asset is valid.  Each of these entries must also contain an "offset" and "size" as described by the "Level of Detail" section above.  There are four physics data blocks:
* "physics_mesh" -- Optional, a mesh representing the physical shape of this asset
* "physics_convex" -- Required, a single convex hull encompassing the entire mesh asset plus an (optional) set of convex hulls (known as a convex decomposition) for more detailed collisions.  If the "physics_convex" data block contains such a decomposition, "physics_mesh" MUST be absent, as it will never be used.
* "physics_havok" -- Filled in by simulator at upload time, contains some cached data specific to Havok to improve load time performance on the simulator.
* "physics_cost_data" -- Data needed to determine the physics cost of this asset for any given scale -- contains a single LLMatrix3 ("mesh") in LLSD format defining mesh physics cost constants if a mesh is used.


== Mesh Level of Detail Block ==
== Mesh Level of Detail Block ==

Revision as of 14:39, 7 June 2011

Overview

This document is a specification of the mesh asset format used by Second Life. At its highest level, a mesh asset is a collection of data blocks spread across a file. The sizes, locations, and types of the data elements are described in the header at the beginning of the file. This document will describe the format of the header and each of the data block types it may reference.

Header

The header is an uncompressed, binary encoded LLSD map containing the following elements:

Versioning and Creator Information

  • "version" -- integer -- A version number for the entire asset, filled in by simulator post-import.
  • "creator" -- UUID -- agent id of the agent that uploaded the asset, filled in by simulator
  • "date" -- LLDate (as LLSD, seconds since epoch UTC) of upload, filled in by simulator

Level of Detail

Up to four level of detail blocks may be specified. Level of detail block names are:

  • "high_lod" -- Highest level of detail mesh for this asset, MUST be provided
  • "medium_lod" -- Optional, medium level of detail
  • "low_lod" -- Optional, low level of detail, must NOT be present if "medium_lod" is absent
  • "lowest_lod" -- Optional, lowest level of detail, must NOT be present if "low_lod" is absent


Each level of detail entry must contain the following elements:

  • "offset" -- integer -- the offset (in bytes) of the level of detail block in the asset starting from the end of the header
  • "size" -- integer -- the size (in bytes) of the level of detail block

Physics

Each physics entry must contain a "hash" for validation purposes. The hash is filled in by the simulator at the time of upload and used for every subsequent load to verify that the asset is valid. Each of these entries must also contain an "offset" and "size" as described by the "Level of Detail" section above. There are four physics data blocks:

  • "physics_mesh" -- Optional, a mesh representing the physical shape of this asset
  • "physics_convex" -- Required, a single convex hull encompassing the entire mesh asset plus an (optional) set of convex hulls (known as a convex decomposition) for more detailed collisions. If the "physics_convex" data block contains such a decomposition, "physics_mesh" MUST be absent, as it will never be used.
  • "physics_havok" -- Filled in by simulator at upload time, contains some cached data specific to Havok to improve load time performance on the simulator.
  • "physics_cost_data" -- Data needed to determine the physics cost of this asset for any given scale -- contains a single LLMatrix3 ("mesh") in LLSD format defining mesh physics cost constants if a mesh is used.

Mesh Level of Detail Block

Skin Block

Physics Mesh Block

Physics Convex Block

Physics Havok Block

Physics Cost Data