Jump to content

Animation Sequences


agentronin
 Share

You are about to reply to a thread that has been inactive for 2088 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Suppose I need to create a sequence of two animations from a Blender NLA track which is to be played by an LSL script. This would be made necessary due to the SL anim file size limit. Suppose the NLA track extends from frame 1 to frame 100. If the second animation is to be rendered from frames 50 to 100, should the first animation be rendered from frames 1 to 49, or frames 1 to 50?

Once an animation's final frame is reached during play does the animation end exactly at the time of that last frame, or 1/FPS (Frames Per Second) later?

Link to comment
Share on other sites

Due to the nature of animation assets, your best bet is to overlap the end of the first animation with the beginning of the second animation for a few frames.

Theoretically, you could concatenate the two animations like you describe: 100 frames total, split in 2 chunks of 50 frames, from 1-50 and 50-100. You're not considering two factors though: 1) download time to the viewer 2) ease in/ease out values. If you want to "pre-load" both animations by quickly calling them both and stopping them right after, for the sake of getting them downloaded beforehand, you should also consider the dumping of unused animations after a certain amount of time, which would render the second animation uselessly "pre-loaded" because the first one takes too long before the second gets actually used, possibly requiring a new download to be performed.

For these reason i would suggest the overlapping as i mentioned at the beginning: from your example, first animation 1-55 with the ease out taking the last 5 frames, and second animation 45-100 with the ease in taking 5 frames (time calculations are needed to determine the ease time, which is in seconds, it all depends by length of animation and its FPS) in order to get a 10 frames overlapping, making sure the second animation is being called at the appropriate time to achieve this overlapping, which runs the same animation chunk, giving it the time to start running the second animation with a fairly minimal disruption, in case of loading delay.

Link to comment
Share on other sites

Would the number of frames overlapped, and the ease in and out times, depend on the frame rate?

Are the ease in and out times in addition to the frame overlap?  Or is the overlap created by the ease in and out times?

During ease in and out times is there a blend between the currently running animation and the next animation being started?

The animation I am currently working that needs to be divided up has a frame rate is 12 FPS.

Edited by agentronin
Link to comment
Share on other sites

2 hours ago, agentronin said:

Would the number of frames overlapped, and the ease in and out times, depend on the frame rate?

it all depends by the FPS, being Frames Per Second. Depending from this, an ease in/out of, say, 1 second can be a different number of frames.

2 hours ago, agentronin said:

Are the ease in and out times in addition to the frame overlap?  Or is the overlap created by the ease in and out times?

During ease in and out times is there a blend between the currently running animation and the next animation being started?

Ease in and out are a section within your animation total time used to blend in or out to or from another animation. So, for instance, if your animation is 10 seconds long in total and you set 1 second for ease in and 1 second for ease out, your animation will start and blend into full control of your avatar within 1 second, run for 8 seconds at full control, and then blend out for the remaining 1 second until it ceases its effect on your avatar.

2 hours ago, agentronin said:

The animation I am currently working that needs to be divided up has a frame rate is 12 FPS.

Based from this, you know that 1 second = 12 frames. from there you can make your calculation as per how many frames you need for the overlap. The longer the animation, the longer it may take to load into the viewer, so you probably would want something around 1 second and make sure that the frames would overlap having the script firing the second animation at the appropriate time, which you have full control over, since it's your own.

Link to comment
Share on other sites

43 minutes ago, agentronin said:

Is the 5 frame overlap you give in your example due to the ease in and ease out, or is the ease in and ease out to be done in addition to the 5 frame overlap?

Ease in and ease out are always within the total animation time, and therefore will subtract from the animation, never adding onto it. In my example, that overlap depends from the ease in and ease out in use and should match; at your current FPS, my example (5 frames but it really is arbitrary number as example material, you should test what looks good for you in each animation) is a bit less than 0.5 seconds. frameTime = 1/FPS, therefore in your specific case it is 1/12 = 0.083 (the amount of time it takes to switch from a frame to the next), take this and multiply it by the number of frames you will use and you get the exact ease in seconds (0.083*5frames = 0.416 of ease out). so the full equation is easeTime = frameTime * numberOfFrames, this way you can extrapolate the perfect ease in/out for the visual blending in frames you set up in the NLA editor

Edited by OptimoMaximo
Link to comment
Share on other sites

Up to now I thought that during ease in and ease out time  was an interpolation between whatever posture the avatar was in and my animation's first frame. From your answer I see now that my animation's frames are already running during ease in and are still running still running during blend out. That the frames in my animation are being blended during this time with increasing weight during ease in, and decreasing weight during ease out.

Now I understand that the number of frames to overlap is calculated from ease in and ease out times, or vice versa.

So the start of the next animation is not exact, and so the blended frames will not be from exactly the same frame numbers in the NLA track, and this then smooths the transition.

During ease in and ease out there are two animations running simultaneously and they are blended.

Thanks for you help. This overlap might make a difference in my animation.

The animation segments are chosen so that if the avatar was still for a short period of time it would not be noticeable, and there would not be any jerkiness if it were. So instead of blending with ease in and ease out it might be better for me put in the script some safety margin in the timing between animations to be sure that the next animation does not start before the current one ends, even if it means the avatar will not move for a very short time between animations. I do not know right now what that safety margin should be. Please suggest one to start with. I expect the final value will have to be refined by trial and error. I also need to know if such a safety margin would be made more accurate by dividing it by the sim's time dilation number.

Link to comment
Share on other sites

28 minutes ago, agentronin said:

it might be better for me put in the script some safety margin in the timing between animations to be sure that the next animation does not start before the current one ends, even if it means the avatar will not move for a very short time between animations.

If you wait for one animation to end before the next start, the default animations or the AO are most likely to interfere, gaining again control of the avatar animations.

Since you say that it doesn't matter if your avatar stays still for a short amount of time, you could still use the blending, making sure that when the first animation ends, the last frames of it carry a static pose during the whole ease out time, then the second animation uses the same still pose during the ease in before the action in your animation begins. this way you can ensure a more loose margin and tweak it more easily. So, if you know that the first animation lasts for, say, 10 seconds, add 0.5 extra second of static pose to its end, then append another 0.5 extra seconds at the beginning of the second animation. Set the respective ease ins and ease outs to respect those extra seconds you added, and have your script do something like:

float timeTick;

default {

state_entry(){
llSetTimerEvent(0.1);
//
	}

//whatever else
}
timer(){

timeTick += 0.1; //adds 0.1 to the variable every time it enters the event

if (timeTick == 10.0){//10 seconds have past

llStartAnimation("mySecondAnim");
	}
if (timeTick == 10.5){//10 seconds and a half have past

llStopAnimation("myFirstAnim");//assuming you have it as looped on last frame to safeguard the functional state against a little animation dowload delay
								// otherwise this if statement is not necessary
	}
}

It's very crude and might be not the best script solution, but it serves the purpose of explaining the logic of what i mean: this way you ensure to keep control over the avatar animation state and avoid intruding animations (default sit or any stand that might be running), keeping that safety half second to let your sequence play with no imprecise blending

51 minutes ago, agentronin said:

I also need to know if such a safety margin would be made more accurate by dividing it by the sim's time dilation number.

AFAIK, the delay due to animation download comes from the asset server, and it may not be related to the sim where the script runs. I think you shouldn't rely on that.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2088 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...