Console Commands

The Half-Life 2 developer console is a useful debugging interface that allows the user to interact directly with the game engine through console commands. A complete list of console commands supported by Half-Life 2 can be found on the Valve Developer Wiki here. This section details several new console commands introduced by the Virtual Video Mod for debugging network connections and adding camera effects.

To enable the developer console, the mod must be launched with the -dev and -console options (see Launching Mod). Once the mod is running, the developer console can be accessed at any time by pressing ~ (tilde), and appears as shown in the figure below. Console commands are entered in the text entry box at the bottom of the console, with parameters separated by spaces after the command; see for example the noise_pixel command in the figure below. Command outputs (and other messages from the game engine) are displayed in main console window; the figure illustrates the output of the list_cameras command.

Half-Life 2 console

The new console commands are divided into three categories: server commands are useful for debugging client connections and camera configuration, rendering options enable or disable various components of the rendering pipeline, and visual effect commands add noise and interference effects observed in real cameras to improve the realism of the synthetic images. Except for the omni command, the visual effects and rendering options are applied to all virtual cameras, ie. these commands cannot be applied on a per camera basis. An index of commands is given below.

Server Commands:

Rendering Options:

Visual Effect Commands:

Server Commands
 
list_cameras
Usage:
list_cameras
 
Description:
This function lists all the virtual cameras currently maintained by the Camera Server, including the camID, current PTZ parameters, intrinsic and extrinsic parameters and in-game time at which the last frame was rendered (note that a camera only renders frames when a client is connected to it). This function is useful for debugging camera configuration and client connections.
 
list_clients
Usage:
list_clients
 
Description:
This function lists all the network clients currently connected to the Camera Server, including the camID of the camera to which the client is connected, and the in-game time at which the last message was received from the client. This function is useful for debugging client connections.
 
list_clients_ptz
Usage:
list_clients_ptz
 
Description:
This function lists all the virtual PTZ controllers currently maintained by the PTZ Server, including the ptzID, the target position and velocity, the current position and velocity (which may differ from the target while the controller is executing a motion). This function is useful for debugging client connections.
 
list_controllers
Usage:
list_controllers
 
Description:
This function lists all the network clients currently connected to the PTZ Server, including the ptzID of the controller to which the client is connected, and the in-game time at which the last message was received from the client. This function is useful for debugging client connections.
Rendering Options
 
antialias
Usage:
antialias
 
Description:
Toggles software antialiasing and prints the current state (ON/OFF, default ON). Antialiasing removes the jagged edges that can appear around rendered polygons. Enabling this function causes frame to be rendered at double resolution and then averaged over 2x2 blocks of pixels to produce the output frame. Even if your graphics card supports hardware antialiasing, software antialiasing can be usedful to eliminate aliasing in transparent textures, particularly in foliage and fences as shown in the enlargements below. Note that software antialiasing may cause a small decrease in frame rate, and is only implemented for frame dimensions of 320x240 and lower.
 
  
Software antialiasing off   Software antialiasing on
 
omni
Usage:
omni camId
omni camId doughnutFlag horizonDiam
 
Parameters:
camId
CamId of virtual camera to update
doughnutFlag
Specifies whether the omnicam is panoramic (0) or catadioptric (1)
horizonDiam
Diameter of the horizon line for a catadioptric omnicam as fraction of frame height
 
Description:
Configures the omni-directional camera settings for the virtual camera identified by camId. Settings only affect cameras that have been created with the omni=true option (see the DirectShow filter Camera Server Options). If doughnutFlag is 0, the omnicam is rendered as a panoramic camera, otherwise it is rendered as a catadioptric camera (default), as shown below. The horizonDiam is the diameter of of the horizon line for a catadioptric camera as a fraction of the frame height (default 0.95). To display the current settings for a particular camera, pass the camId to this command without any other parameters.
 
  
Panoramic Omnicam   Catadioptric Omnicam
 
groundtruth
Usage:
groundtruth
 
Description:
Toggles target and foreground ground truth data generation and prints the current setting (on/off, default off). Since ground truth generation is computationally expensive, this command allows the user to turn on ground truth generation only when it is needed. See Ground Truth for more information on generating and using ground truth data. Note that ground truth is not generated for omnicams.
Visual Effect Commands
 
jitter
Usage:
jitter
jitter maxJitterX maxJitterY
 
Parameters:
maxJitterX
Maximum shift in pixels in x-direction at unity zoom
maxJitterY
Maximum shift in pixels in y-direction at unity zoom
 
