Difference between revisions of "Avatar Appearance"
Line 56: | Line 56: | ||
: '''<skeleton file_name="avatar_skeleton.xml">''' | : '''<skeleton file_name="avatar_skeleton.xml">''' | ||
:: '''''<attachment_point'' id="1" group="6" name="Chest" joint="mChest"''' | :: '''''<attachment_point'' id="1" group="6" name="Chest" joint="mChest"''' | ||
:: | :: position="0.15 0 -0.1" rotation="0 90 90" visible_in_first_person="true" | ||
:: pie_slice="2" hud="true" max_attachment_offset="1.5" '''''/>''''' | :: pie_slice="2" hud="true" max_attachment_offset="1.5" '''''/>''''' | ||
:: '''''<param ... >''''' | :: '''''<param ... >''''' | ||
Line 67: | Line 67: | ||
:Sets of | :Sets of | ||
: '''<mesh type="hairMesh" lod="0" file_name="avatar_hair.llm" min_pixel_width="320">''' | : '''<mesh type="hairMesh" lod="0" file_name="avatar_hair.llm"''' | ||
: min_pixel_width="320" min_pixel_area="0.1" '''>''' | |||
:: '''''<param ... >''''' | :: '''''<param ... >''''' | ||
::: '''<param_morph />''' | ::: '''<param_morph />''' | ||
:::or | :::or | ||
::: '''<param_morph>''' | ::: '''<param_morph>''' | ||
:::: '''''<volume_morph'' name="HEAD" scale="-0.008 -0.006 0.015" | :::: '''''<volume_morph''''' name="HEAD" scale="-0.008 -0.006 0.015" | ||
:::: pos="0.07 0 -0.07" '''''/>''''' | :::: pos="0.07 0 -0.07" '''''/>''''' | ||
::: '''</param_morph>''' | ::: '''</param_morph>''' | ||
Line 78: | Line 79: | ||
: '''</mesh>''' | : '''</mesh>''' | ||
: ''<mesh'' '''type="hairMesh" lod="1" file_name="avatar_hair_1.llm"''' | : ''<mesh'' '''type="hairMesh" lod="1" file_name="avatar_hair_1.llm"''' | ||
: | : min_pixel_width="160" min_pixel_area="0.1" '''reference="avatar_hair.llm"'''''>'' | ||
: ''</mesh>'' | : ''</mesh>'' | ||
Line 94: | Line 95: | ||
: clear_alpha="false" alpha_tga_file="head_alpha.tga" '''''>''''' | : clear_alpha="false" alpha_tga_file="head_alpha.tga" '''''>''''' | ||
:: '''''<layer'' name="head bump definition" render_pass="bump" | :: '''''<layer'' name="head bump definition"''' render_pass="bump" | ||
:: global_color="hair_color" fixed_color="128,128,128,255" | :: global_color="hair_color" fixed_color="128,128,128,255" | ||
:: write_all_channels="true" '''''>''''' | :: write_all_channels="true" '''''>''''' | ||
Line 102: | Line 103: | ||
::: <texture '''tga_file="bump_head_base.tga"''' file_is_mask="FALSE" /> | ::: <texture '''tga_file="bump_head_base.tga"''' file_is_mask="FALSE" /> | ||
::: ''<morph_mask | ::: ''<morph_mask'' morph_name="Displace_Loose_Upperbody" invert="FALSE" ''/>'' | ||
::: ''<param ... >'' | ::: ''<param ... >'' | ||
:::: '''<param_alpha | :::: '''<param_alpha''' tga_file="bump_face_wrinkles.tga" skip_if_zero="true" | ||
:::: multiply_blend="false" domain="0" '''/>''' | |||
:::: multiply_blend="false" | |||
::::or | ::::or | ||
:::: '''<param_color''' operation="multiply" '''>''' | :::: '''<param_color''' operation="multiply" '''>''' | ||
Line 127: | Line 127: | ||
'''</linden_avatar>''' | '''</linden_avatar>''' | ||
where '''bold''' text indicates required tags or parameters, ''italics'' | where '''bold''' text indicates required tags or parameters, standard text | ||
indicates a tag that can occur zero or one time, ''italics'' | |||
indicates that the tag can be repeated zero or more times, and '''''bold italics''''' indicates | indicates that the tag can be repeated zero or more times, and '''''bold italics''''' indicates | ||
that at least one is required but more are possible | that at least one is required but more are possible. | ||
Note that the values shown for parameters here may not be consistent. They are shown only | Note that the values shown for parameters here may not be consistent. They are shown only | ||
to indicate the value type. | to indicate the value type. | ||
===Parameter detail=== | ===Parameter detail=== | ||
Line 146: | Line 147: | ||
: show_simple="true" simple_percent_min="40" simple_percent_max="100" | : show_simple="true" simple_percent_min="40" simple_percent_max="100" | ||
: camera_distance="2.2" camera_elevation=".1" camera_angle="0" '''>''' | : camera_distance="2.2" camera_elevation=".1" camera_angle="0" '''>''' | ||
===Loading the file=== | |||
The file is parsed in LLVOAvatar::initClass() primarily by calls to LLVOAvatarInfo. Both classes are defined in indra\newview\llvoavatar.h(.cpp). | |||
There is one method for each of the major XML nodes | |||
:LLVOAvatarInfo::parseXmlSkeletonNode | |||
:LLVOAvatarInfo::parseXmlMeshNodes | |||
:LLVOAvatarInfo::parseXmlColorNodes | |||
:LLVOAvatarInfo::parseXmlLayerNodes | |||
:LLVOAvatarInfo::parseXmlDriverNodes | |||
This data is then used to create instances of LLVOAvatar in LLVOAvatar::loadAvatar() | |||
which invokes LLVOAvatar::loadSkeletonNode() and LLVOAvatar::loadMeshNodes(). |
Revision as of 17:17, 5 March 2007
Packets
- AgentWearablesRequest
- This is where it starts. The viewer asks the simulator what it is wearing, and an AgentWearablesUpdate packet is returned.
- AgentWearablesUpdate
- A mapping of wearable types to asset IDs and item IDs is returned to the client. There are currently 13 different wearable types and all 13 will always be returned in this packet. If your avatar is not wearing a wearable type the asset ID and item ID for that type will be null IDs (all zeros). The next step is to request an asset transfer for all of the non-null asset IDs and download the wearable assets.
- AgentIsNowWearing
- Like the AgentWearablesUpdate packet but in the other direction. The viewer sends a list of the 13 wearable types and their associated item IDs, or null if nothing is being worn in that wearable slot. This is typically sent right before AgentSetAppearance.
- AgentSetAppearance
- Serves two purposes, to tell the server how our avatar mesh is deformed (with visual parameters) and what textures we are wearing. There are currently 218 VisualParam blocks sent with each AgentSetAppearance describing everything from the color of the avatar eyes to the gender slider. A TextureEntry is also sent that uses the same TextureEntry format objects use, but each "face" is hard-coded to describe a particular texture. This may or may not include baked textures for the five different baked layers (head, upper, lower, eyes, and skirt).
- The ParamValue fields do not have parameter IDs associated with them in the packet, as it's assumed all viewers have the same parameter map in the same sequence. The parameters are stored internally as a floating point integer, and are converted to a single byte by inputting the value along with minimum and maximum weights for that parameter to a conversion function.
Linden avatar definition file
The parameters affecting avatar appearance are defined in an XML file located in the executable at
- SecondLife\character\avatar_lad.xml
and in the source code at
- linden\indra\newview\character\avatar_lad.xml
With a few exceptions
- genepool.xml
- rouge_alpha.tga
- underpants_trial_female.tga
- underpants_trial_male.tga
- undershirt_trial_female.tga
- upperbodyfreckles_alpha.tga
all of the other files in the same directory are referenced by avatar_lad.xml. These include the mesh files (.llm), the texture files (.tga) and the avatar_skeleton.xml file.
genepool.xml contains parameter sets for wearable types WT_SHAPE, WT_SKIN, WT_HAIR, and WT_EYES for several archetypal avatar definitions. You can see the current parameter set for your own avatar by invoking the debug menus (Ctrl-Alt-D) and selecting Client->Character->Character Tests->Appearance To XML. This will create a file
- SecondLife\character\new archetype.xml
in the same format as genepool.xml.
The avatar definition file affects the appearances on your viewer only. Any change to the file will not affect how others see the avatars. You can set value_default="1" for "Express_Tongue_Out" to make the avatars on your viewer give you the raspberries, but no one else will notice.
The interesting thing is that this file defines parameters that can be used in animations.
File structure
<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<linden_avatar version="1.0" wearable_definition_version="22">
- <skeleton file_name="avatar_skeleton.xml">
- <attachment_point id="1" group="6" name="Chest" joint="mChest"
- position="0.15 0 -0.1" rotation="0 90 90" visible_in_first_person="true"
- pie_slice="2" hud="true" max_attachment_offset="1.5" />
- <param ... >
- <param_skeleton>
- <bone name="mNeck" scale="0 0 .2" offset="0 0 .004" />
- </param_skeleton>
- <param_skeleton>
- </param>
- </skeleton>
- Sets of
- <mesh type="hairMesh" lod="0" file_name="avatar_hair.llm"
- min_pixel_width="320" min_pixel_area="0.1" >
- <param ... >
- <param_morph />
- or
- <param_morph>
- <volume_morph name="HEAD" scale="-0.008 -0.006 0.015"
- pos="0.07 0 -0.07" />
- </param_morph>
- </param>
- <param ... >
- </mesh>
- <mesh type="hairMesh" lod="1" file_name="avatar_hair_1.llm"
- min_pixel_width="160" min_pixel_area="0.1" reference="avatar_hair.llm">
- </mesh>
- <global_color name="skin_color">
- <param ... >
- <param_color operation="blend" >
- <value color="252, 215, 200, 255" />
- </param_color>
- <param_color operation="blend" >
- </param>
- <param ... >
- </global_color>
- <layer_set body_region="head" width="512" height="512"
- clear_alpha="false" alpha_tga_file="head_alpha.tga" >
- <layer name="head bump definition" render_pass="bump"
- global_color="hair_color" fixed_color="128,128,128,255"
- write_all_channels="true" >
- <texture local_texture="lower_jacket" local_texture_alpha_only="true" />
- and if not fixed_color
- <texture tga_file="bump_head_base.tga" file_is_mask="FALSE" />
- <morph_mask morph_name="Displace_Loose_Upperbody" invert="FALSE" />
- <param ... >
- <param_alpha tga_file="bump_face_wrinkles.tga" skip_if_zero="true"
- multiply_blend="false" domain="0" />
- or
- <param_color operation="multiply" >
- <value color="0, 0, 0, 0" />
- </param_color>
- </param>
- <param ... >
- </layer>
- </layer_set>
- <driver_parameters>
- <param ... >
- <param_driver>
- <driven id="628" min1="0.1" max1="0.5" max2="1" min2="1" />
- </param_driver>
- <param_driver>
- </param>
- <param ... >
- </driver_parameters>
</linden_avatar>
where bold text indicates required tags or parameters, standard text indicates a tag that can occur zero or one time, italics indicates that the tag can be repeated zero or more times, and bold italics indicates that at least one is required but more are possible.
Note that the values shown for parameters here may not be consistent. They are shown only to indicate the value type.
Parameter detail
<param ... > is
- <param id="32" group="1" name="Male_Skeleton"
- value_min="0" value_max="1" value_default="0"
- edit_group="shape_body" edit_group_order="1"
- label="Skeleton" label_min="Female" label_max="Male"
- wearable="shape" clothing_morph="true" sex="male" shared="1"
- show_simple="true" simple_percent_min="40" simple_percent_max="100"
- camera_distance="2.2" camera_elevation=".1" camera_angle="0" >
Loading the file
The file is parsed in LLVOAvatar::initClass() primarily by calls to LLVOAvatarInfo. Both classes are defined in indra\newview\llvoavatar.h(.cpp). There is one method for each of the major XML nodes
- LLVOAvatarInfo::parseXmlSkeletonNode
- LLVOAvatarInfo::parseXmlMeshNodes
- LLVOAvatarInfo::parseXmlColorNodes
- LLVOAvatarInfo::parseXmlLayerNodes
- LLVOAvatarInfo::parseXmlDriverNodes
This data is then used to create instances of LLVOAvatar in LLVOAvatar::loadAvatar() which invokes LLVOAvatar::loadSkeletonNode() and LLVOAvatar::loadMeshNodes().