pit Posted December 29, 2010 Share Posted December 29, 2010 In 3Ds max we have spline motion with constant velocity. There is no any jerks but exported transform has visible ones. It was observed only at straiht part of spline. One can clear see this jerks on spline form attached file. Approximately at 19-26 second. I eliminate this bug by deleting some optimiztions in spline export code. As I understand spline exporter checks whether two neighbour frames lie on a straight line and if it is true deletes one of this frames. There some bug (I don't know what exactly) in this code (function void SplineExport::addFrames(const Frame *frame,int num_frames), source/tools/plugins/common/SplineExport.cpp, lines 137-161). std::vector<int> flags(num_frames); for(int i = 0; i < num_frames; i++) { flags[i] = 1; } float xyz[3],rot[4],scale[3]; for(int i = 0; i < num_frames - 2; i++) { const Frame *f0 = &frame[i + 0]; const Frame *f1 = &frame[i + 1]; const Frame *f2 = &frame[i + 2]; float k = std::min(std::max((f1->time - f0->time) / (f2->time - f0->time),0.0f),1.0f); lerp(xyz,f0->xyz,f2->xyz,k); slerp(rot,f0->rot,f2->rot,k); lerp(scale,f0->scale,f2->scale,k); if(fabsf(xyz[0] - f1->xyz[0]) > 1e-6f) continue; if(fabsf(xyz[1] - f1->xyz[1]) > 1e-6f) continue; if(fabsf(xyz[2] - f1->xyz[2]) > 1e-6f) continue; if(fabsf(rot[0] - f1->rot[0]) > 1e-6f) continue; if(fabsf(rot[1] - f1->rot[1]) > 1e-6f) continue; if(fabsf(rot[2] - f1->rot[2]) > 1e-6f) continue; if(fabsf(rot[3] - f1->rot[3]) > 1e-6f) continue; if(fabsf(scale[0] - f1->scale[0]) > 1e-6f) continue; if(fabsf(scale[1] - f1->scale[1]) > 1e-6f) continue; if(fabsf(scale[2] - f1->scale[2]) > 1e-6f) continue; flags[i + 1] = 0; } So I simply deleted this piece of code. My version of the function saves every frame without any check. After this modification jerks disappeared. spline.ZIP Link to comment
serega Posted January 14, 2011 Share Posted January 14, 2011 Thanks, the error assigned to the devs Link to comment
danni.coy Posted January 17, 2011 Share Posted January 17, 2011 That would also probably explain why we couldn't get the correct number of frames to do accurate frames to km/hour calculations using the new spline exporter. Link to comment
Recommended Posts