instance sequence stutter

   84   5   0
User Avatar
Member
243 posts
Joined: Dec. 2014
Offline
So I'm getting random duplicate frames when I instance cached animation, seems to be due to the way I'm driving the frame number of the cached files with @age, rounding errors when it converts to integer? I'm doing int frame_num = (@age * 24) when I build my instancepath string, how should I be going about this? Thanks!
User Avatar
Member
95 posts
Joined: Sept. 2011
Offline
Not sure exactly what's going in but flooring the value would be at least tidier and more predictable. Otherwise you're implicitly converting a float to an int - better to be explicit for clarity:

int frame_num = floor(f@age * 24.0);
User Avatar
Member
243 posts
Joined: Dec. 2014
Offline
I did try floor() and ceil() initially, no success. For instance, an age float value of 0.291667 gives int frame 7, but so does the next age value, 0.333333
User Avatar
Member
1925 posts
Joined: Sept. 2011
Offline
sounds like you need to do rint() instead. If age stratification was enabled in pop source, then the ages would have some partial time increment added to them at birth, and you would never have any ages so close to the multiple of the time increment that float precision comes into play.

int frame = (int)rint(@age * 24.0);
s@path = sprintf("/foogeo.%04d.bgeo", frame);
User Avatar
Member
243 posts
Joined: Dec. 2014
Offline
Thanks! rint() seems to fix the issues. I'm not familiar with age stratification, I assumed you meant life variance or jitter birth time, both of which were turned off in my set up
User Avatar
Member
1925 posts
Joined: Sept. 2011
Offline
AndyW
I'm not familiar with age stratification, I assumed you meant life variance or jitter birth time, both of which were turned off in my set up

Yes, I meant jitter birth time. I forget the specific name. Glad you got it working though.
  • Quick Links