Appearance Formats

From OpenSimulator

Revision as of 08:39, 26 November 2018 by Ubit (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

The appearance format detailed here is used primarily to transfer appearance information between simulators and backend services, before the simulator uses various components in its own operations (e.g. to send information to viewers as to which attachments are being worn, etc.).

It is also used to store appearance information for NPCs. Unfortunately, in this role it is less than ideal since it wasn't designed to be changed by humans.

Example

Here's is an example appearance serialization for a user wearing skin, eyes, hair and shape body parts, pants and shirt clothing items and a single skull attachment

<llsd>
  <map>
    <key>serial</key>
    <integer>0</integer>
    <key>height</key>
    <real>1.6909986734390259</real>
    <key>wearables</key>
    <array>
      <array>
        <map>
          <key>item</key>
          <uuid>0718fafa-e67a-438e-9431-cd93e83accab</uuid>
          <key>asset</key>
          <uuid>66c41e39-38f9-f75a-024e-585989bfab73</uuid>
        </map>
      </array>
      <array>
        <map>
          <key>item</key>
          <uuid>a394cb67-6d51-4211-b540-939531e558c0</uuid>
          <key>asset</key>
          <uuid>77c41e39-38f9-f75a-024e-585989bbabbb</uuid>
        </map>
      </array>
      <array>
        <map>
          <key>item</key>
          <uuid>63317a84-cebe-4337-b99c-fe8c24286eda</uuid>
          <key>asset</key>
          <uuid>d342e6c0-b9d2-11dc-95ff-0800200c9a66</uuid>
        </map>
      </array>
      <array>
        <map>
          <key>item</key>
          <uuid>2edbb0f7-51ed-47ef-a5ec-0bb16f9fa638</uuid>
          <key>asset</key>
          <uuid>4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7</uuid>
        </map>
      </array>
      <array>
        <map>
          <key>item</key>
          <uuid>9ca33379-159d-4015-bad9-9bedb62033d2</uuid>
          <key>asset</key>
          <uuid>a2d3568a-c1b0-9caf-dd2f-4d3e4d2691e5</uuid>
        </map>
      </array>
      <array>
        <map>
          <key>item</key>
          <uuid>7e152cf6-3103-4be2-a2b6-e4e0bc56f840</uuid>
          <key>asset</key>
          <uuid>00000000-38f9-1111-024e-222222111120</uuid>
        </map>
      </array>
      <array />
      <array />
      <array />
      <array />
      <array />
      <array />
      <array />
      <array />
      <array />
    </array>
    <key>textures</key>
    <array>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>fb4535ad-e21a-482e-a020-b07fb3255214</uuid>
      <uuid>2ed9d686-120d-4e41-82b2-8d469e4658b6</uuid>
      <uuid>bf61d86d-fb38-4b06-a43c-a9451a38c5a6</uuid>
      <uuid>db27d46d-0831-4fa7-b413-8730ed530d9b</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid>
      <uuid>93f7702c-e200-4b0b-8942-b77c1872c0a0</uuid>
    </array>
    <key>visualparams</key>
    <binary encoding="base64">IT1VFzp/P1U/KgBVPyRVX5k/IgA/bViEP4hRVWeIfwDLAAB/AAAAAAB/AAD/f3J/Yz9/jH9/AAAAvwBoAAAAAAAAAAAAkdiFAH8Af6oAAH9/bVV/fz9VKmTY1szMzDMZWUzMAH8AAJBVf4R/VQB/f39/f387f1V/f2ovT39/zAKNQgAAf38AAAAAfwCfAACyfyRVg39/f5lfAIxKG39/ANbMxgAAPx5/4v/G////zDMz////zAD//////////////wD//////wB/f/8ZZP////9UAAAAM4T///8=</binary>
    <key>attachments</key>
    <array>
      <map>
        <key>point</key>
        <integer>2</integer>
        <key>item</key>
        <uuid>322a42e2-4fd4-427d-bee8-bc6ed66ec0f0</uuid>
        <key>asset</key>
        <uuid>a55466ff-6ed4-4277-bfb4-326859494b3f</uuid>
      </map>
    </array>
  </map>
</llsd>

This data is in LLSD xml format where there are <key> entries followed by various data entries, such as <array>, <binary>, etc. This is all generated by OpenSimulator's OpenSim.Framework.AvatarAppearance.Pack() method. It can be turned back into a C# object via AvatarAppearance.Unpack().

  • serial - Appearance serial number, to keep track of appearance changes. For NPC purposes probably unimportant, though best to set this to zero.
  • height - Avatar height in meters.
  • wearables - An array of the clothing and body parts that the avatar is wearing. These are slotted according to the enum OpenMetaverse.WearableType. So, for instance, the second entry (index 1) is skin. Each entry then references an inventory item UUID and an asset UUID. For NPCs, neither of these are actually relevant - the inventory UUID can be ignored since NPCs do not have inventory. Whilst the asset UUID does point towards the relevant asset data (in this example, for the skin asset), it's actually baked textures in the textures entry that are used to display the avatars clothing/bodypart appearance.
  • textures - These <uuid> entries reference avatar baked appearance textures that are sent to users. The index numbers of the slots come from OpenMetaverse.AvatarTextureIndex (e.g. slot index 1 is UpperShirt). c228d1cf-4b5d-4ba8-84f4-899a0796aa97 (OpenMetaverse.AppearanceManager.DEFAULT_AVATAR_TEXTURE) is the default avatar texture and occupies slots which are not actually set. The other UUIDs reference actual stored baked texture assets. In this case, for instance, index 8, fb4535ad-e21a-482e-a020-b07fb3255214, corresponds to AvatarTextureIndex.HeadBaked.
  • visualparams - These are all the visual parameters used to determine the basic appearance of the avatar shape (the parameters you see when you "edit shape" in a viewer, such as Lip Width in the Mouth section). There is probably redundancy with the data stored in the shape asset. Unfortunately, since this format derives from the wire format, the parameters are encoded as a binary blob. They can be decoded (and encoded) using OpenMetaverse.StructuredData.OSDBinary (see AvatarAppearance.Pack() and Unpack() for examples). Not all visual params are currently added - some extra ones have been added by Linden Lab that are not yet handled.
  • attachments - Attachment data. These are the attachments for this appearance. The point key on each entry refers to the attachment point as detailed by OpenMetaverse.AttachmentPoint. In this case, 2 is AttachmentPoint.Skull. Like wearable entries, the clothing item UUID refers to a clothing item that is not used for NPCs. However, in this case the asset UUID is important since attachments are proper objects and not part of the baked texture. The asset UUID refers to the serialized object. This serialization contains the information that govern exact attachment position, rotation, etc.

Database

This data actually originates from the Avatars table in the OpenSimulator database. This is used by the ROBUST AvatarService.

In the Avatars table, data is stored in key:value from for each agent ID. For instance, VisualParams is a comma separated list of all the Avatar visual parameters (height, nose length, etc.). Wearable :<j> lists item and agent IDs for each wearable the avatar has on. _ap_<attachment-point-number> shows the item equipped at each attachment point where applicable.

Personal tools
General
About This Wiki