Coordinates Material Expressions

Expressions that perform actions on texture coordinates or output values that can be used as, or to modify, texture coordinates.

Choose your operating system:

Windows

macOS

Linux

ActorPositionWS

ActorPositionWS outputs Vector3 (RGB) data representing the location of the object with this material on it in world-space.

Actor Position WS expression

In this example, you can see that ActorPositionWS is being fed directly into the Base Color of the material. As a result, each of the spheres with the material applied to them show a different color as they are moved to different locations in 3D space. Note that the result of the ActorPositionWS node is being divided by 1600 to create a nice blend-in color, rather than a pop.

CameraPositionWS

The CameraWorldPosition expression outputs a three-channel vector value representing the camera's position in world space.

The preview sphere changes color as the camera rotates.

LightmapUVs

The LightmapUVs expression outputs the lightmap UV texture coordinates in the form of a two-channel vector value. If lightmap UVs are unavailable, it will output a two-channel vector value of (0,0).

ObjectOrientation

The ObjectOrientation expression outputs the world-space up vector of the object. In other words, the object's local positive z-axis is pointing in this direction.

Object Orientation expression

ObjectPositionWS

The ObjectPositionWS expression outputs the world-space center position of the object's bounds. For example, this is useful for creating spherical lighting for foliage.

Object Position Expression

ObjectRadius

The Object Radius outputs a value equal to the radius of a given object in Unreal units. Scaling is taken into account and the results can be unique for each individual object.

Object Radius expression

In this example, both meshes are receiving this material in which the ObjectRadius is fed into Diffuse. The ObjectRadius output is being divided by 512 to provide a more meaningful visual result.

Panner

The Panner expression outputs UV texture coordinates that can be used to create panning, or moving, textures.

Item

Description

Properties

SpeedX

Specifies the speed to pan the coordinates in the U direction.

SpeedY

Specifies the speed to pan the coordinates in the V direction.

Inputs

Coordinate

Takes in base UV texture coordinates the expression can then modify.

Time

Takes in a value used to determine the current panning position. This is usually a Time expression to provide a constant panning effect, but a Constant or Scalar Parameter can be used as well to set a specific offset or to control the panning through Matinee or Blueprints.

Panner generates UVs that change according to the Time input. The Coordinate input can be used to manipulate (e.g. offset) the UVs generated by the Panner node.

ParticlePositionWS

The ParticlePositionWS expression outputs Vector3 (RGB) data representing each individual particle's position in world space.

Particle Position WS example

In this image, ParticlePositionWS is being fed into emissive color to visualize the data. The particle system has been scaled up to show how the color is changing based on position.

PixelNormalWS

The PixelNormalWS expression outputs vector data representing the direction that pixels are facing based on the current normal.

Pixel Normal WS Example

In this example, PixelNormalWS is fed into Base Color. Notice how the normal map is used to give the per-pixel result.

Rotator

The Rotator expression outputs UV texture coordinates in the form of a two-channel vector value that can be used to create rotating textures.

Item

Description

Properties

CenterX

Specifies the U coordinate to use as the center of the rotation.

CenterY

Specifies the V coordinate to use as the center of the rotation.

Speed

Specifies the speed to rotate the coordinates clockwise.

Inputs

Coordinate

Takes in base UV texture coordinates the expression can then modify.

Time

Takes in a value used to determine the current rotation position. This is usually a Time expression to provide a constant rotation effect, but a Constant or Scalar Parameter can be used as well to set a specific offset or to control the rotation through Matinee or Blueprints.

SceneTexelSize

The SceneTexelSize expression allows you to offset by texel sizes, as you would when using the SceneColor and SceneDepth expressions. This is useful for edge detection in multi-resolution systems, as without this calculation you would be forced to use a small static value, resulting in inconsistent results at lower resolutions.

ScreenPosition

The ScreenPosition expression outputs the screen-space position of the pixel currently being rendered.

Screen Position example

TextureCoordinate

The TextureCoordinate expression outputs UV texture coordinates in the form of a two-channel vector value allowing materials to use different UV channels, specify tiling, and otherwise operate on the UVs of a mesh.

Item

Description

Properties

Coordinate Index

Specifies the UV channel to use.

UTiling

Specifies the amount of tiling in the U direction.

VTiling

Specifies the amount of tiling in the V direction.

Un Mirror U

If true, undo any mirroring in the U direction.

Un Mirror V

If true, undo any mirroring in the V direction.

Example Usage: To access the second UV channel of a mesh, create a TextureCoordinate node, set its CoordinateIndex to 1 (0 - first channel, 1 - second channel, etc), and connect it to the UVs input of a TextureSample node.

Texture Coordinate Example

VertexNormalWS

The VertexNormalWS expression outputs the world-space vertex normal. It can only be used in material inputs that are executed in the vertex shader, like WorldPositionOffset. This is useful for making a mesh grow or shrink. Note that offsetting position along the normal will cause the geometry to split apart along UV seams.

In the example above, the preview sphere would seem to scale up and down with sinusoidal motion, as each of the vertices moved in their own normal directions.

VertexTangentWS

The VertexTangentWS expression outputs the world-space vertex tangents. Like VertexNormalWS, this is useful for manipulating the vertex positions of a mesh to produce subtle ambient animation through the World Position Offset input.

In the above example, each vertex on the sphere moves in a sinusoidal motion along the vertex tangent in world space. This gives an impression that the sphere is twisting to the left and right. On the plane, it causes the plane to wobble left and right along the vertex tangents.

ViewSize

The ViewSize expression outputs a 2D vector giving the size of the current view in pixels. This is useful for causing various changes in your materials based on the current resolution of the screen.

In this example, ViewSize is connected to Base Color and the result is divided by 2,400 to make the result more visible. When the size of the preview window increases or decreases, the color of the sphere changes.

WorldPosition

The WorldPosition expression outputs the position of the current pixel in world space. To visualize, simply plug the output into Emissive:

World Position Example

Common uses are to find the radial distance from the camera to a pixel (as opposed to the orthogonal distance from PixelDepth). WorldPosition is also useful to use as a texture coordinate and have unrelated meshes using the texture coord match up when they are near each other. Here is a basic example of using WorldPosition.xy to planar map a texture:

Planar projection WS