I've implemented something similar to this before. Not specifically for face
morphing butmorphing between two meshes. As long as your meshes have the
same number of verts
(I forced this condition by adding degenerate verts)  you just need to set
up a blend
linear between the verts you want to morph between. I used a vert shader on
my
original mesh (A) and passed in the final mesh (B) as vertex attributes (an
unused texcoord for example).
Then in the vert shader you can use mix() in glsl or your own blend function
to calculate the
vert position, not exactly but similar to below:

uniform float morphTime; //varies from 0-1

void main()
{

...///other shader stuff

   ///calculate the morph vert position...gl_MultiTexCoord1 stores the vert
for mesh B
    vec4 morphVert = gl_Vertex + morphTime*(gl_MultiTexCoord1 - gl_Vertex);
    ///transform the vert into eyespace
    gl_Position = gl_ModelViewProjectionMatrix*morphVert;

...///do more shader stuff
}


biv

On Jan 3, 2008 4:30 PM, Emre Koc <[EMAIL PROTECTED]> wrote:

> I would like to morph one face to an another face by interpolating
> each vertex's position in two models. Vertex indexes and counts are
> same for each model.
>
> I heard from a friend that I can achieve this by using osgAnimate.
> Does anyone have an idea on how to achieve this morphing effect?
> It would be very helpful if anyone have a sample code on this topic.
>
>
> Thanks in advance,
>
>
> /emre
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to