Expression Creation

From Valve Developer Community
Revision as of 13:40, 28 June 2005 by Tom Edwards (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page covers the creation and manipulation of epxressions in the FacePoser tool.

Expression Creation Tool

Faceposer expressions tool.jpg

The expression creation tool ("Expressions" tab) works in conjunction with any loaded Source engine model file (.MDL) in the 3d View and with the controls in the "Flex Sliders" tool. The general workflow is to manipulate the flex sliders into an expression that you wish to store for the model and then to right-click in the Expressions tool and choose "New Expression" which stores a thumbnail and the slider settings required to pose the face in the desired expression. One or more of these thumbnail/expressions become an expression class that can be saved/loaded to a .txt file for later re-use.

A good starting point is to look at the facial expressions for each of the phonemes/visemes used to drive just the mouth portion of an actor's face during .wav playback. Choose "Expressions | Load…" from the main menu and pick phonemes.txt from the "expressions" subfolder. Alternately, you can load/save expression class files by right-clicking anywhere in the expression class tab row (where the names of the current expression classes are listed) and picking "Load…" from the context menu.

If you have a model loaded and you load an expression class, FacePoser will check for changes that require recreating the thumbnails and will automatically recreate them as needed. Currently there are about 50 phonemes, so this might take a minute or so to complete. Any time you want to recreate all of the bitmaps for the current expression class file and current model, choose "Expressions | Recreate all bitmaps" from the menu.

Faceposer slider tool.jpg

To select an expression, click on the thumbnail. Picking a thumbnail sets all of the sliders in the Flex Slider tool to the current flex settings for that thumbnail. Note that each flex slider has a checkbox indicating whether the slider is active for the specified expression.

Most operations on an expression occur by right-clicking on the thumbnail. For instance, you can delete an expression by right-clicking on it and choosing delete from the menu.

If you make a change to an expression by moving one of the flex sliders in the upper right, then a few changes to the thumbnail will appear:

First, a save option will become accessible from the right mouse menu. In addition, changing the sliders will create an Undo/Redo history for the expression. The undo button is the left facing arrow button on the left edge of the thumbnail. If you make multiple changes you'll see a Redo button next to it. A blue "*" will show in the upper left corner of the thumbnail showing that it has been changed. You can click the Undo and Redo buttons to cycle forward and backward in the change history for the sliders you've moved for the thumbnail. The 0/6 (e.g.) numbers displayed just show how much Undo information you currently have queued up and where you are in that stack of information. Hitting the Save button will clear out the undo information as the current state is committed to memory. Once you have made your first change to a thumbnail, a "Revert" option is also available in the right mouse menu. When you hit the undo/redo buttons, the sliders and real-time view (but not the thumbnail) will reflect the current settings.

If you make any changes to an expression of a class, when you go to close that class, or to close the application, or to change the current model, the application will prompt whether you want to save all changes to expressions out to disk. Answer "Yes" to save your work to disk.

You can re-order the thumbnails by dragging them around in the view. Just click, drag to a new spot, and release the mouse to do this. The ordering won't be saved unless you save the class of expressions out to disk. You can also drag an expression directly onto an actor's choreography channel to create an expression event.

Using the A/B control. If you've selected one thumbnail then clicked on another, you can cycle between these last two selected thumbnails by pressing the A/B button in the upper right of the expression tray view.

You can reset / zero all of the sliders by clicking the "Zero Sliders" button in the flex controller slider area.

You can load multiple expression files at the same time. The tab control allows you to change the current expression set.

You can close the current expression class or all classes by choosing "File | Close" or "File | Close all" from the main menu or from the right-click context menu.

Creating a new expression class

You'll probably want to leave the phonemes alone (since they have been carefully defined globally for all models) and just create a new class of expressions for your actors to use when playing back a .VCD. To do so, choose "Expression | New…" from the right-click menu or main menu. Here, you'll want to create a .txt file in the "models" folder. The raw filename you provide here becomes the name of the class of expressions.

Creating a new expressions file will select that new class as the current class and the thumbnail views will be empty.

To create a new expression, move the sliders around to a desirable position and right-click in the expression thumbnail area and choose "New Expression…" from the context menu. This will bring up a dialog box where you can enter the name and description for the new expression. Enter a new name and description and press "OK" to create the new expression. You can now select the new expression by clicking on it in the tray. Note that clicking the "New" button deselects any current expression so that manipulating the sliders isn't treated as making changes to the previously selected expression. Once you hit the "OK" button, any sliders you change after that point will be stored in the Undo/Redo buffers of the selected thumbnail/expression.

If you want to change the name or description of an expression in the tray, just right-click on it and choose "Edit…"

You can now use the mouse wheel to scroll the thumbnail list of expressions.

You can also draw an expression onto an actor's channel in the Choreography tool to create a new "Expression" event with the expression. You'll see the focus rectangle as you drag the expression off the Expressions tool. Furthermore, you can drag an expression from the Expressions tool onto a particular time spot in the Flex Animation tool to set the slider keys from the predefined expression at the time where the cursor is positioned when you let go of the mouse button.

Support for Markov Groups of Expressions

A Markov group is simply a weighted graph where the next place to go to in the graph is randomly selected from a list of options. The way this works in the FacePoser is that you can select multiple expressions that you consider of a similar enough "type" to group together and use them to create a Markov group. During playback, when the model is told to play the expression that is a Markov group, one of the underlying expressions is chosen at random.

To create a Markov group, shift left-click one or more normal expressions in the expression tray and then right-click anywhere and choose "Create Group…" from the menu. Give the Markov group and name and description

Faceposer markov example.jpg

The Markov groups look like the other expressions in the thumbnail view, except that they show some additional text information:

First, they show the total weight of all of the items in the group. By default, each expression in a Markov group has a weight of 100. Thus, if there are two items in the group, the total weight is 200. When playing back from this group, it's easy to see that there is a 50/50 chance of either expression being chosen. The chance for the currently displayed group member is shown in the thumbnail view next to the label "Prob" (which stands for probability).

Just above the probability display is text showing which item of the group and how many total members in the group exist. Additionally, the item name and current weight are shown. To see other members of the group, click on it once with the left mouse button to make it active. This will highlight the group in red and will also highlight any other group members with a blue/purple highlight. You can also use the mouse wheel to cycle through the members of the Markov group that is currently selected.

There are two ways to change the weighting of a group member. First, you can use the mouse wheel on the group thumbnail to cycle to the desired member and use the right mouse button to bring up a menu and choose the "Change weight of 'member' in group 'group name'" option. The other way to change the weight is to select the group as above and to right-click on the blue-highlighted member whose weight you'd like to change.

If you right-click (but don't left-click or you'll deselect the currently selected Markov group) on a thumbnail that's not part of the currently selected group, you can choose "Add '[expression name]' to group 'group name'" from the menu to add the item to the currently selected group.

Similarly, if you right-click on a blue highlighted group member, you can select "Remove '(name 'from group)' group name to delete the item from the Markov group.

In all other respects, a Markov group is just like a regular expression except that, during playback, when the group is encountered, a random one of the weighted options from the list is chosen. This allows for variability during playback of the scene.

In general, expressions are global to all available models (i.e., an expression will work across all of our models). However, you can specify per-model overrides to tweak the look of a certain expression for a certain model.

To create an override, select an expression and manipulate the flex sliders into a facial pose that you want to use for the override. Then right-click on the expression, and choose "Save <name> as an override for model 'current model'" where <name> is the name of the expression you were working with and current model depends on which model is active in the 3d View.

Now, if "Show overrides" is checked, the thumbnail will show "++override" in the top left to signify that you are viewing a per-model override for the expression. You can delete the override using the right-click menu. Toggle the "Show overrides" checkbox to show/hide the overrides and to globally enable/disable them during preview playback, etc.