|
|

楼主 |
发表于 2006-11-8 18:08:00
|
显示全部楼层
Re:再论纯关键帧动画
关于较自然的插值方法,举例如下:
一种四POSITION插值算法:
float scale;
VS_OUTPUT Position2_Pass_0_Vertex_Shader_vs_main(
float3 P0 : POSITION0,
float3 P1 : POSITION1,
float3 S0 : POSITION2,
float3 S1 : POSITION3)
{
VS_OUTPUT outPut;
float sc1 = scale,sc0 = 1.0 - scale;
float3 father = sc0 * S0 + sc1 * S1,
res = sc0 * P0 + sc1 * P1;
float3 dst = res - father;
if(any(dst))
outPut.Pos = float4(father + normalize(dst) * ( length(P0 - S0) * sc0 + length(P1 - S1) * sc1),1.0);
else
outPut.Pos = float4(res,1.0);
return outPut;
}
S0,S1为父顶点初态终态,P0,P1为当前顶点初态终态。
比如P为腕上点,S可以为肘上。最终效果接近于P绕S旋转。 |
|