Endorphin:Руководство 8 - Смешивание движений от имитации к анимации
| Руководство 8 - Смешивание движений от имитации к анимации
| |
|---|---|
| |
ориг.название: Tutorial 8. Blending from simulation to animation вики-редакция: Garin ссылка на сайт: NaturalMotion обсудить на форуме: Обсудить на форуме версия оригинала: 1.0 версия вики: 1.0 |
| Этот материал нуждается в переводе или допереводе.. Вы можете помочь перевести его. Не забывайте предварительно добавлять строку {{Edit|--~~~~}} в материалы над которыми работаете, чтобы не создавать конфликта правок. Пожалуйста, снимите шаблон этого сообщения, когда материал будет вычитан. |
Endorphin: Руководство 8 - Смешивание движений от имитации к анимации
Tutorial 8: Introduction
In the previous tutorial, you imported animation data and used simulation events to change the simulation mode from animation to simulation.
In this tutorial, you will use transition events to blend back from simulation mode to an animation mode. Transition events are similar to simulation events, except that they have a duration of many frames, rather than a single frame.
Before you begin
Before we begin this tutorial, it is important to understand some key concepts associated with endorphin simulations and transition events.
Using simulation and transition events
You will typically use simulation events whenever you want to change the mode from animation to simulation, and transition events whenever you want to change the mode back to animation.
The reason is that it is easy for endorphin to begin dynamically simulating an animated character without any discontinuities in its position or motion. In contrast, blending back from simulation to animation is more difficult to achieve in a realistic manner. This process requires a transition over a number of frames in order to guarantee a smooth blend between the character’s dynamically simulated position and momentum, and the position and momentum specified by the animation data.
Step 1: Loading the scene
In this step we will open an existing scene that we will use for experimenting with transition events.
To load the scene:
- Launch endorphin.
- Select File > Open to browse to select Resources\Tutorials\Tutorial 8 - Blending from Simulation to Animation\Car_Hit_Begin.ens.
- This scene contains a simulation character, along with a car prop character that represents a simple vehicle shape. The car prop has been animated with few keyframes so that it moves towards the simulation character. The simulation character has an animation data containing a run-and-jump cycle.
- Simulate the scene. The car prop moves towards the character, controlled by its keyframes. Between Frame 0 and Frame 48, the simulation character is driven by its animation event. You can tell that the character is animated, rather than simulated, by the fact that it is displayed in the dark grey animation colour. At Frame 48, the character and car collide, and a simulation event has been added to begin dynamically simulating the character. The character writhes and tucks as a result of the Writhe and Body Foetal behaviours that have been added to it.
Step 2: Using helper props and constraints
In this step we will explore the scene opened in Step 1 in more detail.
Animating using helper props
If you examine the Timeline Editor, you will note that there are two prop characters — prop01 and prop02. The car prop itself is prop02. The keyframes have been applied to prop01, which is a small helper prop connected to the prop02 via a constraint.
This technique—animating a prop character indirectly using a helper prop connected by a constraint—is a useful endorphin modeling technique. If we had animated the car directly, it would be in an animation mode. It would be able to collide with other scene objects and transfer momentum to them, but its motion would be completely unaffected by collisions.
In contrast, by animating a helper prop and constraining the car to this helper, we can keep the car prop in simulation mode. When the car collides with objects, it can react to collisions dynamically. For example, it may slightly bounce or wobble during collisions. You can vary the strength of these secondary dynamics by varying the strength of the constraint. Usually these effects will be quite subtle but can add to the realism of a scene.
Using helper constraints to control dynamic motion
If you examine the Timeline Editor, you will note that the simulation character has a constraint that applies between Frames 48 and 117. This is the period in which the simulation character is spinning through the air. The constraint only locks the rotation of the character about the global X-axis.
We have added this helper constraint to help ensure that as the character spins through the air, its roll axis stays aligned to the global X-axis. Constraints are often useful when you want to add some control to what would otherwise be unconstrained dynamic motion.
Step 3: Importing blend animation
When you simulate the current scene, the character runs at the car, collides with it and ends up tucked into a ball on the ground behind the car.
In this step, we are going to create another animation event for the simulation character. We will import animated motion of the character landing from a jump with a stumble and run. Our goal is to blend from the dynamic simulation into this animation. In a later step we will add the transition event to blend from the simulation into the animation.
To import animated data representing the final blend animation
- Select Character01.
- Select File > Import, and browse to select Resources\Tutorials\Tutorial 8 - Blending from Simulation to Animation\Jump With Stumble.fbx. Click Open.
- In the Import Dialog, select the Hips node in the joint hierarchy tree.
- Turn off the Create Simulation Events setting.
- Turn on the Transfer From Reference Character setting, and browse to select the Audiomotion2 reference character. Click OK to import this motion as a new animation event.
To adjust the animation event timing:
- Select the new animation event in the Timeline Editor. You may want to move the animation event marker to a new timeline track.
- Set the Event Start Frame to Frame 76.
- Set the Event End Frame to Frame 166.
- Set the Animation Start Frame to Frame -4.
- Set the Animation End Frame to Frame 166.
Step 4: Repositioning the blend animation
In this step, we will reposition the animation data so that it will blend smoothly with simulated motion.
When you imported animation data in the previous step, its position and orientation were initially based on the data in the FBX file. However, endorphin also lets you move and rotate animation data directly in the scene itself. This is very useful for repositioning the animation so that it coincides with the dynamically simulated motion of the character during the intended transition frames. It is very important to position animated data correctly to create realistic blends from simulation to animation.
To adjust the position of the animation event data:
- Turn on animation event data visualisation. To do so, select the animation event. Use the Property Editor to turn on its Visible setting. You should see a green jointed skeleton displayed in the viewport, along with a dashed line that indicates the motion path of the animation data root.
- Select the animation event. When you are visualising the animation data, you can select the green animation data skeleton or motion path as an alternative to selecting the animation data marker in the Timeline Editor.
- Simulate to fill the frame buffer with at least 100 frames.
- Move the time slider to Frame 97. This is the frame at which the character first makes contact with the ground.
- Use the Move and Rotate tools to modify the global position and orientation of the animation. Your goal is to ensure that the animated character position closely matches the simulated character position. When you use these tools, you are modifying the Animation Root Offset property of the animation event.
- If you use the Rotate tool, ensure that you only rotate about the global Y-axis. Do not rotate about the global X-axis or Z-axis, as this will have the unwanted effect of moving some parts of the animation cycle off the ground plane.
- You should find that the following values for the position and orientation of the animation root offset work well:
- X Orientation: +180.0.
- Y Orientation: -51.9.
- Z Orientation: +180.0.
- X Position: 0.748.
- Y Position: 0.0.
- Z Position: 0.176.
Step 5: Transitioning into the blend animation
We have added the blend animation data, and repositioned it so that it well blend well with the motion of the simulated character. However, at the moment this blend animation is not yet used by the simulation character.
In this step, we will add a transition event to the simulation character timeline. This event will change the Файл:Simulation mode of this character back from simulation to animation over a range of frames.
To add a transition event to the character:
- Right-click on Character01 in the Timeline Editor and select Create Transition Event.
- Set the Start Frame of the new transition event to Frame 90.
- Set the End Frame of the new transition event to Frame 112.
- If you examine the Timeline Editor, you will notice that the Character01 timeline track has a gradually strengthening blue colour added to its background over the duration of the transition event. This is the animation mode colour, and indicates that the character is driven by animation data rather than by the dynamic simulation.
- Simulate the scene. The dynamic motion of the character now blends smoothly into the animated motion. If you use the time slider to examine the transition event in detail, you will notice that during the course of the transition event, the motion of the character is generated by a combination of simulated and animated motion.
- Initially, the character is entirely driven by simulated motion. Over the course of the transition event, the animated motion has increasing influence. By the end of the transition event, the character is entirely driven by animated data. This transition is reflected by the colour of the character. During the course of the transition, the character blends towards the dark grey animated character colour.
Step 6: Introducing active animation events
In this step, we will use an active animation event to improve the quality of the transition from simulated motion to animated motion.
Active animation events
Until now, we have described animation events as applying only when the simulation mode is set to one of the animation modes. When characters are driven by animated data in an animation mode, the data completely drives the character.
However, this is no longer strictly true. You can now also use animation events to drive characters when they are in the simulation mode. When you use animation data in this way, you effectively drive the character using a succession of active poses. This technique is called active animation.
Active animation does not affect the global position or orientation of the character root. Rather, it drives the individual joint orientations of a character. Active animation acts as a physical input during a dynamic simulation. You can specify the relative strength of the active animation by modifying the animation event Strength property.
Using active animation events
You can enhance a blend from animation to simulation using active animation events. Suppose you have a character driven by dynamic simulation, and at a particular frame you introduce a transition event blend into an animation event. By default, you would set the Start Frame of the animation event to match the Start Frame of the transition event.
To use the active animation technique, you would move the Start Frame of the animation event back a number of frames, and turn on its Active setting. For example, if a character has a transition event between Frames 100 and 125, and an animation between Frames 80 to 300, the character will effectively have four simulation ranges:
- Before Frame 80, the character is dynamically simulated.
- Between Frames 80 and 100, the character is dynamically simulated, with the animation event driving joint orientations dynamically.
- Between Frames 100 and 125, the character is blended between its simulated motion and the animation event.
- Between Frames 125 and 300, the character is driven entirely by the animation event.
To improve the transition by using active animation:
- Select the animation event.
- Turn on its Active property.
- Set the Strength property to 0.8.
- Set the Blend Period property to 0.15.
- Simulate the scene. You should find that between Frame 76 and Frame 90, the animation event drives the character actively. That is, the character is still dynamically simulated, but its joints are influenced by the Jump With Stumble animation event. The active animation helps make the subsequent transition event between Frames 90 and 112 even smoother and more realistic.
Step 7: Experimenting with different blend animation
In this step, we will experiment with different scene variations by importing more animation data to create additional animation events. We will use the same transition event to blend to different animation events, in order to explore different scenarios.
To import more animation data:
- Select Character01 using the Timeline Editor.
- Select File > Import, and browse to select the Resources\Tutorials\Tutorial 8 - Blending from Simulation to Animation\ Jump Off Box.fbx. Click Open.
- In the Import Options dialog, select the Hips node from the node tree hierarchy.
- Turn off the Create Simulation Events setting.
- Turn on the Transfer From Reference Character setting, and browse to select the Audiomotion2_ref reference character. In required, you will need to browse to the Resources\Characters\Custom folder in order to locate the AudioMotion2_ref character. Click OK.
To adjust the animation event timing:
- Select the new animation event in the Timeline Editor. You may want to move the animation event marker to a new timeline track.
- Set the Event Start Frame to Frame 77.
- Set the Event End Frame to Frame 213.
- Set the Animation Start Frame to Frame -9.
- Set the Animation End Frame to Frame 213.
To adjust the position of the animation event data:
- Simulate for at least 100 frames, and then use the time slider to set the active frame to Frame 97.
- Turn on the Visible setting in the Property Editor.
- Use the Move and Rotate tools to adjust the position and orientation of the animation data so that it coincides with the position of the simulated character at Frame 97.
- You should find that the following values for the position and orientation of the animation root offset work well:
- X Orientation: +180.0.
- Y Orientation: -87.2.
- Z Orientation: +180.0.
- X Position: 0.882.
- Y Position: 0.0.
- Z Position: 0.093.
To improve the transition by using active animation:
- Select the animation event.
- Turn on its Active property.
- Set the Strength property to 0.8.
- Set the Blend Period property to 0.15.
- Right-click the Jump With Stumble animation event and select Disable Event.
- Simulate the scene. You should find that the character motion now blends into the Jump Off Box animation.
- Now that you have created two animation events, and positioned them both correctly, you can easily toggle between them by enabling one of the events, and disabling the other event. In a similar manner, to can import more animation to create more animation events for a given character; simply ensure that only one of the animation events is enabled at any one time.
Timeline priority
Each character has a number of timeline tracks. The topmost track has the highest priority, followed by the next track and so on, down to the bottom track. For any given frame, the animation event with the highest priority is used, and any other animation event at the same frame is ignored. This means that if you are experimenting with different animation events, you can modify their respective priorities as an alternative to enabling and disabling them. That is, if you want to use a particular animation event, move it so that it has the highest priority of any of its animation events.
Conclusion
In this tutorial you have imported animation data to create animation events, and visualised this data in the viewport. You have moved and rotated this animated data to obtain a good blend between simulation and animation, and then used transition events to actually generate the transition.
You have also experimented with active animation events to further improve your blends. Finally, you have experimented with different animation events in the same scene.
If you have any problems with this tutorial, open the corresponding scene Resources\Tutorials\Tutorial 8 – Blending From Simulation To Animation\Tutorial 8 – Blending From Simulation To Animation - Complete.ens. This scene is an example of how your scene should look if you have successfully followed all the steps in this tutorial.






