Hey everyone,
I was wondering if anyone had any insight in the exact calculations done within VRayMeshes to calculate the time based on the settings provided, eg. animOffset, animSpeed, animType.
I'm compiling the Maya's gpuCache plug-in with time offsets and would love the attributes to trigger the exact same time as the VRayMeshes.
This way we can animate the super-fast gpuCaches and render the VRayMeshes with the same settings.
It's hard to test at the moment because it seems the gpuCache isn't finding the right time range yet, but that's a Maya/Alembic thing I suppose.
For anyone that knows anything about it I'm using this to find the animation range.
By the way... is it possible to use VRayMesh to run it as fast as gpuCaches?
I was wondering if anyone had any insight in the exact calculations done within VRayMeshes to calculate the time based on the settings provided, eg. animOffset, animSpeed, animType.
I'm compiling the Maya's gpuCache plug-in with time offsets and would love the attributes to trigger the exact same time as the VRayMeshes.
This way we can animate the super-fast gpuCaches and render the VRayMeshes with the same settings.
Code:
if (fCacheAnimType == 0) // Loop { // the animation is looped by skipping to the first frame once it has finished double t = (double)(MAnimControl::currentTime().as(MTime::kSeconds) * fCacheAnimSpeed) + fCacheAnimOffset; return fmod(t, fCacheAnimEndTime - fCacheAnimStartTime) + fCacheAnimStartTime; } else if (fCacheAnimType == 1) // Play Once { // the animation is played once; return (double)(MAnimControl::currentTime().as(MTime::kSeconds) * fCacheAnimSpeed) + fCacheAnimOffset; } else if (fCacheAnimType == 2) // Ping-Pong { // The animation is looped by playing it backwards once the last frame // has been reached and then playing it forward again when the first frame is reached // Reference: http://stackoverflow.com/questions/11543685/oscillate-or-ping-pong-between-two-values double t = (double)(MAnimControl::currentTime().as(MTime::kSeconds) * fCacheAnimSpeed) + fCacheAnimOffset; double range = fCacheAnimEndTime-fCacheAnimStartTime; double cycle_length = range*2; double state = fmod(t-fCacheAnimStartTime, cycle_length); if (state > range) state = cycle_length-state; return state + fCacheAnimStartTime; } else if (fCacheAnimType == 3) { // Still - the animation is not played. // Instead just one frame of the animation is shown. // You can select which that frame is with the help of the Start offset parameter. return fCacheAnimOffset; } else { return 0.0; }
For anyone that knows anything about it I'm using this to find the animation range.
Code:
// Read time range TimeInterval interval(TimeInterval::kInvalid); cacheReader->readAnimTimeRange(interval); fCacheAnimStartTime = interval.startTime(); fCacheAnimEndTime = interval.endTime();
Comment