Morph weights KHR extension

From COLLADA Public Wiki
Revision as of 21:13, 29 October 2011 by Marcus (talk | contribs) (Morph Weights extension ratified by Khronos)
Jump to navigation Jump to search
Extension information
This article is part of the COLLADA extensions directory
Adding to the extensions directory

<morph_weights> Element

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.

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
Child Elements
Name Description Default Occurrences





Currently, 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.

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.

Add a new <morph_weights> element that lists all the morph weights as a 1D target-able float vector.

* 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">
        The morph_weights element contains a 1D
        float vector that represents the morph weights
        <xs:extension base="list_of_floats_type">
           <xs:attribute name="sid" type="sid_type" use="required">
                   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:attribute name="id" type="xs:ID">
                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:attribute name="count" type="uint_type" use="required">
                The count attribute indicates the number of values in
                the array. Required attribute.

An example of a morph controller with a weight value that can be targeted by an animation channel:

  <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>
      <accessor count="1" stride="1" source="#controllers_0-MORPH_TARGET-array">
       <param type="IDREF"/>
     <float_array count="1" id="controllers_0-MORPH_WEIGHT-array">0.500000</float_array>
      <accessor count="1" stride="1" source="#controllers_0-MORPH_WEIGHT-array">
       <param type="float"/>
    <input semantic="MORPH_TARGET" source="#controllers_0-MORPH_TARGET"></input >
    <input semantic="MORPH_WEIGHT" source="#controllers_0-MORPH_WEIGHT"></input >
    <technique profile="KHR">
     <morph_weights sid="MORPH_WEIGHT_TO_TARGET" count="1">0.500000</morph_weights>

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.


Released 1.0.

IP Status

  • 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.


Some concerns:

  • 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="" and <ext:morph_weights> respectively.

Parsing Errors

Version 1.4 Error Handling

None known.

Version 1.5 Error Handling

None known.