Killing Floor Models in 3ds Max: umodel Export, ActorX Import, Custom Player and Weapon Models
A series by Freddy (metalmedved.com), posted on the killingfloor.ru forum in 2011: moving Killing Floor 1 models into 3ds Max and back, and making a new character and a new weapon model. You need 3ds Max, the KF SDK (Unreal Editor), umodel and ActorX Importer from gildor.org, and the ActorX Exporter plugin for 3ds Max.
Exporting a model from the game into 3ds Max
- Meshes and animations. Player models live in
Animations\KF_Soldier_Trip.ukx. Put the file next toumodel.exeand run:
umodel -export -all KF_Soldier_Trip.ukx
Meshes (.psk) and animations (.psa) appear in the KF_Soldier_Trip\SkeletalMesh subfolder.
- Textures export the same way from
Textures\*.utx, for exampleKF_Soldier4_Trip_T.utx. The result goes to aTexturesubfolder. - In 3ds Max, run
ActorXImporter.msand press Import PSK, then pick the mesh. - Apply the texture: in Material Editor, Maps section, click None next to Diffuse Color, pick the scene material in Map Browser, then load the
.tgain Bitmap Parameters.
Importing your own model back into the game
- In ActorX Exporter, fill in the fields, tick all textured and press save mesh: you get a
.psk. - In Unreal Editor open the Animation Browser and import the
.psk. - Import the stock animation set (the
.psafrom the export step). - Save the package as
.ukx, reopen it and fill in the mesh properties. The easy way: open the stockKF_Soldier_Trip, copy the stock mesh's properties and paste them into yours; this sets the correct in-game orientation. - Fill
Animation/DefaultAnimationby hand asMeshAnimation'PackageName.AnimationSetName'or via Edit - Linkup anim and mesh. Save.
A new mesh needs its own texture and the stock skeleton to work properly.
A new player model
Example: Dante from DMC.
- Preparation. Apply the textures and cut the polygon count: around 7000 polygons is the sweet spot for a KF player model. The ProOptimizer modifier takes care of the excess.
- Export a stock player model into the scene (see above).
- Scale the new model to match the stock one and line up the poses as closely as possible.
- Delete the stock mesh but keep its skeleton, and delete the new model's skeleton. Using only Rotate, turn the stock bones so they run inside the matching parts of the new body. You may scale body parts of the model; never move or scale the bones. Save the scene.
- Add a Skin modifier to the model.
- Check the binding: in ActorXImporter, Tools tab, press Restore Bindpose. If fingers fuse or limbs twist, go back to step 4 or fix the bone influence under Envelope.
- Export a simple stock model again, attach it to the new one and delete the stock parts from the result.
- Export the new model with its skeleton through ActorX Exporter and import it into the game as above. All that is left is baking the texture.
A single texture for the new model (Unwrap UVW)
Based on Freddy's article "Импорт текстур для моделей в Unreal Engine" (Importing textures for models into Unreal Engine) on the killingfloor.ru forum (the example is Zoey from Left 4 Dead). Prepare the model with the steps above; before the Skin modifier it is better to convert it from Mesh to Poly (you can also use the Edit Poly modifier at any time).
- Select the model and apply the Unwrap UVW modifier on top of Skin. It automatically cuts the surface into zones, each matching an element of the texture (hands, jacket, trousers).
- Press Edit: the unwrap window opens with the projections of all model pieces piled together. Using Move, Rotate and Scale, place all the parts inside the blue square so they do not overlap. Tools/Pack UVs does this automatically, but gives every part the same scale, which hurts texture quality: keep the rough proportions, larger parts should take more space in the unwrap.
- Use Tools/Render UVW Template to create a texture template. Open it in Photoshop, fill the insides of the parts with one colour, copy the matching textures from the source files, align them to the unwrap outlines and save the result.
- Select all polygons of the model and set a single ID on the Polygon Material IDs tab. In an empty Material Editor slot, choose Diffuse Color on the Maps tab, assign it a Bitmap with the new texture, select the model and press Assign Material to Selection.
- Render and check that no texture fragments have slipped; fix mistakes by going back to step 3.
- Import the model into KF Editor as described above. The mesh's Material tab should have only one slot, and that is where the new texture goes.
A new weapon model (the welder)
- Export the original's first-person animation and textures:
KF_Weapons_Trip.Welder_Trip,KF_Weapons_Trip_T.equipment.Welder_Dand the hands textureKF_Weapons_Trip_T.hands.hands_1stP_military_diff. - Add the new model without bones to the scene, with all its textures merged into one file.
- With Move / Rotate / Scale, align it with the old one so it sits naturally in the hand. For guns, matching the sight centre and binding moving parts (magazine, bolt, shell) to their own bones matters most.
- Delete the old model, give the new model's material the old material ID, and line up the effect point (the welder's nozzle). Play the animation to check.
- Export it back into the game.
- Repeat for the third-person model (
KF_Weapons3rd_Trip.Welder_3rd). If the weapon can be dropped, it also needs a static mesh for the pickup. - Write a replacement mutator with three classes:
class NewWelder extends Welder
dependson(KFVoicePack);
#exec OBJ LOAD FILE=NewWelder_T.utx
#exec OBJ LOAD FILE=NewWelder_A.ukx
defaultproperties
{
AttachmentClass=Class'NewWelder.NewWelderAttachment'
ItemName="New Welder"
Mesh=SkeletalMesh'NewWelder_A.NewWelderMesh'
Skins(0)=Texture'NewWelder_T.NewWelder'
}
class NewWelderAttachment extends WelderAttachment;
defaultproperties
{
Skins(0)=Texture'NewWelder_T.NewWelder'
Mesh=SkeletalMesh'NewWelder_A.NewWelder3rd'
}
class NewWelderMut extends Mutator;
function PreBeginPlay()
{
AddToPackageMap("NewWelder_A");
AddToPackageMap("NewWelder_T");
}
function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
if (Other.IsA('KFHumanPawn'))
KFHumanPawn(Other).RequiredEquipment[4] = "NewWelder.NewWelder";
return true;
}
defaultproperties
{
GroupName="KF_NewWelder"
}
Compile it and load it as NewWelder.NewWelderMut.
Your own animations with ActorX Exporter
An addition by 3xzet on exporting animations Unreal can use:
- Animation file name: the animation package name, for example
shotgun_anim. - Animation sequence name: the animation's name, for example
reload. - Animation range: the frame range with a dash, for example
0-29(30 frames). - Digest animation, then Animation manager: move the animation into the package with
-->and press save. - Repeat for each animation (
Idleand so on). - In the editor, import the mesh, save the package (for example
superpuperweap_A.ukx), import the animations and set the mesh's Default animation toMeshAnimation'superpuperweap_A.shotgun_anim'.
Muzzle flash, animation sounds, aiming and reskins
Additions from the killingfloor.ru forum threads "Jackhammer", "Помогите со звуками и позициями вспышки" (help with sounds and flash positions) and "Вопрос по текстурам." (a question about textures):
- Flash bone. The muzzle flash is drawn at the bone named in the weapon code, usually
Tip. You can place the bone anywhere as long as it is linked to the barrel; it is usually aligned toROOTBONEand put at the end of the muzzle. If the flash appears halfway along the barrel and the model uses stock animations (for example the AK47's), the animation itself probably moves the bone: import the stock animations and fix the bone position in them, or override the method that spawns the flash in the parent classes with an offset for the emitter. - Aiming position is set in the 3D editor relative to the origin.
- Not only 3ds Max. Milkshape 3D also works for a weapon model: it can export to
psk. - A sound on an animation frame. In the animation browser, pick the animation (for example
Fire), open the Notify tab on the right →[+]Notify→ Add → under Create chooseAnimNotify_Sound→ Create, then pick the sounds.NotifyFrameis the animation frame number: with 6 the sound plays on the sixth frame. For a weapon reload sound, the "Adding a sound to a reload" thread (3xzet, killingfloor.ru forum) did it this way: move the animation slider to the right moment, press Add on the Notify tab (the moment is stored inNotifyFrame), pickKFWeaponSoundNotifyfrom the list and press Create; then select the sound on the Sounds tab, go back to Notify and press Use in theSoundrow (the sound path appears). Then save the.ukxanimation package. - Materials without refs. According to 3xzet, refs work unreliably on custom weapons, so set the mesh and skins directly:
Mesh=SkeletalMesh'Имя_Меши'
Skins(0)=Combiner'Имя_комбинированной_текстуры'
Skins(1)=Shader'Имя_шейдера'
Skins(2)=Texture'Имя_текстуры'
(Имя_Меши = mesh name, Имя_комбинированной_текстуры = combiner name, Имя_шейдера = shader name, Имя_текстуры = texture name.)
- Reskinning another weapon (Flame's example: the WTF katana with the golden katana look) means editing three classes: the weapon (
Skins(0)=Combiner'KF_Weapons_Gold_T.Weapons.Gold_Katana_cmb',BloodyMaterial, HUD and trader icons,AttachmentClass=Class'WTF.WTFKatanaAttachment'), the attachment (third-person view) and the pickup:
class WTFKatanaAttachment extends KatanaAttachment;
defaultproperties
{
Skins(0)=Combiner'KF_Weapons3rd_Gold_T.Weapons.Gold_3rdP_Katana_cmb'
}
defaultproperties
{
Skins(0)=Texture'KF_Weapons3rd_Gold_T.Weapons.Gold_Katana_3rd'
}
It makes sense to use the combiner in the attachment and a plain texture in the pickup.