Morph weights KHR extension
|This article is part of the COLLADA extensions directory|
|Adding to the extensions directory|
- Profile: KHR
- Specification Version: 1.4 and 1.5
- Category: Animation
Enables animation of morph targets through manipulation of their weights.
Morph targets are shape deformations created by applying a set of deltas of vertex positions in a weighted fashion. COLLADA includes the ability to specify morph targets. So far, COLLADA does not include the ability to cleanly animate the weights. This extension aims to enable that animation.
Attributes Name Type Description Required? sid xs:NCName A unique symbol within the technique. Yes count uint Number of weights specified. Yes Related Elements Affected Parent element(s) morph Extra and/or Technique <extra><technique profile="KHR"> Child elements None Other instance_controller animation Child Elements Name Description Default Occurrences N/A N/A N/A N/A
ProblemCurrently, morph weights are specified in a raw float array, and the array is wrapped as a child element of
. That is the root cause of the "morph targets" animation problem in the COLLADA representation, as raw data inside a <source> element cannot be meaningfully addressed by the animation <channel> element. ====Analysis==== A morph controller needs to specify the following data: # Base geometry # Some "morph target" data # Weights to blend (1) and (2) We believe (1) and (2) usually contain large sets of data, and it makes sense to share these data. Hence these data should be specified inside a data container for a morph controller to reference. However, morph weights are relatively few in number, compared to (1) and (2), and we often want to animate these weights, such as in the case of facial animations. ====Solution==== Add a new <morph_weights> element that lists all the morph weights as a 1D target-able float vector. ====Schema==== * Add a new <morph_weights> element within the scope of the <morph> element * <morph_weights> element holds a local vector with a target-able SID attribute * The proposed schema is based on COLLADA 1.5 schema types <xs:element name="morph_weights"> <xs:annotation> <xs:documentation> The morph_weights element contains a 1D float vector that represents the morph weights </xs:documentation> </xs:annotation> <xs:complexType> <xs:simpleContent> <xs:extension base="list_of_floats_type"> <xs:attribute name="sid" type="sid_type" use="required"> <xs:annotation> <xs:documentation> The sid attribute is a text string value containing the sub-identifier of this element. This value must be unique within the scope of the parent element. </xs:documentation> </xs:annotation> </xs:attribute> <xs:attribute name="id" type="xs:ID"> <xs:annotation> <xs:documentation> The id attribute is a text string containing the unique identifier of this element. This value must be unique within the instance document. Optional attribute. </xs:documentation> </xs:annotation> </xs:attribute> <xs:attribute name="count" type="uint_type" use="required"> <xs:annotation> <xs:documentation> The count attribute indicates the number of values in the array. Required attribute. </xs:documentation> </xs:annotation> </xs:attribute> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> ===Example=== An example of a morph controller with a weight value that can be targeted by an animation channel: <library_controllers> <controller id="controllers_0"> <morph source="#geometries_0" method="NORMALIZED"> <source id="controllers_0-MORPH_TARGET"> <IDREF_array count="1" id="controllers_0-MORPH_TARGET-array">geometries_1</IDREF_array> <technique_common> <accessor count="1" stride="1" source="#controllers_0-MORPH_TARGET-array"> <param type="IDREF"/> </accessor> </technique_common>
<float_array count="1" id="controllers_0-MORPH_WEIGHT-array">0.500000</float_array> <technique_common> <accessor count="1" stride="1" source="#controllers_0-MORPH_WEIGHT-array"> <param type="float"/> </accessor> </technique_common>
<targets> <input semantic="MORPH_TARGET" source="#controllers_0-MORPH_TARGET"></input > <input semantic="MORPH_WEIGHT" source="#controllers_0-MORPH_WEIGHT"></input > </targets> <extra> <technique profile="KHR"> <morph_weights sid="MORPH_WEIGHT_TO_TARGET" count="1">0.500000</morph_weights> </technique> </extra> </morph> </controller> </library_controllers>
It is important to note that the <morph> element continues to function without the <extra> information. The <morph_weights> element does not affect or replace the existing MORPH_WEIGHT source array. Instead, the extension restates the morph weight values in an addressable context. Hence, products that support the extension can target the weights in animation channels. Products that don't support the extension can continue to read morph target data as before.
- Copyright 2010, 2011 The Khronos Group.
This extension applies to COLLADA 1.4 and 1.5. This extension does not depend on any other extensions.
- Animating morph weighs may target elements inside <morph>, where <morph> is a child of <library_controllers>/<controller>. Thus when instantiating a <morph> via <instance_controller> all instances would share the same description in that case. In COLLADA, any instantiation policy is application defined.
- In order to support validation, the extension element should be qualified with a namespace prefix and an xmlns attribute declaring that namespace. Recommend using xmlns:ext="http://www.collada.org/2010/COLLADAMorphExt" and <ext:morph_weights> respectively.
Version 1.4 Error Handling
Version 1.5 Error Handling