Difference between revisions of "Mesh/Avatar Shape XML Format"

From Second Life Wiki
Jump to navigation Jump to search
m
m (clarify what SSA is)
 
(14 intermediate revisions by 3 users not shown)
Line 2: Line 2:
== History ==
== History ==
The Shape XML format has been ingrained in the viewer since the early days, long before mesh existed. However, with the addition of rigged mesh and customized clothing, the file has become invaluable to creators. Sometimes called an "archetype file" due to it's default name "new_archetype.xml".
The Shape XML format has been ingrained in the viewer since the early days, long before mesh existed. However, with the addition of rigged mesh and customized clothing, the file has become invaluable to creators. Sometimes called an "archetype file" due to it's default name "new_archetype.xml".
With the release of [[Project_Sunshine-Server_Side_Appearance|Server Side Appearance]] in Early 2013, The XML format has inherited additional information. However, its XML version number is still 1.0, and it is still backward compatible with the original terse format. The additions will be outlined separately in the SSA Extensions section.


== Header ==
== Header ==
The file is standard XML, with 3 parameters:
The file is standard XML, with 3 parameters:


* <?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
* <source lang="xml"><?xml version="1.0" encoding="US-ASCII" standalone="yes"?></source>
** The 'version' parameter sets the version of the XML markup. (should always be 1.0)
** The <code>version</code> parameter sets the version of the XML markup. (should always be 1.0)
** The 'encoding' parameter sets the character encoding for the file. (should always be US-ASCII)
** The <code>encoding</code> parameter sets the character encoding for the file. (should always be US-ASCII)
** The 'standaline' parameter informs that the file is self-containted, and not dependent on any external files. (should always be yes)
** The <code>standalone</code> parameter informs that the file is self-containted, and not dependent on any external files. (should always be yes)
  (note that some viewers set standalone="true".  This is technically incorrect via the XML standard. It should be "yes")
 
'''Note that some viewers''' set <code>standalone="true"</code>.  This is technically incorrect via the XML standard. It should be <code>standalone="yes"</code>.


== Root Node ==
== Root Node ==
The root node is of type 'linden_genepool' witih 1 parameter:


* <linden_genepool version="1.0">
The root node is of type <code>linden_genepool</code> with one parameter:
** The 'version' parameter sets the version of the data contained in the node. Currently LL's data is version 1.0. Future revisions may increment this version, so any implementation should check this version number before using the data.
 
* <source lang="xml"><linden_genepool version="1.0"></source>
** The <code>version</code> parameter sets the version of the data contained in the node. Currently LL's data is version 1.0. Future revisions may increment this version, so any implementation should check this version number before using the data.


== Data Body ==
== Data Body ==
The Root node contains one node of type 'archetype' with one parameter.


*<archetype name="???">
The Root node contains one node of type <code>archetype</code> with one parameter.
** The 'name' parameter is a information parameter, and can contain anything, or nothing. Most commonly populated with 3 question marks.
 
*<source lang="xml"><archetype name="???"></source>
** The <code>name</code> parameter is a information parameter, and can contain anything, or nothing. Most commonly populated with 3 question marks.


== The Data ==
== The Data ==
The data inside is a list of parameters and textures associated with the Avatar's appearance. These can be broken up into 4 categories:
The data inside is a list of parameters and textures associated with the Avatar's appearance. These can be broken up into 4 categories:


Line 32: Line 38:
* Eyes
* Eyes


Each category will have several "param" nodes and possibly "texture" nodes included. More about these nodes in the next section.
Each category will have several <code>param</code> nodes and possibly <code>texture</code> nodes included. More about these nodes in the next section.


== Param Nodes ==
== Param Nodes ==
"param" nodes correspond to sliders in the appearance pane. Each has 3 parameters:
 
