Endorphin:Руководство 15 - Работа с жидкостями

Материал из Tiarum
Перейти к: навигация, поиск
Руководство 15 - Работа с жидкостями
45px-Scroll.png
ориг.название: Tutorial 15. Working with fluids
вики-редакция: Garin
ссылка на сайт: NaturalMotion
обсудить на форуме: Обсудить на форуме
версия оригинала: 1.0
версия вики: 1.0
Переводить Этот материал нуждается в переводе или допереводе..
Вы можете помочь перевести его. Не забывайте предварительно добавлять строку {{Edit|--~~~~}} в материалы над которыми работаете, чтобы не создавать конфликта правок.
Пожалуйста, снимите шаблон этого сообщения, когда материал будет вычитан.


Endorphin: Руководство 15 - Работа с жидкостями


Содержание

Предисловие

In this tutorial we will concentrate on learning how to use a new endorphin 2.7 feature: fluids.

To model the effect of fluids, fluid objects are added to a character, and a Fluid behaviour is applied to the character. The Fluid behaviour generates drag and buoyancy forces on the fluid objects. Drag forces have the effect of slowing down fluid objects as they move through the fluid. Buoyancy forces have the effect of causing fluid objects to float in the fluid.

In this example scene, you will create a small boat and a character that will dive from the boat into water.

Step 1: Building a simple boat using fluid objects

In this step we will create a simple boat that can interact with endorphin fluids.

To create a new boat character:


  • Launch endorphin, and select File > New Character….
  • Select the Standard Prop Character from the standard character list, and click OK.
  • Reshape the mass object to roughly represent the size and weigh of a small boat.

Endo Tut15 ITE 01.jpg

  • Build the collision surface of the boat using sphyl collision objects for the sides and cube collision objects for the bottom.

Endo Tut15 ITE 02.jpg

To model the boat buoyancy using fluid objects:


  • Select the boat’s mass object.
  • Select Character > Create Sphyl Fluid Object. This will create a new fluid object that represents a floating body. The default fluid object shape is a sphyl but this can be changed using the Property Editor.
  • Use the Move, Rotate and Scale tools to position and resize the fluid object to match one of the side collision objects.
  • Keep creating as many fluid objects as you need to define the parts of the boat that will interact with the fluid. Fluid objects do not need to cover every part of your object—only those that are going to be affected by the fluid.­
As a general rule, try to keep the number of fluid objects to a minimum. Also, try not to overlap fluid objects where possible. Buoyancy is calculated based upon the total volume of the fluid objects, and does not correct for intersecting fluid objects. This means that the volume of intersection is effectively counted twice when calculating the total buoyancy force.
  • Once you are happy with the boat character, select File > Save Character, and save the prop character as MyBoat. Click OK.
Hint To increase the stability of the boat, try moving the mass object downwards with respect to the centre of mass of the boat.

Endo Tut15 ITE 03.jpg

Step 2: Adding characters to the scene

In this step we will create a new scene, and add the boat character to it. We will then position the new Standard Simulation Character that ships with endorphin 2.7. This character has already been equipped with fluid objects.

To load the boat prop character in the scene:


  • Select File > New Scene.
  • Load your small boat character. To do this select Character > Add Character. Find the prop character named MyBoat and click OK.

To position the new standard simulation character in the scene:


  • Select the Character01 standard simulation character using the Timeline Editor or Node View.
  • Use the Move tool to move the character so that it is placed roughly above the small boat.
  • We now apply a pose to the character. With the character still selected, select Character > Load Pose. Browse to the resource folder for this tutorial and select the pose file named on_the_dingy.nma. A dingy is a type of small boat.
  • Click OK in the Load Pose window. The character will be placed quite high in the scene—you may need to adjust the viewport and zoom to see it.
  • Select the boat and use the Move tool to move it into position underneath the character.

Endo Tut15 ITE 04.jpg

Step 3: Adding a fluid cube to the environment

In this step we will add a fluid cube to the scene that will constitute the volume of the fluid. We will then set some of the cube’s properties.

