Havok 3ds Max Plugin

For users

HavokMax is a native plugin for 3ds Max 2010 – 2019, it supports skeleton and animation import/export. It supports loading files stated in HavokLib project.

Import UI

  • Scale: scales imported objects
  • Coords setup: More in Coords setup.
  • + button: Will save current settings under new preset.
  • – button: Will remove selected preset, (you cannot remove external or default preset)
  • Import: Import scene (saves changes)
  • ? button: Opens about dialog
  • Cancel: Exits dialog, discards changes
  • Closing dialog won’t import data, but saves changes

Keyboard shortcuts (v1.9+)

  • Ctrl + T: Invert Top
  • Ctrl + B: Invert Back
  • Ctrl + R: Invert Right
  • Ctrl + S: Scale
  • Ctrl + D: Disable scale
  • Ctrl + I: Import
  • Ctrl + C: Cancel
  • Ctrl + M: Motion ID

Currently supported animation formats:

  • Interleaved Uncompressed Animation
  • Delta Compressed Animation
  • Spline Compressed Animation

Imported animation will have same duration, no matter what frame rate your scene uses.

Export UI

Export UI have additional objects:

  • Toolset (export dialog only): Selects toolset version for XML export.
  • Export animation: Exports current scene animation. By disabling this, only skeleton will be exported.
  • Include skeleton: Adds skeleton into exported animation. More in Exporting section.
  • Optimize tracks: Will skip non keyed bones. WARNING: Do not use, if you use scale keys on nodes with children.
  • Skeleton capture frame: Frame index where skeleton pose will be saved.
  • Animation capture range: Defines start and end frame where animation will be exported.

Keyboard shortcuts (v1.9+)

  • Ctrl + T: Invert Top
  • Ctrl + B: Invert Back
  • Ctrl + R: Invert Right
  • Ctrl + S: Scale
  • Ctrl + E: Export
  • Ctrl + C: Cancel
  • Ctrl + A: Export animation
  • Ctrl + I: Include skeleton
  • Ctrl + O: Optimize tracks
  • Ctrl + F: Skeleton capture frame
  • Ctrl + G: Start (capture range)
  • Clrl + H: End (capture range)

Coords setup

On every dialog, you can see “Coords setup” group.

At the left side, you can see an image with XYZ axes and ViewCube.
3ds max axes can be seen at down left corner of every 3ds max viewport.
ViewCube can be seen at the right up corner of every viewport (if enabled).

3ds Max have following coordinate system.

  • X axis (Red arrow) is Right side
  • Y axis (Green arrow) is Back side
  • Z axis (Blue arrow) is Top side

The drop down lists at right side are used for remapping imported coordinates “rotating” imported scene to match 3ds max one. There isn’t one for Top axis, since that can be assigned automatically.

The checkboxes (Invert Top, -), are used for inverting imported axes, making Top->Bottom, Right->Left and Back->Front.

Exporting

  • Exported file will be always in XML format.
  • Use Havok Filter Manager to work with this file further.
  • Filter manager can load files from older versions.
  • File should be always compiled to binary packfile (the file that target framework can read).
  • Metadata should not be saved.
  • Environment data should not be saved aswell.
  • When working with animation, make sure that you always apply compression on it.
  • Most used compression is Spline Compression.
  • When exporting animation, in most cases you don’t need to export skeleton aswell. Skeletons are stored as separate files.
  • When working with Havok Filter Manager, be sure to know how to use it. Most information are inside Havok’s User Guide.

When exporting any file, plugin will add Environment Variales:

  • asset: name of scene (max) file
  • assetFolder: path to scene file
  • assetPath: full scene file path
  • out: name of exported file
  • outFolder: folder, where exported file is saved
  • outPath: full path to exported file

Again, you should always discard these variables, when compiling final havok file. (Use Prone filter, or uncheck Save Environment data). It’s a rookie mistake, made even by large companies. Since these data are useless after compile.

Installation

Move corresponding .dlu file into %3ds max installation directory%/plugins. Versions must match!
Additionally plugin will require Visual C++ Redistributable for Visual Studio 2015 to be installed in order to work.

Usage

Importing/Exporting is from 3ds Max main menu.

For developers

Imported bone

All imported bones, will have user properties.

  • hkaSkeleton: will yield skeleton name (for separating ragdoll bones from skeleton ones)
  • hkaBone: will yield bone ID (from 0 index), so if your tool will need to load Havok file for skeleton, and uses only bone indexes, you can locate them this way.

External presets

Search location is APP_PLUGCFG_DIR.
If you don’t know where this folder is, type this command into listener: GetDir #plugcfg
Plugin will scan any .ini file.

ini file structure

[HK_PRESET]
Name=%name of preset%
Scale=%float%
Matrix=%remap%
Extensions=%additional extensions%
  • Name: first 2 characters are 8bit number in hex format, representing size of preset name + 3 (2 for number characters, and 1 for \0), after that follows name of preset.
    • Example: 0BMyPreset – 0B is number 11 in hex.
  • Scale: floating point representation
  • Matrix: Matrix remapping, in format “(-)X(-)Y(-)Z”, this matrix will rotate any imported root nodes.
    • Example: XYZ will generate – Matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]
    • ZXY – Matrix3 [0,0,1] [1,0,0] [0,1,0] [0,0,0]
    • Y-XZ – Matrix3 [0,1,0] [-1,0,0] [0,0,1] [0,0,0]
  • Extensions: uses same format as Name, use | as separator in case of multiple extensions used.
    • Example: 0Ehkx|hkt|hka

NOTE: All these instructions can be found in some of my other projects.

Appendix

Configuration file is saved in app’s default save location for saving/loading such files.
If you don’t know where this folder is, type this command into listener: GetDir #plugcfg

Maxscript listener is used as output logger, it will output every information sent from plugin.

Latest release/Repo

https://github.com/PredatorCZ/HavokMax/releases

Advertisements

5 thoughts on “Havok 3ds Max Plugin

      1. is there a clear way to say an anim file is havok or not? some anim file may not ext with hkx, right? could we confirm with file header?
        Thx!

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s