Mapping & SDK

KF SDK: Textures and Static Meshes

Two tutorials by mapper K-2 from the killingfloor.ru forum (2011) on working with textures and static meshes in the KF SDK, plus a few useful clarifications from the discussion threads. The editor fundamentals (brushes, lighting, paths) are covered in map editor basics and the mapping guide.

Texture Browser

A texture is an image applied to surfaces. You view, select and edit textures in the Texture Browser: View > Show Texture Browser or the button on the top toolbar. It also opens when the editor starts.

Browser elements:

ElementPurpose
Top fieldCurrently open texture package
Bottom fieldGroup within the package
Show-all buttonShow every texture in the package
View modeTextures in the package
Used in mapOnly the textures used in the map
Most Recently UsedRecently used textures
PropertiesOpen the selected texture's properties
Source packageOpen the package the selected texture comes from
Group switcherQuickly jump between groups

The browser opens and creates .utx texture packages, which are split into groups. A filter helps find textures quickly, and the preview size is changed on the View tab.

Applying and aligning textures

To apply a texture to a brush, select the surface and click the texture in the browser.

If the texture lands wrong or does not line up with its neighbours, the most precise way to fix it is the Pan, Rotate and Scale tools in Surface Properties:

FieldWhat it does
PanTexture offset (in pixels, relative to size)
RotateRotation and mirroring
ScaleTexture size as a pixels/Unreal Unit ratio
Scale for U and VSame, but separately for horizontal and vertical: lets you stretch or squash the texture
Relative checkboxWhether the change is relative to the current size
Lightmap sizeLightmap resolution for this surface

U is horizontal, V is vertical. Hold Shift to pan or rotate the texture in the opposite direction.

There are also the Texture Pan and Texture Rotate tools. In Texture Pan, holding Ctrl with the left or right mouse button pans the texture, and both buttons together change its size. Texture Rotate works the same way but rotates.

Importing and exporting textures

In the Texture Browser choose File > Import. In the import window:

FieldMeaning
PackagePackage to import into. Use MyLevel to store the texture inside the map file without an extra package. If you imported into a separate package, you must save it
GroupGroup, as you like
NameTexture name. If a texture with this name already exists, it is replaced
LODLevels of Detail: several versions of the texture at different detail levels, switched by distance to the camera. Leave at 0 for maximum quality
MaskedFor textures with fully transparent areas
AlphaSame, but with partial transparency (alpha). If unsure, tick Alpha
Generate MipMapsGenerates smaller copies of the texture. Safe to enable
Detail Hack?Only for detail textures (see below): blurs them at large distances

Texture sides must be powers of two (16, 32, 64, 128, 256, 512 and so on). Supported formats: dds, tga, bmp, pcx, upt. If an import silently does nothing, see the texture import item in the mapping guide's known errors.

The best option is dds (DirectDraw Surface). After import you can convert a texture to dds and compress it: select it and choose Tools > Compress (also available from the right-click menu). Compression types:

TypeAlphaNote
DXT1OpaqueHighest compression
DXT3ExplicitOften used for light coronas
DXT5InterpolatedYou will not go wrong with DXT5

After compression the browser shows a tag in brackets next to the texture name, for example [DXT3], meaning compression succeeded. Watch the size: a dozen textures of 1024×1024 and up in one package can weigh around 100 MB, and players will wait a long time downloading it from the server (a note by UltraKill in the discussion).

Transparency without surprises (killingfloor.ru forum, threads "DDS и иже с ним (война с форматами текстур)" and "Текстуры без фона"). A DDS with alpha saved from Photoshop often comes out wrong: smeared colours instead of a transparent background, or alpha in "blocks". It is more reliable to save the image as a 32-bit TGA with an alpha channel, tick Alpha when importing into the SDK, and compress it to DXT5 (or DXT3) in the editor. In the alpha channel black is the transparent part and white the visible part; if you get an empty transparent square after import, check the alpha channel. If you do save DDS from Photoshop (NVIDIA Texture Tools plugin), pick DXT5 and remember the Alpha checkbox on import. Paint.NET can save DDS without a plugin.

To get a texture out of the editor: File > Export or right-click → Export to File…

Texture properties

Open properties via Edit > Properties or by right-clicking the texture.

GroupContents
AnimationSimple frame-swap animation: a single texture's properties only hold the next frame and the switch rate. Not the best approach
MaterialThe texture's material. Picking an EST in SurfaceType sets hit and footstep sounds and impact particles (wood, glass, metal, etc.)
QualitybHighColorQuality and bHighTextureQuality. No visible difference between True and False
SurfacebAlphaTexture — partial transparency (can be set on import); bMasked — parts of the texture are either fully transparent or opaque; bTwoSided — two-sided texture, not a very useful feature
TextureDetail texture, DetailScale, LOD and LODSet (see below)
TextureFormatJust shows the texture format

Detail textures

