Shaders

Overview

We have made quite a few changes to the shaders and materials in UE4 for ATLAS. Some of the interesting new Material Nodes and useful Material Functions are documented here.

Nodes

Base Space Transform

In ATLAS, “Base Space” is the moving physics reference frame for the current object. You can read what this means for particles here in the Base Space guide, but for materials you can use the Transform Vector and Transform Position nodes to take advantage of it. As an example, consider any World Space effects that you may want to use, such as tri-planar texturing or World Space-derived UVs. Effects such as these will break down if an object is moving on a platform like a ship or saddle, but Base Space allows these effects to be achieved in the transform space of the moving platform, instead.

ObjectId

This node creates a unique integer for every object being rendered. It is useful for creating random variation on non-instanced meshes, similar to the per-instance random node:

../_images/ObjectID_02.png

RefPose to World Vector Transform

We created a TransformVector source space for “RefPose” which means you can transform from skeletal mesh bindpose/refpose into world space. The transform would include the scaling, though, so you may want to transform an offset direction vector and then apply any additional world space scale after normalizing the output. Note that this node only works in the vertex shader, so if you want to use it in the pixel shader you must pass it via Custom UVs.

Basic use case for RefPose to World that includes scaling:

../_images/RefPose_To_World_01.png

This version applies your world space scale after rotation and normalization:

../_images/RefPose_To_World_02.png

Functions

World Sine

../_images/worldSine.png

Description: Creates sines pattern in world space.

../_images/worldSine-matExample.png

Use Cases:

  • Creating a soft pattern for fake lights (Ex: Window Light)
  • WPO for character wavy bits (Ex: Desert Kaiju wings)

Gradient Hash

../_images/gradientHash.png

Description: Creates a unique value for each point in world space.

../_images/gradientHash-matExample.png

Use Cases:

  • Create random values for every point in the world
  • Provide random values as a replacement for Object ID in instances where meshes are combined