Coordinates Expressions

ActorPositionWS

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

ActorPositionColors.png ActorPositionNetwork.png

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.

CameraPositionWSExample.png CameraPositionWSNetwork.png

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.

ObjectOrientationExample.png

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.

WorldPositionWSScene.png WorldPositionNetwork.png

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.

ObjectRadiusExample.png

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 ScalarParameter 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.

PannerExample.png

ParticlePositionWS

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

ParticlePositionWS.png

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.

PixelNormalWSExample.png

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 ScalarParameter can be used as well to set a specific offset or to control the rotation through Matinee or Blueprints.

RotatorExample.png

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.

ScreenPositionExample.png

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.

TextureCoordinateExample.png

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.

VertexNormalWSExample.png

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.

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.

ViewSizeNetwork.png

ViewSize1.png ViewSize2.png
Preview Window Size: 740x700 Preview Window Size: 740x280

In this example, ViewSize is being fed into Base Color. The result is divided by 2,400 to provide a more meaningful result.

WorldPosition

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

WorldPositionExample.png

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:

WorldPosPlanarMap.png

Tags