Details are usually small grey textures layered over the base texture to improve how it looks up close. In KF they are in the Detailtextures_T.utx package.

  1. Select the detail texture in the browser.
  2. In the base texture's properties, Texture group, click Use in the Detail field.
  3. Adjust the size ratio in DetailScale: the higher the value, the finer the details.

The same group also has LOD (the higher it is, the blurrier the texture) and its type LODSet, but setting them is optional.

Glowing textures (shader)

A clarification by K-2 from the discussion on making a texture glow like neon signs:

  1. Create a new shader in the Texture Browser.
  2. Put the desired texture into the Diffuse and SelfIllumination fields.
  3. If only part of the texture should glow, add a SelfIlluminationMask.

The SelfIlluminationMask texture needs an alpha channel: make transparent every area that self-illumination should not affect; a smooth gradient transition is possible. Simple masks can be made even in Paint.NET by erasing parts; for complex ones, Photoshop or similar is better.

Animated textures

The editor offers two ways.

Frames with an _aXX suffix

Import the frames with an _aXX ending in the name, where XX is the frame number starting at 00:

name1_a00
name1_a01
name1_a02

The next frame is set automatically in each texture's Animation group. Speed is set with FrameRate. The monitor screens on KF-Icebreaker partly use this method.

MaterialSequence

  1. In the Texture Browser choose File > New.
  2. Set the package, group and name, and choose MaterialSequence in MaterialClass.
  3. Add frames in the SequenceItems field with Add.
  4. Set three parameters for each frame (table below).
ParameterMeaning
ActionThe stage: FadeToMaterial — the image smoothly blends into the next (often used for map previews); ShowMaterial — the image is simply shown (several of these in a row switch instantly)
MaterialThe frame texture
TimeStage duration

The resulting sequence is displayed as 1 pass. The map's loading preview itself is set in F6 > LevelSummary > Screenshot (a tip from BAHO in the discussion).

Static meshes

A static mesh is a polygon mesh; most of the architecture in Unreal Engine is built from them. "Static" means it cannot be animated, but it can be moved and resized in real time without recompiling. Meshes come in any shape and size, flat or 3D.

For complex shapes, static meshes are more convenient and flexible than BSP: a model can have hundreds of triangles, and the engine handles a static mesh more easily than BSP of the same shape.

Static Mesh Browser

Opened from the View tab or a dedicated toolbar button. It is similar to the Texture Browser: you can pick an object, inspect it and apply textures to it. The camera in the browser window works the same as in the editor. The browser works with .usx packages.

Textures are applied on the Materials tab. A model can consist of several parts with their own textures; each part has its own numbered tab, starting from 0.

  1. Select a texture in the Texture Browser.
  2. In the Static Mesh Browser open Materials and the tab for the part.
  3. Click the Material field and press Use.

Some meshes have one part, others fifteen; at first you will have to guess which texture goes where.

To add a mesh to the map:

  • right-click the spot in the viewport → Add Static Mesh: 'name';
  • or press Insert Static Mesh into Level in the browser: the mesh appears at the camera position of the active 3D viewport.

The Frame Current button aligns the browser view, taking camera rotation into account.

Importing meshes

  1. In the Static Mesh Browser choose File > Import.
  2. Pick the file. Supported formats are ase and lwo; ase is the one mostly used.
  3. Set the package, group and name in the import window.

The mesh is imported without a texture (it gets a NULL material) unless the texture was imported beforehand under its original name. In that case reapply the textures on the Materials tab. After texturing, save both the mesh package and the texture package.

UltraKill suggested in the discussion adding type suffixes to package names: _sm for meshes, _T/Tex for textures, _S/Snd for sounds, _A/Anims for animations (for example Tank_sm and Tank_T). Package names should have no spaces and use Latin letters only.

Converting models from other games

There are many 3D programs; K-2 used MilkShape 3D, which is simple and convenient for basic operations.

  1. Import the model into MilkShape: File > Import, choosing the format.
  2. Export it to ase: File > Export.
  3. Import the ase into the editor as described above.

Older MilkShape versions need a plugin for ase export; according to the discussion, MilkShape 3D 1.8.5 Beta already has ASE export built in. Textures are not required in MilkShape: if it complains Error opening following textures and the model is white, that is fine — the point is to get an ASE file and apply textures in the editor.

Scale of S.T.A.L.K.E.R. static meshes. From the "Статические меши из Сталкера" (Static meshes from Stalker) thread on the killingfloor.ru forum: Rainishе criticised a posted static mesh pack for broken proportions. According to him, static meshes from Stalker levels must be scaled up 60.5 times in 3ds Max (not 80 to 1) and given a vertex weld with a 0.0001 parameter.

For exporting models from 3ds Max via ActorX, see the separate article.

Porting whole maps from other games and merging maps

