Mapping & SDK

Killing Floor SDK: CullDistance and Distance Fog, and How to Pair Them

Two engine settings decide how far a Killing Floor map is drawn: CullDistance on actors and distance fog on zones. Used separately they cause either low FPS or ugly pop-in. Used together they are the cheapest performance lever a mapper has. This glossary entry explains both and gives a rule for pairing them. It applies to Killing Floor 1 and other Unreal Engine 2.5 (UT2004 branch) maps.

CullDistance

Actor.CullDistance is a property of an actor, a float in Unreal units, not a separate object. You set it on individual actors, most often on StaticMeshActors (in the editor: Display → CullDistance).

  • What it does: the engine stops drawing the actor when the camera is farther away than CullDistance.
  • 0 means never cull: the actor is drawn at any distance. This is the default.
  • Put it on props, not on world geometry. Trees, crates, grass, barrels and other placed static meshes are the candidates. Never cull the map's BSP shell (walls, floors): it would open holes when players look into the distance.
  • Why it matters in KF: inside one large zone there is no automatic occlusion culling: props hidden behind other objects are still drawn. On a dense map with 1000-2600 actors and 300-400 thousand prop triangles, everything is rendered every frame and FPS drops whenever a player looks down a long sightline. Distance culling fixes that without touching close-up quality.
  • It culls by distance, not visibility. Too small a value makes props visibly pop in; too large does nothing. Pick it for the map's size and sightlines.

As a reference point, maps converted from Source or GoldSrc use a scale of about 1.9165 KF units per Source unit, so 8000 KF units ≈ 4175 Source units ≈ 80 metres.

Distance fog

Distance fog is a set of ZoneInfo properties. It is radial: it thickens with distance from the camera. For an outdoor map you usually set it on the zone that covers the whole map (ZoneInfo0).

PropertyTypeMeaning
bDistanceFogboolTurns fog on in the zone
bClearToFogColorboolPaints the whole background beyond the fog in the fog colour. This also hides the skybox seam and the white far plane
DistanceFogColorcolorFog colour. In exported T3D it is written as an FColor in B, G, R, A order
DistanceFogStartfloatWhere fog begins (0% opacity), in KF units
DistanceFogEndfloatWhere fog becomes fully opaque (100%). Beyond it only the fog colour is visible

Class defaults: DistanceFogStart=3000, DistanceFogEnd=8000, colour (128,128,128).

Because the fog is radial, it hides distant props near the ground and the sky overhead equally: both are the same distance away. Match the fog colour to the sky colour and the result looks like natural haze or an overcast day rather than a wall. On a night map the fog colour has to be dark.

Pairing them

Fog and culling always go together. Tune them from one value, the cull distance:

DistanceFogEnd   ≈ 0.92 × CullDistance
DistanceFogStart ≈ 0.45 × DistanceFogEnd
  • With fog end slightly before the cull distance, a prop is already fully hidden in fog when it stops being drawn, so it disappears instead of popping out.
  • Fog start at about 45% of fog end gives a gradual build-up rather than a hard band.

Example for CullDistance=8000: DistanceFogEnd≈7360, DistanceFogStart≈3310, with bDistanceFog=True and bClearToFogColor=True.

Things to keep in mind

  • Fog boundaries between zones are switched on the player's location, not on line of sight, so a different fog in the next room changes the moment you step through the portal.
  • Partial distance fog counts as a line-of-sight blocker for zed spawning, even when it is not opaque.
  • Players on weak PCs may lower draw distance in their own settings; still tune for the majority.
  • Press F in the editor viewport to toggle distance fog while you work.