11011110110011011001100110011001000110011001100111010001011

May 1, 2007

Morphing Mesh in M3G

Filed under: Programming

M3G Specification中已有了详细的说明,根据权值对Mesh做简单的变形:

Denoting the base mesh with B, the morph targets with Ti, and the weights corresponding to the morph targets with wi,
the resultant mesh R is computed as follows:

    R = B + sum [ wi (Ti - B) ]

我们只要做简单的变化,

        R = B + sum[ wi (Ti - B)]

           = B + sum(wi * Ti ) - sum(wi  * B)

           = [1 - sum(wi )] * B + sum(wi * Ti )

这样就容易理解,根据上式也很容易编码。

==============

Kemulator中,是在每次渲染前,根据上式计算出对应的Mesh,如果顶点数比较多,则需要消耗一定的计算时间。
假如遇到有的手机对Morphing Mesh渲染比较慢,就可以考虑自己封装一个Morphing的实现,
当Mesh需要改变时才计算新的mesh,渲染时就不需要额外的计算了。

Comments »

The URI to TrackBack this entry is: http://lyo.blogsome.com/2007/05/01/morphing-mesh-in-m3g/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.