Basic Shader Processes

From C4 Engine Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This is a list of the basic shader processes that are available in the Shader Editor under the Basic tab.

Process

Description

Constant Scalar

Inputs: None

Output: Scalar

Outputs a constant scalar value that is specified in the settings for the process.

A parameter slot may be specified in the process settings. If the parameter slot is set to “Constant” (the default), then the output of this process can never be changed while rendering. However, if one of the eight numbered parameter slots is selected, then it is possible to change the value output by this process without actually modifying the shader. For instance, the Set Shader Parameter script method can be used to change the output value of this process, effectively making it a variable parameter of the shader.

Constant Vector

Inputs: None

Output: 4D vector

Outputs a constant vector value that is specified in the settings for the process.

See the note about parameter slots under the Constant Scalar process.

Constant Color

Inputs: None

Output: RGBA color

Outputs a constant color value that is specified in the settings for the process.

See the note about parameter slots under the Constant Scalar process.

Shader Time

Inputs: None

Output: Scalar

Outputs a scalar value in the range [0,1) representing the current shader time. The shader time runs from 0 to 1 over a period of 120 seconds and then repeats by wrapping back to 0.

Fragment Depth

Inputs: None

Output: Scalar

Outputs a scalar value equal to the depth of the fragment in camera space.

Primitive Facing

Inputs: None

Output: Scalar

Outputs a scalar value that is +1.0 for front-facing primitives and −1.0 for back-facing primitives.

Merge 2D

Inputs: Scalar x (required), Scalar y (required)

Output: 2D vector

Combines the two scalar inputs x and y into a single 2D vector output.

Merge 3D

Inputs: Scalar x (required), Scalar y (required), Scalar z (required)

Output: 3D vector

Combines the three scalar inputs x, y, and z into a single 3D vector output.

Merge 4D

Inputs: Scalar x (required), Scalar y (required), Scalar z (required), Scalar w (required)

Output: 4D vector

Combines the four scalar inputs x, y, z, and w into a single 4D vector output.

Texture Map

Inputs: 2D or 3D vector TEXC (required)

Output: RGBA color

Samples a texture map using the input texture coordinates TEXC. The texture map is specified in the settings for the process.

The size of the input TEXC is determined by the type of the texture map. The input is a 2D vector for 2D and Rect textures, and the size is a 3D vector for 3D, Cube, and Array 2D textures.

Note that this process should not be used for normal maps. Use the Normal Map process instead.

Normal Map

Inputs: 2D vector TEXC (required)

Output: 3D vector

Samples a normal map using the input texture coordinates TEXC. The normal map is specified in the settings for the process.

Paint Texture

Inputs: 2D vector TEXC (required)

Output: RGBA color

Samples a paint space texture map using the input texture coordinates TEXC. The texture map is determined by what paint space is associated with the geometry being rendered. The input vector is normally the output of the Paint Texcoord interpolant process.

Terrain Texture

Inputs: None

Output: RGBA color

Samples a terrain texture palette. The texture map is specified in the settings for the process.

Note that this process should not be used for terrain normal maps. Use the Terrain Normal process instead.

Terrain Normal 1, 2, 3

Inputs: None

Output: 3D vector

Samples a terrain normal palette. The normal map is specified in the settings for the process.

If one of these three processes exists, then all three should exist and should use the same normal map. Their outputs should be sent to a Terrain Diffuse Reflection and/or Terrain Specular Reflection process.

Impostor Texture

Inputs: None

Output: RGBA color

Samples an impostor texture map. The texture map is specified in the settings for the process.

Note that this process should not be used for impostor normal maps. Use the Impostor Normal process instead.

Impostor Normal

Inputs: None

Output: 3D vector

Samples an impostor normal map. The normal map is specified in the settings for the process.

See Also