S&box Wiki

Morphs and Shape Key Animations

Morphs and Shape Key Animations

This page will guide a beginner through the least possible amount of steps required to import new morphs and shape key animations into S&box, as well as have them work and be useable in the Animgraph or Face Poser, it assumes you already know how to create shape keys and navigate Blender, it will not show how to create them as that is related to neither ModelDoc nor S&box, and guides for it already exist online.

Exporting the mesh with Shape Keys

We will be using "Blender" as it is the most widely used free modelling program, and the plug-in "Source Export Tools".

  1. Create the shape keys
1.jpg
Avoid using underscores _ in Shape key names, as they're used for Corrective Shape Keys; You can inform yourself on the uses and characteristics of Corrective Shape Keys in this page.
  1. Go to "Scene Properties" and then "Source Engine Export", change "Export Format" to "DMX"
  2. Use the latest DMX version, as of writing this it's "Binary 9" and "Model 22"
  3. Select the checked "MeshName.dmx" under "Source Engine Exportables" (in my case "citizen.dmx", check if unchecked)
  4. Go to "Flex Properties" and press Generate Controllers
  5. Press Export to export the model.
2.jpg
The model will need at least one bone, even if it's a static prop, this is because Morphs are animation driven and Animations need bones.
Make sure to reset all Shape Keys to 0 before export, as they will be applied, and change the default mesh if you do; this, however, can be used if you only need the mesh with a certain Shape Key configuration, as you can then reimport the mesh in Blender.
If you're using Corrective Shape Keys (Shape Keys with underscores _ in their names) you'll also need to Generate Corrective Shape Key Drivers before export.

Adding the morphs in ModelDoc

As mentioned before, morphs are animation-driven, this means that even if morphs will appear when importing the model, you won't be able to use them until there's at least 1 animation. If you planned for this model to be static and/or have no animations, you can simply reuse the model itself as a "Simple Animation".

  1. Import the Mesh in ModelDoc
  2. Add any animation, use the model itself if you don't plan on having animations.
  3. Add a material that supports morphs (in "Material Editor" check the Morph Supported box under "Animation").

If you go to "Morph Explorer" and press Enable Manual Slider Control you will be able to manually drive the sliders, this is only a debugging tool, if you want to then see the animations drive the sliders, press Allow animation to drive sliders.

3.jpg

Exporting Shape Key Animations in Blender

If you know a way to correctly export shape key animations in the DMX format, feel free to edit this part, as DMX is the preferred format for S&box.

  1. Create your shape key animation

There needs to be at least one animation as the target for the export, this can be either an Armature or Mesh animation, in this case, we'll do a simple Armature animation that does nothing.

  1. Create an animation that lasts the same as your Shape Key Animation, even if it's just keyframing the location of a random bone in the first and last frame.
5.jpg

The image above shows 2 animations in the NonLinear Animation Editor, you don't actually have to push down any animation, it is just to show that there is an animation for Armature, one for Shape Keys, and that they last the same.

  1. Export in FBX format, the object types will only need to be "Armature" and "Mesh", "Apply Scalings" set to FBX All
image.png
The rotation of the animation may be different in ModelDoc, as FBX exports using Blender's forward axis, which is "Y+", you'll have to rotate the model/armature and "Apply Rotation" as so it faces the Y+ axis.
  1. Import the animation in Modeldoc as a "Simple Animation".

This will be the final result:

Note the morph sliders moving because of the animation, they are not limited by 0 and 1.

Legacy Source 1 Morphs

This part of the guide was originally made by user Divined as its own page.

Exporting the morphs

After importing your .qc into Blender, simply bring up your head along with the .vta and select both and export it as a DMX like below:

Flexes

You are going to need the Blender Source Tools for this to work, or any other software where you can import your .vta and .smd and export as .dmx

Importing morphs in ModelDoc

Importing the morphs into ModelDoc is the same as importing any other mesh, just import the .dmx as a new mesh and your morphs will appear on the bottom right under morph explorer. If you want to play around with them, simply enable manual slider control.

Special Pages


Wikis

?

Render Time: 41ms

DB GetPage 31
Generate Html 0
SaveChanges (1) 6
Render Body 0
Render Sidebar 1