Description:
This function emulates camera jitter as a small random rotation about the y and z axes of the camera frame. The random angles are uniformly distributed such that the maximum shift in pixels on the image plane is +/-maxJitterX and +/-maxJitterY at unity zoom. Note that the apparent shift increases with zoom, as would be observed in real cameras. The effect is disabled by setting maxJitterX and maxJitterY to zero, and the function can also be called without parameters to print the current settings. The jitter effect is shown below for the command: jitter 5 5.
 
Jitter effect
 
noise_bands
Usage:
noise_bands
noise_bands height intensity probability
 
Parameters:
height
Height (in pixels) of lighter intensity band
intensity
Intensity change (in greylevels) of lighter intensity band
probability
Probability (per frame) of band appearing
 
Description:
This effect causes bands of lighter intensity pixels to appear in random frames at a random y-coordinate. The height, intensity change and probability of a band occuring per frame are controlled by the input parameters. The effect is disabled by setting the probability to zero, and the function can be called without parameters to print the current parameter values. This interference effect is based on similar effects observed in some real cameras, and is shown below for the command: noise_bands 25 10 0.5.
 
Band interference effect
 
noise_blur
Usage:
noise_blur
noise_blur radius speed probability duration
 
Parameters:
radius
Maximum radius (in pixels) of square blurring kernel
speed
Speed (in pixels/sec) at which blurring kernel increases/decreases
probability
Probability (per frame) of refocus event occuring
duration
Duration (frames) of maximum blur
 
Description:
This function emulates a random refocussing event that can occur in autofocus cameras. Refocussing is simulated through a uniform, square blurring kernel, which changes in size from zero to maximum and back to zero during the event. The size of the blurring kernel, refocus speed, duration at maximum blur, and probability of the refocus event per frame are controlled by the input parameters. The effect is disabled by setting the probability to zero, and the function can be called without parameters to print the current parameter values. The effect is shown below for the command: noise_blur 4.0 1.0 0.2 5.
 
Simulated refocussing effect
 
noise_defocus
Usage:
noise_defocus
noise_defocus size
 
Parameters:
size
Size of the square Gaussian blur filter
 
Description:
This function emulates camera defocus, which occurs in real cameras whenever the CCD sensor and image plane are not coplanar. The blur is applied as a Gaussian kernal of dimensions (2*size+1) x (2*size+1), and does not change with time unlike the noise_blur command above. The function can be called without parameters to print the current size. The defocus effect is shown below for the command: noise_defocus 2.
 
  
Defocus off   Defocus with kernel size 2
 
noise_ghost
Usage:
noise_ghost
noise_ghost offset intensity
 
Parameters:
offset
Offset (in pixels) of ghost image
intensity
Inensity (in range 0.0-1.0) of ghost image
 
Description:
This function emulates multi-path interference that can occur during the transmission of analog video, which results in the appearance of an offset (delayed) and inverted 'ghost' image superimposed on the original frame. The offset and intensity (as a fraction of the original frame intensity) of the ghost image are controlled by the input parameters. The effect is disabled by setting the intensity to zero, and the function can be called without parameters to print the current parameter values. The ghosting effect is shown below for the command: noise_ghost 2 0.3.
 
  
Ghosting off   Ghosting on
 
noise_pixel
Usage:
noise_pixel
noise_pixel intensty
 
Parameters:
intensity
Intensity (in greylevels) of pixel noise
 
Description:
This function emulates additive CCD noise by adding a uniformly distributed random number between zero and intensity to each band of every pixel. Note that a uniform distribution is used instead of a more accurate Gaussian distribution for computational efficiency. The effect is disabled by setting the intensity to zero, and the function can be called without parameters to print the current intensity. The pixel noise effect is shown below for the command: noise_pixel 40.
 
Pixel noise effect
 
radial_distortion
Usage:
radial_distortion
radial_distortion coefficient
 
Parameters:
coefficient
Second order radial distortion coefficient k2 (in range 0.0 - 0.000002)
 
Description:
This function emulates the radial geometric distortion observed in most lensed cameras. The distortion is modelled to second order as:

u = u' (1 + k2 |u|2)

where u is the original pixel position, u' is the radially distorted pixel position and k2 is the second order radial distortion coefficient. If this function is called with a parameter outside the range (0.0 - 0.000002), the distortion coefficient is clipped to this range. Radial distortion is disabled by setting the coefficient to zero, and the function can be called without parameters to print the current distortion coefficient. Note that radial distortion is only implemented for frame dimensions of 320x240 and lower. The effect is shown below for the command: radial_distortion 0.0000015.
 
  
Radial distortion off   Radial distortion with k2=0.0000015
© Copyright ObjectVideo, 2006. All rights reserved.