From the killingfloor.ru forum threads "importing in SDK" and "скрещивание карты" (Crossing maps). A map from Quake III, Counter-Strike or Serious Sam cannot be imported into the SDK: the engines work differently, so such maps can only be recreated, extracting and converting their textures and objects. Only maps from Unreal Engine 2 games carry over whole (from Unreal Engine 1 and 3, with distortions). According to K-2, a stable port of a UE2 map needs:

  • the original game's editor (Unreal Editor version 3.0 or later);
  • all resource packages moved into the KF folder (resources "embedded" in myLevel need extra steps);
  • copying all objects of the map in the original editor and pasting them into KF SDK: only classes that exist in KF get pasted, and their properties stay as in the original;
  • adaptation to the specifics of the particular map.

Two maps are merged into one the same way: a piece of one map is copied and pasted into the other. Gaiver5 and krestps warned that paths and movers will almost certainly need fixing afterwards.

Converting brushes to static meshes and back

  • A solid brush becomes a mesh: right-click its outline → Convert > To Static Mesh. A window like the import window appears. Faces are split into triangles; applied textures and the current Pivot are kept.
  • Converting a group of brushes at once merges them into one object. You can likewise convert a group of static meshes again to merge them into one (for example, a stack of books or a pile of crates).
  • A static mesh can be turned back into a builder brush: Convert > To Brush.
  • Movers cannot be converted, only their "sources". Conversion errors (for example Assertion failed: StaticMeshActor) are fairly common, and there is no cure for them. To move an object to another map with all its properties, simply copy (Ctrl+C) and paste (Ctrl+V) it: everything is kept in the clipboard, so you can paste even after restarting the editor (K-2's answer in the "Вопросы, вопросы и еще раз вопросы." (Questions, questions and more questions) thread).

Moving a mesh into MyLevel

A method by UltraKill from the discussion: the mesh is stored inside the map file, so no separate package has to go into the map archive.

  1. Select the mesh in the Static Mesh Browser.
  2. Edit > Rename…, enter MyLevel as the package, anything you like for the rest.
  3. Check that the mesh appears in the MyLevel package and save the map.
  4. Restart the editor and open the map: the mesh is there.

Objects from another map's MyLevel can be moved by copying: open that map, select the objects, Ctrl+C, open your map and Ctrl+V. If you use meshes from your own separate package instead, that package and its textures have to be distributed with the map.

Mesh properties in the map

The main properties of a placed mesh, Display group. If unsure, better leave the defaults alone.

PropertyMeaning
AmbientGlowStatic glow: makes the object brighter without other light sources
bAcceptsProjectorsWhether blood splats etc. stay on the object
bAlwaysFaceCameraFlat objects only: if True, the front side always faces the player's camera (sometimes used for tree foliage)
bShadowCastWhether the model casts shadows. Quite an important setting
bUnlitIf True, the model is fully lit regardless of light sources
CullDistanceDraw distance in UU: beyond it the object is hidden. 0 means unlimited
DrawScaleModel size, keeping proportions
DrawScale3DSize along X, Y and Z separately (relative to DrawScale). Negative values mirror the model. You can also scale quickly with the DrawScale3D field on the bottom toolbar
ForcedVisibilityZoneTagTag of the zone where the object is forced visible; it is hidden in other zones
SkinsA skin texture that replaces the one set in the mesh browser without changing the mesh itself (also used to add coronas to light sources)
StaticMeshCurrent mesh and its path (package, group, name)

Collision settings:

PropertyMeaning
bAutoAlignToTerrainSnaps the position to the terrain; very handy
bBlockActors, bBlockKarmaDo not mean much: collision is governed by the two settings below
bBlockNonZeroExtentTracesWhether to block non-zero-extent traces: players, zeds, thrown items
bBlockZeroExtentTracesWhether to block zero-extent traces: bullets, grenades, etc.
bCollideActorsWhether the object interacts with its surroundings. If False, none of the bBlock settings apply
bPathCollidingWhether the object blocks AI path building on compile
bUseCylinderCollisionCylinder collision (better left False)
CollisionHeight, CollisionRadiusHeight and radius of the cylinder collision
SurfaceTypeSurface type. Irrelevant: it is set by the applied texture

Mesh collision and lighting

Clarifications by K-2 from the discussion (2015):

  • Complex models usually get an invisible simplified collision model, so players do not snag on small bumps and the computer has an easier time with collisions. Without one, and always for zero-extent traces (bullets, grenades), the original polygon model is used for hit checks.
  • In UE2, static meshes are not lit with lightmaps like BSP but per vertex (Vertex Lit). Without a very dense mesh they cannot get realistic shadows; this shows most on low-poly or heavily scaled objects as uneven shading across neighbouring triangles, or black areas near vertices covered by other geometry. Terrain has the same problem. Where shadows on objects matter, a projector with a pre-made texture is usually added.
  • Complex BSP shapes of a couple of thousand polygons run many times slower than static meshes and often cause "black holes" due to BSP tree problems. Epic Games built "Lego-like" mesh sets: wall, floor and ceiling sections with fixed sizes in multiples that join almost seamlessly.