Impact Effects

From Valve Developer Community
Jump to: navigation, search

Purpose

Particle effects are used to create impact effects when shots hit various types of surfaces. This document describes how to author those particle effects and add effects when new surface types are hit.

Adding New Impact Material Types [Programming]

  • A list of material types is here.
  • First, you need to add the new material type to decals.h.
  • In fx_impact.cpp, the array s_pImpactEffect specifies the name of the particle system to play when a shot hits that material type. Specifying NULL for the name means no system will play. You may optionally specify a 'nofleck' name, which is designed to be a lower cost particle system which does not create any debris from the wall colored to match the wall. If NULL is specified for the nofleck name, the normal particle system will be used if the game code ever asks for a nofleck version of the particle system.

Authoring Impact Particle Systems [Art]

A number of control points are automatically set up by the game code when creating impact effects. Here's what they are:

  • 0: Stores position, orientation, and entity. Position is the impact point, orientation X axis points along the impact normal. The orientation Y and Z axes are arbitrary but perpendicular to X. The entity is the entity hit by the impact.
  • 1: Stores position, orientation, and entity.. Position is the impact point, orientation X axis points along the *reflected* direction, namely the direction the shot would reflect off the surface. The orientation Y and Z axes are arbitrary but perpendicular to X. The entity is the entity hit by the impact.
  • 2: Stores position, orientation, and entity. Position is the impact point, orientation X axis points toward the initial shot position. The orientation Y and Z axes are arbitrary but perpendicular to X. The entity is the entity hit by the impact.
  • 3: Stores position only. Contains the scale of the impact effect in all 3 coordinates of the vector. Various pieces of code attempts to make larger or smaller versions of the impact effect. Usually, the scale is somewhere in the range of 1 -> 5.
  • 4: Stores position only. Contains the color of the wall texture at the point of impact; used to make flecks that appear to look like they came off the wall behind the impact.