Персонажи от первого лица

Материал из CryWiki Russia

(Различия между версиями)
Перейти к: навигация, поиск
Строка 1: Строка 1:
{{В_процессе_перевода}}
{{В_процессе_перевода}}
-
== 1st Person Characters==
+
== Персонаж первого лица==
-
=== Overview===
+
=== Обзор ===
-
This document describes the whole process of creating a set of arms, an example weapon, basic animations, and how to export them to the engine. Up to now this is based on the workflow in Autodesk 3dsmax.
+
Данный документ рассказывает о создании комплектов оружия, если быть точнее, предоставляет пример оружия, основную анимацию и объясняет процесс экспорта в движок.
-
Other packages will follow once the exporters are available.
+
Другие пакеты будут рассмотрены после появления экспотеров для них
-
 
+
=== Характеристики оружия===
-
=== The Arms Character===
+
==== Настройки геометрии====
-
==== Geometry Handling====
+
http://wiki.crymod.com/images/a/ae/FirstPersonCharacters_image001.jpg
http://wiki.crymod.com/images/a/ae/FirstPersonCharacters_image001.jpg
-
In this picture you can see an example mesh of a pair of arms which could be used for the 1st person arms of a character.
+
На данном изображении вы видите пример меша пары рук, обычно использующийся для создания вооружения персонадам от первого лица
-
The local transformation of the mesh should be zeroed out for all axes. Also its pivot/center should always remain at the world center. (Position 0,0,0; Rotation 0,0,0)
+
Локальные трансформации этого меша должны быть нулевыми по всем осям. А центр ("pivot") располагаться в центре всемирных координат(Position 0,0,0; Rotation 0,0,0)
-
'''Note:''' <br>
+
'''Примечание:''' <br>
Keep mesh/geometry at the world center with no rotation.
Keep mesh/geometry at the world center with no rotation.

Версия 09:13, 6 июня 2011

Эта страница страница помечена как находящиеся в процессе перевода.


Содержание

Персонаж первого лица

Обзор

Данный документ рассказывает о создании комплектов оружия, если быть точнее, предоставляет пример оружия, основную анимацию и объясняет процесс экспорта в движок. Другие пакеты будут рассмотрены после появления экспотеров для них

Характеристики оружия

Настройки геометрии

http://wiki.crymod.com/images/a/ae/FirstPersonCharacters_image001.jpg

На данном изображении вы видите пример меша пары рук, обычно использующийся для создания вооружения персонадам от первого лица

Локальные трансформации этого меша должны быть нулевыми по всем осям. А центр ("pivot") располагаться в центре всемирных координат(Position 0,0,0; Rotation 0,0,0)


Примечание:
Keep mesh/geometry at the world center with no rotation.

Arm Hierarchy

Below is the hierarchy which will be used to deform the arm’s geometry. Note that the root, which is the top bone of the hierarchy, is also located at the world centre and has no rotations applied.


Sandbox FirstPersonCharacters image002.jpg


The three red coloured bones in the lower arms are twist helpers, and are used to help the deformation around the wrist. They have a simple expression applied to them which is connected to the hand’s bones X- rotation.

Note:
Now is a good time to set a position and rotation key on all elements of the hierarchy at frame 0. This way you will always have the option to go back to the “initial Pose” of the character.
Sandbox FirstPersonCharacters image003.jpg


Here is the whole arm hierarchy in the schematic view.

Sandbox FirstPersonCharacters image004.jpg

The wrist helpers should be hidden after the envelope operator is applied, so that they won’t accidentally be animated. This would cause the applied expressions to become ineffective.

There is no need to keep the hierarchy the same structure we used here. Also changing the way the wrists are solved is possible.

Weighting the Geometry

Note:
Always apply a “reset x-form” modifier and collapse it in the modifier stack, before you apply the envelope modifier. This removes unwanted transformations to the geometry, which could cause problems later on.

Sandbox FirstPersonCharacters image005.jpg


Which operator is used in max doesn’t matter. You can either use Physique, or Skin to weight your model. Both are supported in the engine.

Info:
Whenever a vertex is influenced by more than two bones, the weighting on the ones with the weakest influence gets deleted and gets normalized between the remaining two bones.


In our example Skin is used to weight the arms to the bones. The modifier is applied at frame 0, which also defines the “default pose” which was keyed earlier. This also defines the default pose in the engine and helps in debugging problems later on in the process.

Only bones which are necessary to deform the mesh in a proper way were added to the bone list in the modifier.


Sandbox FirstPersonCharacters image006.jpg