To add a fluid cube:


  • Right-click on the simulation character timeline, and select Create Behaviour Event to create a new behaviour event for that character.
  • Set the behaviour Name property to Physical Effect: Fluid 1. Each fluid behaviour has a corresponding fluid cube. Most often, you will use fluid cubes to represent water, but you can represent thicker fluids like quicksand and mud, as well as thinner fluids like air. Note that the fluid cube is not displayed in the viewport until you have simulated at least once.
  • Edit the Start Frame and End Frame properties of the Fluid behaviour, so that it begins at Frame 0 and ends at Frame 600.

To edit the fluid cube properties:


  • Right click on the viewport and select Fluid Objects. Fluid objects should now be displayed.
  • Fluid behaviours include a number of parameters that define the properties of the fluid contained by the fluid cube, as well as a Floating Bodies property that defines the set of fluid objects that interact with the fluid cube. Click the [Select] hotlink in the Property Editor to edit the Floating Bodies selection set.
  • Use box-selection to select all objects in the viewport. All selected fluid objects are added to the Floating Bodies set of the Fluid behaviour.

Endo Tut15 ITE 05.jpg

  • Locate the Cube Size parameter, and change value of the cube size to 20. This will increase the size of the fluid cube.
  • Keep all other parameters at their default settings. The default fluid density matches that of water.
  • Simulate the scene to see how the fluid behaviour behaves. The fluid cube should be displayed as a semi-transparent cube, and the simulation character and the boat prop character should float on the surface of the water.

Step 4: Completing the scene

In this step we will place the boat prop character and the simulation character above the surface of the fluid, and add a Jump And Dive behaviour to the character. This will make the character dive into the fluid cube.

You will also experiment with other parameters of the fluid and refine your scene so that the final animation is richer and more compelling.

To add a dive behaviour to the character:


  • Right-click on the standard simulation character in the Timeline Editor and select Create Behaviour Event.
  • Set the behaviour Name property to be the Jump And Dive 1.
  • Adjust the timing of this behaviour so that it begins at Frame 0 and ends at Frame 150.
  • Simulate the scene. The first jump might be unsuccessful. Try experimenting with the jump timing and strength parameters to obtain a clean and successful jump.

Endo Tut15 ITE 06.jpg

To refine the diving motion:


  • Try to add behaviours to the character so that it reacts while underneath the water. For example, try adding Arms Windmill 2 and Legs Kick 2 behaviours to the character—these behaviour both generate the kinds of movement that one might expect from the submerged character. Experiment with the behaviour parameters to obtain a better motion.
  • To obtain a smoother and more plausible trajectory of the diving character within the fluid, try changing the drag parameters of the fluid behaviour. The drag parameters define the degree to which the motion of fluid objects is retarded by the fluid. For example, try decreasing the value of the Drag parameter and increasing the value of the Angular Drag parameter. Also, try setting the value of Turbulent Drag to 0. Keep simulating the scene and changing these parameters until you are satisfied with the resulting motion.
Hint For better scene visualisation, right-click on each character in the Node View and select Hide Type > Fluid Objects. You can also hide the mass object for the small boat prop character by selecting this mass object in the viewport and clicking on the correspondent icon in the Node View to hide it.

Further experiments


  • Try posing the head of the character so that it remains aligned with its body. Introduce some soft constraints to the chest of the character to help increase its stability while its head remains above the level of the fluid cube.
  • Try changing the size, shape and position of the fluid objects for both the small boat and the simulation character to see how these changes affect the buoyancy of the characters. Experiment with the various fluid parameters such its density and stream vector. You can visualise the stream vector as a current or wind direction.
  • Try turning on the fluid waving system. Increase or decrease the amplitude and frequency of the waves.
  • Try creating your own prop characters and attach fluid objects to them. See if you can correctly model their expected buoyancy properties.
  • Try simulating multiple fluid cubes in the same scene to model different fluid effects.

Conclusion

In this tutorial we have looked at how to work with the fluid physical effect behaviour.

We have learned how to model characters using fluid objects, and how to add a fluid cube in a scene. We have also modified the properties of the cube to obtain different fluid effects and to better control the way objects are affected by the fluid.

If you have any problems with this tutorial, open the corresponding scene Resources\Tutorials\Tutorial 15 – Working With Fluids\Tutorial 15 – Working With Fluids - Complete.ens. This scene is an example of how your scene should look if you have successfully followed all the steps in this tutorial.

Личные инструменты
Пространства имён
Варианты
Действия
Навигация
Разделы TES
Разделы Fallout
Модмейкерам
Инструменты