** The 'id' parameter corresponds to an internal viewer table of possible sliders. These numbers are guaranteed to be unique, and always correspond to the same slider.
<code>param</code> nodes correspond to sliders in the appearance pane. Each has 3 parameters:
** The 'name' parameter corresponds to internal 'driving elements' in the viewer. This can vary depending on the type of param. For shapes, it's often the name of the morph being controlled. For skins or eyes, it's usually a material that's being changed (color etc).  For hair, a combination of both are present. These are *not* always unique. For example, there are two parameters called "torso muscles", with different IDs (one for male, one for female).
*Example: <source lang="xml"><param id="649" name="torso muscles" value="0.500"/></source>
** The 'value' parameter is the value of the slider. It is however in the internally used format, not the 0-100 value seen by Residents. Calculating what these values mean requires finding the Minimum and Maximum of that value from other sources, such as the [[Avatar_Appearance#Linden_avatar_definition_file|Linden Avatar Definition File]] (avatar_lad.xml)
** The <code>id</code> parameter corresponds to an internal viewer table of possible sliders. These numbers are guaranteed to be unique, and always correspond to the same slider.
** The <code>name</code> parameter corresponds to internal 'driving elements' in the viewer. This can vary depending on the type of param. For shapes, it's often the name of the morph being controlled. For skins or eyes, it's usually a material that's being changed (color etc).  For hair, a combination of both are present. These are '''not''' always unique. For example, there are two parameters called "torso muscles", with different IDs (one for male, one for female).
** The <code>value</code> parameter is the value of the slider. It is however in the internally used format, not the 0-100 value seen by Residents. Calculating what these values mean requires finding the Minimum and Maximum of that value from other sources, such as the [[Avatar_Appearance#Linden_avatar_definition_file|Linden Avatar Definition File]] (avatar_lad.xml)


== Texture Nodes ==
== Texture Nodes ==
"texture" nodes correspond to textures applied via the appearance pane. Each has 2 parameters:
 
** The 'te' parameter corresponds to an internal viewer table of possible textures. These numbers are guaranteed to be unique.
<code>texture</code> nodes correspond to textures applied via the appearance pane. Each has two parameters:
** The 'uuid' parameter corresponds to the UUID of the texture applied at the time of the XML creation.
*Example: <source lang="xml"><texture te="3" uuid="00000000-0000-4000-8000-000000000000"/></source>
  Note that 'texture' nodes are optional and not guaranteed to be present. Especially when the file is generated from 3rd party sources.
** The <code>te</code> parameter corresponds to an internal viewer table of possible textures. These numbers are guaranteed to be unique.
** The <code>uuid</code> parameter corresponds to the [[UUID]] of the texture applied at the time of the XML creation.
 
'''Note that <code>texture</code> nodes are optional''' and not guaranteed to be present. Especially when the file is generated from 3rd party sources.
 
== Comments ==
 
Comments are styled in the standard HTML style, with the string <source lang="xml"><!--</source> denoting the start of a comment, and <source lang="xml">--></source> denoting the end of a comment. This is per the XML specification.
*Example: <source lang="xml"><!-- wearable: shape --></source>


== File Termination ==
== File Termination ==
The file is terminated by the closing of the 'archetype' and 'linden_genepool' nodes:


*</archetype></linden_genepool>
The file is terminated by the closing of the <code>archetype</code> and <code>linden_genepool</code> nodes:
 
*<source lang="xml"></archetype></linden_genepool></source>
 
== SSA Extensions ==
The Two main changes with [[Project_Sunshine-Server_Side_Appearance|Server Side Appearance]]  are the addition of '''many''' new <code>param</code> nodes , and the inclusion of new data in all <code>param</code> nodes.
*The additional <code>param</code> nodes now cover more than just the avatar's body shape and texture. Now, there is data for every possible avatar appearance modifier, including all clothes layers, alpha layers, tattoo layers, all internal morphs, and all settings for these items. In short there is every bit of data needed to completely recreate the entire avatar's 'look'.
*The new parameters included in the <code>param</code> nodes is ''in addition to'' the original parameters. All of the originally available parameters are still provided. The new parameters are as follows:
**The <code>u8</code> parameter is a short integer normalized representation of the displayed slider value. Whereas before some complex math was necessary to determine what 0-100 slider value was indicated by the morph value in the <code>value</code> parameter, now you can simply take the u8 value, divide it by 255, then multiply that value by 100. That will give you the displayed slider values.  255 would be a slider value of 100, 128 would be a slider value of 50, and 0 would of course be 0.
**The <code>type</code> parameter is a rough indication of what kind of data the <code>param</code> entry is associated with. There seem to be 5 distinct values, which likely correspond to entries in the [[Avatar_Appearance#Linden_avatar_definition_file|Linden Avatar Definition File]] (avatar_lad.xml)
*** param_morph, param_driver, param_skeleton, param_color, param_alpha
** The <code>wearable</code> parameter further groups <code>param</code> entries into distinct groups. These clearly indicate what avatar component the <code>param</code> node is associated with. There seem to be 16 distinct values:
*** shape, hair, invalid, gloves, eyes, skin, pants, shoes, shirt, jacket, socks, underpants, undershirt, skirt, tattoo, physics
** The <code>invalid</code> wearable indicates a morph.

Latest revision as of 11:20, 28 March 2016

History

The Shape XML format has been ingrained in the viewer since the early days, long before mesh existed. However, with the addition of rigged mesh and customized clothing, the file has become invaluable to creators. Sometimes called an "archetype file" due to it's default name "new_archetype.xml".

With the release of Server Side Appearance in Early 2013, The XML format has inherited additional information. However, its XML version number is still 1.0, and it is still backward compatible with the original terse format. The additions will be outlined separately in the SSA Extensions section.

Header

The file is standard XML, with 3 parameters:

  • <?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
    
    • The version parameter sets the version of the XML markup. (should always be 1.0)
    • The encoding parameter sets the character encoding for the file. (should always be US-ASCII)
    • The standalone parameter informs that the file is self-containted, and not dependent on any external files. (should always be yes)

Note that some viewers set standalone="true". This is technically incorrect via the XML standard. It should be standalone="yes".

Root Node

The root node is of type linden_genepool with one parameter:

  • <linden_genepool version="1.0">
    
    • The version parameter sets the version of the data contained in the node. Currently LL's data is version 1.0. Future revisions may increment this version, so any implementation should check this version number before using the data.

Data Body

The Root node contains one node of type archetype with one parameter.

  • <archetype name="???">
    
    • The name parameter is a information parameter, and can contain anything, or nothing. Most commonly populated with 3 question marks.

The Data

The data inside is a list of parameters and textures associated with the Avatar's appearance. These can be broken up into 4 categories:

  • Shape
  • Skin
  • Hair
  • Eyes

Each category will have several param nodes and possibly texture nodes included. More about these nodes in the next section.

Param Nodes

param nodes correspond to sliders in the appearance pane. Each has 3 parameters:

  • Example:
    <param id="649" name="torso muscles" value="0.500"/>
    
    • The id parameter corresponds to an internal viewer table of possible sliders. These numbers are guaranteed to be unique, and always correspond to the same slider.
    • The name parameter corresponds to internal 'driving elements' in the viewer. This can vary depending on the type of param. For shapes, it's often the name of the morph being controlled. For skins or eyes, it's usually a material that's being changed (color etc). For hair, a combination of both are present. These are not always unique. For example, there are two parameters called "torso muscles", with different IDs (one for male, one for female).
    • The value parameter is the value of the slider. It is however in the internally used format, not the 0-100 value seen by Residents. Calculating what these values mean requires finding the Minimum and Maximum of that value from other sources, such as the Linden Avatar Definition File (avatar_lad.xml)

Texture Nodes

texture nodes correspond to textures applied via the appearance pane. Each has two parameters:

  • Example:
    <texture te="3" uuid="00000000-0000-4000-8000-000000000000"/>
    
    • The te parameter corresponds to an internal viewer table of possible textures. These numbers are guaranteed to be unique.
    • The uuid parameter corresponds to the UUID of the texture applied at the time of the XML creation.

Note that texture nodes are optional and not guaranteed to be present. Especially when the file is generated from 3rd party sources.

Comments

Comments are styled in the standard HTML style, with the string

<!--

denoting the start of a comment, and

-->

denoting the end of a comment. This is per the XML specification.

  • Example:
    <!-- wearable: shape -->
    

File Termination

The file is terminated by the closing of the archetype and linden_genepool nodes:

  • </archetype></linden_genepool>
    

SSA Extensions

The Two main changes with Server Side Appearance are the addition of many new param nodes , and the inclusion of new data in all param nodes.

  • The additional param nodes now cover more than just the avatar's body shape and texture. Now, there is data for every possible avatar appearance modifier, including all clothes layers, alpha layers, tattoo layers, all internal morphs, and all settings for these items. In short there is every bit of data needed to completely recreate the entire avatar's 'look'.
  • The new parameters included in the param nodes is in addition to the original parameters. All of the originally available parameters are still provided. The new parameters are as follows:
    • The u8 parameter is a short integer normalized representation of the displayed slider value. Whereas before some complex math was necessary to determine what 0-100 slider value was indicated by the morph value in the value parameter, now you can simply take the u8 value, divide it by 255, then multiply that value by 100. That will give you the displayed slider values. 255 would be a slider value of 100, 128 would be a slider value of 50, and 0 would of course be 0.
    • The type parameter is a rough indication of what kind of data the param entry is associated with. There seem to be 5 distinct values, which likely correspond to entries in the Linden Avatar Definition File (avatar_lad.xml)
      • param_morph, param_driver, param_skeleton, param_color, param_alpha
    • The wearable parameter further groups param entries into distinct groups. These clearly indicate what avatar component the param node is associated with. There seem to be 16 distinct values:
      • shape, hair, invalid, gloves, eyes, skin, pants, shoes, shirt, jacket, socks, underpants, undershirt, skirt, tattoo, physics
    • The invalid wearable indicates a morph.