Info:
Bones in the hierarchy which have an underscore at the beginning of their name won’t be considered by the exporter. This keeps the size of the exported character low. In this case they were only left in the hierarchy to make the selection of links easier, when using the physique modifier.

Exporting the Character

Once you have finished weighting the character, you are ready to export the arms to the engine. If the plug-ins are installed correctly into your 3dsmax plug-ins folder, you should find the Cryengine exporter in the command panel under utilities. Select your arms geometry and hit the “Add selected” button in the “Object Export” section, if it’s not already added automatically. In the “Bone Export” section it should automatically add the highest node of your hierarchy, “root” in this case.

Sandbox FirstPersonCharacters image007.jpg

Set the Drop-down-list in the “Object Export” section under “Export To” to “Character (*.chr), and click the “Export Nodes” button. This exports a compiled version of your object to the same folder your max-file has been saved to. If you want to specify a different name for your character (which is usually generated from the name of the max-file) you can specify one by activating the option below the “Export To” drop down list. Exporting is only possible to the same folder that the max-file resides in, or to a sub-folder from that one.

Now you can open the Character Editor under “view” in the editor…

Sandbox FirstPersonCharacters image008.jpg




…and load your character.


Sandbox FirstPersonCharacters image009.jpg

The big green arrow shows you the “forward direction” in the engine, which all characters should be facing to (Y+).

1st Person Weapon

The Weapon Geometry

Now that the arms model is ready, we can prepare a weapon to use with it. Here you can see a basic weapon model, with some elements highlighted in red.

Sandbox FirstPersonCharacters image010.jpg


Tip:
To make the weighting process more convenient, you can move away the parts which are meant to be animated later and should get their own bones, by a known amount of units or its multiples. Later after you applied your weighting modifier you can easily move them back to their original position by animating the bones they have been weighted to, the same amount you moved them apart from the main model earlier.

For the geometry the same rules apply like have been pointed out in the arms section. No translations should be applied to the geometry, and before applying the weighting modifier do a reset-x-form, and collapse it in the modifier stack, to get rid of unwanted transforms. The pivot should be aligned to the world coordinate center, and the model should point in the positive y-direction.

The Weapon Hierarchy

The same transformation rules should be kept for the bones you create for the weapon hierarchy, or at least to some of them which serve a specific purpose. In 3ds max it doesn’t matter if bones or helpers (dummies) are used to define a hierarchy. The exporter treats them both as bones when they are exported.

Sandbox FirstPersonCharacters image011.jpg

All those names can be changed code wise of course; the names here are for demonstration purposes.

Weapon Term: used to attach the muzzle-flash effects to. Shells: used to attach the particle effect for the shells to. Collision: used for determining the position of impact when used as a melee weapon. Various attachment helpers, which are used to control the position of weapon parts. (attachment_top; attachment_side; attachment_bottom; etc)

Helpers or bones which don’t influence elements or parts of the weapon geometry, won’t need to be added to the deform modifier. Make sure they are added to the hierarchy before exporting the character, or they won’t be accessible by the engine.

Note:
Before a deforming modifier is applied, merge in the arms character from its source max-file, and parent the highest node from the weapon rig under the root bone of the arms character.

Fixed FirstPersonCharacters image012.jpg

Hint:
When using the Physique modifier chose the highest node in the hierarchy with which you want to deform your mesh upon initialisation.

Exporting the Weapon

After weighting is done, you can export your character to the engine. For this select the mesh of your weapon, go to the Cryengine rollout in the utilities pane of the command panel and add it to the node section. Switch to “Character” under “Export to...” and click the “Export Nodes” button. This exports your character into the same folder as the max file and inherits the name of your max file. You can also specify the name manually using the custom file name option.

In order to view your character in the Character Editor with the mesh skinned to the bones, you have to add them as a “skin attachment” by setting the choice to “skin” in the attachments properties, selecting the arms object, and then creating a “new” attachment. After you hit “Apply” the character is attached to the bones, and becomes visible in the editor.

FirstPersonCharacters image013.jpg

Animations for 1st Person Characters

Preliminary tasks

In order to have the Resource compiler handling the 1st person weapons correctly you have to create an entry in the animations.cba file. In this file all information concerning your character is stored, i.e. compression ratio of animations, the path to the character etc. Here is a sample entry which has all the required settings for a 1st person weapon. For a detailed description of these parameters, see the reference document on the CBA file parameters. (LINK) If this entry is missing the exporter won’t export animations, because it needs to know the location of the character-file.

