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;
RBD vertex animation subframe interpolation
2582 1 0- mcfx
- Member
- 16 posts
- Joined: Feb. 2015
- Offline
- mcfx
- Member
- 16 posts
- Joined: Feb. 2015
- Offline
My slerp code was incorrect. This solved my problem.
https://gist.github.com/mattatz/40a91588d5fb38240403f198a938a593 [gist.github.com]
https://gist.github.com/mattatz/40a91588d5fb38240403f198a938a593 [gist.github.com]
-
- Quick Links