Shaft Effects

From C4 Engine Wiki
Jump to navigation Jump to search
Figure 1. Shaft effects in a dungeon.

A shaft effect renders a volumetric light shaft in a particular direction like those shown in Figure 1. There are four types of shaft effect (box, cylinder, truncated pyramid, and truncated cone) that can be created in the World Editor by using the tools in the Effects Page.

A shaft effect is rendered with a volumetric light in-scattering shader that calculates the actual distance travelled through the light shaft by a ray starting at the camera position for each pixel covered on the screen and determines how much light is scattered toward the viewer. Even though each type of light shaft has a finite extent in the scene, the interior is rendered as if the light shaft had infinite extent along the object-space z axis. For the box and cylinder shaft effects, the interior volume extends to infinity in both the positive and negative z directions. For the truncated pyramid and truncated cone light shafts, the interior volume extends to the apex of the untruncated volume in the positive z direction and to infinity in the negative z direction. The density at bottom end is often set to zero to give a light shaft the appearance of fading out and having only finite extent.

Shaft effects have some basic animation controls described below that can be used to smoothly fade them between different intensity scales.

Shaft Effect Settings

A shaft effect can be configured under the Shaft tab in the Node Info window. The specific settings are described in the following table.

Setting

Description

Shaft Settings

Shaft color

The color of the shaft effect. This should generally be a bright color, and the overall intensity of the light shaft should be controlled by the intensity scale.

Density at bottom end

The density of the shaft at the bottom end (toward the −z direction).

Density at top end

The density of the shaft at the top end (toward the +z direction).

Primary intensity scale

The primary scale factor by which the distance light travels through the shaft is multiplied to arrive at a final intensity value.

Render width random noise

Causes the shaft effect to be rendered with a small amount of random noise in order to hide banding artifacts that can be visible against plain backgrounds or when shafts are animating their intensities. It is slightly more expensive to use random noise, so this option should be left unchecked if banding artifacts are not visible.

Cull if camera above top plane

Indicates that the shaft effect should not be rendered if the camera is positioned above the top plane of the shaft's volumetric shape plus the margin given by the next setting, in object coordinates. This is useful when a shaft effect is placed at an opening like a window so that the shaft can only be seen from the inside of a structure.

Top plane cull margin

Specifies a distance that is added to the maximum z value occupied by the shaft's volumetric shape in object coordinates when testing the camera position in the case that top plane culling is enabled by the previous setting.

Shaft Animation Settings

Randomly animate intensity

Enables random intensity animation. The following settings control how the light shaft is animated.

Secondary intensity scale

A secondary intensity scale that specifies the limit of the animation opposite the primary intensity scale above. The shaft effect intensity is smoothly animated between the primary and secondary intensities.

Minimum primary hold time (s)

The minimum time, in seconds, for which the intensity is held at the primary level during animation. Whenever the shaft effect animation reaches the primary intensity, it selects a random time between this setting and the next setting and waits for that time before transitioning to the secondary intensity again.

Maximum primary hold time (s)

The maximum time, in seconds, for which the intensity is held at the primary level during animation.

Minimum secondary hold time (s)

The minimum time, in seconds, for which the intensity is held at the secondary level during animation. Whenever the shaft effect animation reaches the secondary intensity, it selects a random time between this setting and the next setting and waits for that time before transitioning to the primary intensity again.

Maximum secondary hold time (s)

The maximum time, in seconds, for which the intensity is held at the secondary level during animation.

Minimum transition time (s)

The minimum time, in seconds, over which the intensity transitions from the primary to secondary intensity level or vice-versa. Whenever the light shaft animation has finished holding at either the primary or secondary intensity scale, it selects a random time between this setting and the next setting and animates to the opposite extreme over that amount of time.

Maximum transition time (s)

The maximum time, in seconds, over which the intensity transitions from the primary to secondary intensity level or vice-versa.

See Also