Exporting Animations

In 3ds max you have two different ways of exporting animations for your character. The easiest way is to set the time range in the timeline to the exact frames of the start and end positions of the animation you want to export. It’s always a good idea to have all animations start and end in a default pose, so that blending in the engine works in a smooth way.

Tip:
You can also create a free camera at the world coordinate center which is looking in the direction of the positive y-axis. When you set its FOV (field of view) to the same value you use in-game, it becomes an accurate representation of what your animation will look like from the players view. You can also use “link constraints” on the camera to a helper called “camera_helper”, which is parented to the “root-bone” of the arms character, and later activate the camera control parameter for specific animations to let them be controlled by this helper. Mind, that the start and end frame of the animation for the camera should always start and end at the world coordinate centre to prevent unwanted “jumps” in your animation in the engine, between animations which have this helper activated and those which haven’t.

Once you set your time range, you can move on to the exporter. Make sure the right object is added in the node section of the objects pane. This should automatically add the root of your character in the “Bone Export” list. If not, do so manually. Hit the “Export Bones” button, enter the desired name of the animation and save it to the folder you entered earlier in the animations.cba file.

To preview your animation in the Character Editor, you have to create one more file which tells the engine which animations are available for this character (a “cal-file”). Below is the cal-file for the example weapon. It has the path of the animations folder in it, and the names of the animations, and their binary counterparts, like they would be called “on disk”.

Scar_fp.cal

  1. filepath = Animations1st_personSCAR_fp

select_01 = select_01.caf fire_bullets_right_01 = fire_bullets_right_01.caf idle_right_01 = idle_right_01.caf reload_01 = reload_01.caf


zoom_in_ironsight_01 = zoom_in_ironsight_01.caf fire_bullets_right_ironsight_01 = fire_bullets_right_ironsight_01.caf idle_right_ironsight_01 = idle_right_ironsight_01.caf zoom_out_ironsight_01 = zoom_out_ironsight_01.caf


//layers control placement of attachments

silencer_on_layer_01 = silencer_on_layer_01.caf reflex_on_layer_01 = reflex_on_layer_01.caf scope_on_layer_01 = scope_on_layer_01.caf


The file needs to be saved to the same folder the character is saved to, and has to have the same name, except for the file extension, which is “.cal”. The file path which points to the animations folder is relative to your games root folder. Once you entered all available animations into the cal-file, and exported them from 3ds max, they will show up in the “Available Animations”-list in the character editor.

FirstPersonCharacters image014.gif


The second option to export animations is to use the “Sub Ranges” dialog, in the “Timing” pane of the Cryengine exporter. You can add animations into the list, by highlighting the “new range” entry and typing the name of your animation. Make sure the start and end times are entered correctly. Check if the root of your character is still showing up in the bone list. When you activate the “Export file per range” in the “sub ranges” area, after hitting the “Export Bones” button, the exporter will ask for a location, and will export any of the entered animations from the “sub ranges” – list.

FixFirstPersonCharacters image015.jpg

Layered Animations

Sometimes you might only want to change specific parts of an animation which is used on a hierarchy. One example might be a different pose for the fingers for the right hand, when you want to reuse it for another type of weapon. This is one use for layered animations, which could be activated by code, and overwrite the existing animations on certain parts of your hierarchy.

Layers are also used to control placement of attachments on weapons. In this case the silencer and the magazine are solved as attachments.

To export layered animations you have to make sure that the bone list only contains the highest node of the parts that should be influenced.

Also for these kinds of layers you might only use a static pose. To achieve this activate “manual range” in the timing pane of the exporter and set the start and end frame to be the same time.

Sandbox FirstPersonCharacters image016.jpg

After the animation is exported and added to the cal-file, you can test it in the Character Editor.

To add an attachment to your character, you have to create a new one in the attachments pane of the Character Editor.

Sandbox FirstPersonCharacters image017.jpg


In the attachment properties select Bone Attachment and select the bone you want the object to be attached to from the drop down list. (silencer_attach, in this case). After you have selected the correct object from the objects browser, you can create the new attachment and click “apply” to load it into the editor. It should show up at the default position of the bone you selected when you created the attachment.

To test the layer, you can activate a primary animation on the base character (i.e. an “idle” animation) by selecting one from the “available animations” list. Then switch to one of the “secondary” animation slots in the character animation pane, and select the layer animation in the list. The parts of the animation which were triggered from the “primary” animation on this bone should be overwritten, by the new layered animation.

Sandbox FirstPersonCharacters image018.jpg