TemplBeamProc Shader

Overview

The TemplBeamProc Shader can be used to create very cheap fog light beam effects.

Create a 3D object with a back plane and 4 intersecting planes like this:

Create a texture (all faces share UVs) with the following contents:

It is only gray scale and has no alpha.

The TemplBeamProc Shader can handle fading out rendering faces, that are in a certain angle to the camera. It's best to use sub-materials for the different parts, because you can control the angle of visibility.

So the back plane gets 1 sub-material and the other planes get 1 sub-material.

These are the settings for the shader:

Description

  • Although the shader doesn't seem to produce shadows, check the "no shadow" option to make sure.
  • The opacity must be set to 100% - the shader itself controls the opacity and you have enough control due to diffuse color, diffuse multiplier, etc.
  • With the diffuse color you can set the color and brightness of your light beams. It is suggested to not use only 1 RGB channel, in order to get good results (avoid 255,0,0 and similar stuff). Always try to give every channel at least a small percentage.
  • Use the texture with no alpha and gray scale as diffuse.
  • The shader params give you control over the blending but also the render size of the beam.

Shader Params

Description

ColorMultiplier

Increase/decrease brightness and blending.

EndColor

Set the end color for gradient.

EndRadius

Set the radius (in meters) of the effect at the end of the object.

Length

Adjust the scaling of the rendered effect (like scaling of the actual mesh).

OriginalLength

Scaling factor. If length and original length are the same, the object has scale of 100%.

OriginalWidth

Same as above.

Soft intersection factor

Controls softness of surface interaction with other opaque scene geometry.

StartColor

Set the start color for gradient.

StartRadius

Set the radius (in meters) of the effect at the start of the object.

View dependency factor

Controls the blending in and out depending on the facing angle to the camera.
The higher the value, the longer it will be visible even when nearly 90° to camera, the smaller the value the earlier it will start to vanish.

Shader Gen Options

Description

Noise map

Gives a nice motion to the beams but cannot be controlled by any parameters.

Muzzleflash

Option to be used for muzzle flash.

Final Results


Left: looking straight – until – Right: looking from bottom.

This effect is very cheap. Between 1 and 2 drawcalls, depending on how you set it up. Please make sure that this is only the fog light effect – a light still has to be placed.