RBD vertex animation subframe interpolation

   2604   1   0
User Avatar
Member
16 posts
Joined: 2月 2015
Offline
Hey, really enjoying the rbd vertex exporter. I want to expand the provided UE4 shader to handle sub frame interpolation. I've got it close, but something is off with the slerp I am applying to my current and next read in quaternion. Couple questions, in the written out texture, I see the channels G & B swapped, and RGB inverted. Is this to offset the world position? If I read this quaternion in as a color and append the the alpha, is it restored as the correct quaterion? I'm including my hlsl custom slerp code. Its not exploding, but definitly not working as intended. Any thoughts? Has someone already cracked this?





Custom HLSL code for slerp:
float dotp = dot(normalize(q1), normalize(q2));
if ((dotp > 0.9999) || (dotp<-0.9999))
{
if (t<=0.5)
return q1;
return q2;
}
float theta = acos(dotp);
float4 P = ((q1*sin((1-t)*theta) + q2*sin(t*theta)) / sin(theta));
P.w = 1;
return P;

Attachments:
slerp1.JPG (102.9 KB)
slerp2.JPG (82.3 KB)

User Avatar
Member
16 posts
Joined: 2月 2015
Offline
My slerp code was incorrect. This solved my problem.

https://gist.github.com/mattatz/40a91588d5fb38240403f198a938a593 [gist.github.com]
  • Quick Links