# Math

## Preconfigured mathematical functions such as calculation of pi, addition of vector components, and others.

Related Courses

Math functions perform basic math equations on the values of pixels within a texture.

## Math Functions

The following is a list of all the functions found in the Math category.

The AddComponents function takes in a Vector2, a Vector3, or a Vector4, combines their components together and then outputs the result. You must use the appropriate output for the corresponding input. For example, if you input an image into f3 (Vector3), then you must use the f3 output.

Item

Description

Inputs

f2 (Vector2)

Takes in a Vector2 value so that its components can be added together and sent to the f2 output.

f3 (Vector3)

Takes in a Vector3 value so that its components can be added together and sent to the f3 output.

f4 (Vector4)

Takes in a Vector4 value so that its components can be added together and sent to the f4 output.

Outputs

f2 (Vector2)

Outputs the combined value of the components from the f2 input.

f3 (Vector3)

Outputs the combined value of the components from the f3 input.

f4 (Vector4)

Outputs the combined value of the components from the f4 input.

Since each input is calculated individually for its corresponding output, you may use all three inputs on a single node, so long as you also use an output for each one. For instance, you may use one AddComponents function node to combine the components of a Vector2, utilizing the f2 output, and use the same node to combine the components of a Vector3, utilizing the f3 output.

### Pi

The Pi function serves as a constant for Pi, as calculated to the 6th decimal place (3.141592). The node also comes with an input for a multiplier.

Item

Description

Inputs

Multiplier (Scalar)

Input a value that will be multiplied times pi.

### LinearSine

The LinearSine function takes in a scalar value and outputs the linear sine (or rounded linear sine) of that value, running between 0 and 1. If you connect a Time expression to the value input and use the Linear Sine, you can see animation in the output that coincides with a linear sine wave.

Item

Description

Inputs

Value (Scalar)

This is the incoming value to which the linear sine function will be applied. If this value changes over time, the output will be a wave.

Period (Scalar)

Period controls the time required to make one full transition. Input values higher than 1 to slow the wave down.

-1 to 1 (StaticBool)

Setting this to true scales and offsets the wave to run between -1 and 1, rather than 0-1.

Sine Phase (StaticBool)

Setting this true will output normal sine behavior rather than linear behavior.

Outputs

Linear Sine

This outputs a linear sine wave.

Rounded Linear Sine

Outputs a linear sine with rounded edges.

The VectorToRadialValue function transforms the vector of a Vector2 into an angle, or transforms UV coordinate data into radial coordinates. In the case of a vector, the angle will output in one channel and the length of the vector in the other.

Item

Description

Inputs

Vector or UVs (Vector2)

Takes in either a Vector2 or a set of UV coordinates.

Swizzle Coordinate Output (StaticBool)

Flips the U and V components of the output.

Outputs

Returns the radial coordinates of the input. In the case of a vector, the angle is on one channel and the distance is on the other.

Vector Converted to Angle

Returns the angle of the input vector or a radial gradient in the case of UVs.

Linear Distance

Returns the linear length of the input vector, or in the case of UVs, outputs a radial gradient of distances.

Tags

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.