Expression Creation

From Valve Developer Community
Jump to: navigation, search
The Expressions dialogue

An Expression is a static, reusable flex configuration which is stored independently from any scene file that uses it. An Expression cannot be modified on a per-scene basis, except in the ramp, but will blend as normal. They are useful when many different scenes need the same expression or groups of expression (see Creating Markov Groups); the phoneme library uses the system. They are also useful for quickly assembling 'rough draft' scenes.

Note:An Expression does not crossfade of its own accord. The ramp must be used to ease transitions.

Creating a new Expression

The following tools are used to create an Expression:

  • Expressions
  • Flex Sliders
  • 3D View

Make sure all are open on your workspace before starting.

  1. Create a new Expression Class with the Expressions > New... menu option. An Expression Class is like a folder (although it in fact takes the form of a .txt file), and you will want one of your own to ensure that your Expressions do not become inseparably mixed with Valve's preset phonemes.
  2. Expressions are created by saving flex data from the Flex Sliders dialogue. Create your Expression there, using the 3D View for reference, and move on when you are satisfied.
  3. To save your Expression, right-click on a blank area in the Expressions dialogue with the correct tab highlighted and click New Expression.... Fill in both fields on the new dialogue and click OK.
  4. Important: Click the Expressions > Save menu option to write your work to disk.
  5. Important: For your Expressions to function in-game you will need to compile their class with the Export to VFE context menu or menustrip command. This system was devised for Source's Xbox development to allow the asynchronous (and therefore faster) loading of Expression data, and is a necessary step even though you are unlikely to have enough Expressions to make it worthwhile.

Warning: Selecting an existing Expression will overwrite anything currently on the Flex Sliders!

Editing an existing Expression

The Flex Sliders dialogue

Editing an existing expression is achieved by having it selected when modifying the Flex Sliders. This process adds several elements to the Expression thumbnail:

  • An asterisk (*) will appear to signify that the Expression has unsaved changes
  • A clickable undo history will appear
  • A Revert option will appear in the Expression's context menu

Right-click on the Expression and choose the Save option to commit your changes.

Note:Expressions can be re-ordered by dragging. As ever, hit Expressions > Save to commit any changes.

Using Expressions

An Expression can be used:

  • In the Choreography timeline in the normal manner. Either create an Expression event with the context menu, or drag the thumbnail of the desired Expression from the Expressions dialogue to the timeline.
  • In the Flex Animation dialogue, by dragging the Expression thumbnail to the desired point.

Creating Markov Groups

Faceposer markov example.jpg

A Markov Group is a collection of Expressions that are randomly chosen between when a scene plays. They are ideal for adding variety to your performances without requiring multiple scene files. The 'weight' of each Expression in the Group defines how likely it is to be picked.

To create a Markov group, shift+left-click one or more normal Expressions in the Expressions dialogue, then right-click anywhere and choose Create Group... from the menu.

A Markov Group appears as an Expression thumbnail, with these additions:

  • Total Weight: the combined weight values of the Expressions in the group
  • Expression being displayed in the Group thumbnail (ID and name)
    1. ID / total number of Expressions
    2. Expression name
    3. Expression weight in current Group
  • Percentage probability that the Expression being displayed will occur

Use your mouse's scroll wheel to scroll through the Expressions in a Group thumbnail.

Modifying Markov Groups

  • To add or remove Expressions from an existing Group, left-click on the Group thumbnail. This will highlight the Group members with a purple border. Then, use the context menu and click the Remove <Expression> from <Group> or Add <Expression> to <Group> options.
  • To change the weight of an Expression within a Group, use the Change weight of <Expression> in group <Group> context menu option. It is accessible from two locations:
    • By cycling to the Expression in the Group thumbnail with the mouse wheel
    • By right-clicking on the Expression's purple-highlighted thumbnail when the Group is selected


In most cases, one Expression will function with all actors. However, you can specify per-actor 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 as you see fit. Then right-click on the Expression and choose Save <Expression> as an override for model <Model>.

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 an Override using the right-click context menu.

Toggle the Show overrides checkbox to show/hide the Overrides and to globally enable/disable them during preview playback.