About : A list of all available and useful material expressions and a short explanation on what each of them does.
Target Audience : Unreal Engine users - Beginners and Intermediate
Platform : Unreal Engine 3.
Latest Update : September 2007
Related links : Material Tutorial 1
Material Tutorial 2
Material Tutorial 3
Water Tutorial 1 - Outdoor
Water Tutorial 2 - Indoor
Introduction
This tutorial will provide you a list of all available material expressions available. In clear and simple English it will clarify what's behind often ridiculously complex names.
Also, It is important to have a basic understanding of the mathematics behind a material. The material system in UE3 relies on numbers and math's. Multiply, Subtract, Sine, Add, and so on are all present. The basics are that any color in the RGB system is made up of just three simple numbers. Each number indicates how much color of each component is available. Blue has 1.0 of Blue, and 0.0 of both Red as Green, obviously. Yellow has 1.0 Red and 1.0 Green, 0.0 Blue.
Every color out there is created by mixing various amounts of each base color and as far as the engine is concerned, it are all just numbers. Colors don't exist. Numbers do.
If you multiply a yellow color (1.0, 1.0, 0.0) with a pure white color (1.0, 1.0, 1.0) it will look unchanged because 1 multiplied by 1 is still 1. This also goes for 0 multiplied by 1, The result is still 0. If the values don't change, the color won't change either.
However, if you would be multiplying it with a gray color (0.75, 0.75, 0.75) the yellow will be darkened because the numbers would result in 0.75, 0.75. 0.0.
The same thing is true for add and subtract. If you take a red color and you subtract a blue color, no difference will show up because the red color didn't had any blue in the first place, thus nothing can be subtracted (the sum of the two would result in a negative number, but since blacker than blacker doesn't exist it can't actually bring any visual difference to the material).
A texture, or any other kind of image for that matter, is made up of thousands of pixels. Each pixel has three color values that determine its color. If you were to multiply a texture by itself, all values of all pixels would be multiplied by itself. A gray line would become dark gray (0.75 X 0.75 = 0.56 = darker) where as bright white areas would remain as bright or become even brighter.
It is possible to have values over 1.0. Even though anything over 1.0 can't actually alter the color anymore, it can increase the strength and brightness. The latter is especially important when dealing with bloom or lights that need to appear really bright.
This system is identical to what programs as Photoshop use, with the difference that Photoshop uses maximum values that are much higher than 1.0. Regardless of the number, it is just a scale after all, the idea remains the same.
The Expressions
Abs
It inverts only the negative values. Positive values are not affected. -1 will become 1, but all other numbers higher than 0 will remain untouched. Handy to force values to always be higher than zero.
Add
Two inputs are blended on top of each other to get a single combined image.
AppendVector
Reassembles individual color channels. As you may know, all images are made up of three layers. Red, Green and Blue. When the three layers are combined, it results in images as you know them. AppendVector allows you to merge previously separated layers back into a single image. This is especially handy when you need to modify each layer individually and then want to merge all of it back into a single image. Another example: AppendVector can turn two separate Constant1Vector expressions into something that behaves as a single Constant2Vector.
BumpOffset
A fancy term for a feature commonly known as parallax mapping, or displacement mapping, although the latter is not entirely fitting. BumpOffset uses a black and white image as the Height input and raises areas of an image dependent on the intensity of the pixels on the height image. It is purely a camera effect, this expression will not truly deform geometry.
CameraVector
Moves the image dependent on the position and rotation of the camera. Good to fake reflections with and other effects that are dependent on the camera angle.
Ceil
Ceil basically rounds off values. 0.6 and 1.4 will become 1.0; 4.7 becomes 5 and so on. This expression has limited use, but for example, can be of great use for flickering lights and lightning simulations. Where as the regular Time -Sine setup creates soft fading flashes, adding a Ceil to the setup can remove the fading and make it harsher.
Clamp
Basically this does the same as Ceil, with the difference that the this time the user can manually set the Minimum and Maximum values by connecting Constant1Vectors to Min and Max. Clamp will round off all values above or below the set minimum and maximum values. If you enter a color of 4.0 and a minimum of 0.5 and a maximum of 1.0, the color will become 1.0. However a color of 0.75 will remain 0.75 because it did not exceed the minimum or maximum.
This can be handy when something must be confined to a specific brightness or direction (some expressions alter the direction of an effect, thus Clamping its values can have a impact on the direction of an effect - ignore this if it sounds too complicated right now)
ComponentMask
This is the opposite of AppendVector. Where as AppendVector allows you to merge different color channels back into a single image again, ComponentMask allows you to filter out color channels you don't want. If a yellow texture is entered into a ComponentMask, and it is set to only allow through Red and Blue, the texture will become red (yellow is made by mixing Green and Red, if there is no more Green, only Red is left).
Constant - Constant1Vector
This is most commonly used expression. Constant holds just one value and creates a solid grayscale color.
Constant2Vector
Identical to a regular Constant, only this time it holds the Red and Green channel. A Constant2Vector can create red, yellow, and green, but no blue.
Constant3Vector
This expression features all three color channels and is thus capable of generating any color available.
Constant4Vector
Features an alpha value, otherwise it is identical to Constant3Vector
Cosine
Can animate certain effects. In combination with Time this expression will result in a constantly fading color. Cosine constantly fades from disabled to enabled.
Crossproduct
In combination with CameraVector this can alter the direction of an effect. Otherwise near useless in every day use to my experience.
DepthBiasBlend
Allows the engine to automatically fade out a material near its edge as soon as it hits geometry. This effect is ideal to have watersurfaces automatically fade out near the shores or to prevent particles from displaying sharp lines when they cut through geometry.
DepthBiasedAlpha
Identical to DepthBiasBlend, but this expression is rendered by the hardware instead of software emulation like DepthBiasBlend. DepthBiasedAlpha should be preferred over DepthBiasBlend for performance reasons.
DepthBiasedBlend
Again, identical to DepthBiasBlend and also rendered through software. Obsolete expression.
Desaturation
As the name implies, this expression can desaturate its input.
DestColor
Alters the color of whatever is behind the material. The material should be translucent or additive if you want this to work.
DestDepth
Basically acts like distance fog. The further something is away, the more opaque it will become. Putting DestDepth on a sheet in front of the player will result in something very similar to true distance fog. This is ideal for watershaders where you might want to make deep areas more opaque than shallow locations. Must be used on Translucent or Additive surfaces.
Divide
A simple mathematical operation. A value is divided by another value, what remains forms the new color.
DotProduct
Creates a gradient. If a CameraVector and a ReflectionVector are used as input it creates a gradient dot. Can be used to fake phong highlights, among other things.
FlipBookSample
Kind of similar to how texture subdivisions worked for particles in Unreal Engine 2. A FlipBookSample expression allows a single texture that is divided into multiple frames to be read and animated.
Floor
Very similar to Ceil with the difference that Floor only rounds off values downwards. Where as Ceil rounds off values like 1.7 to 2.0; Floor will transform 1.7 into 1.0.
Frac
Transforms all values into something less than 1.0; example: 4.6 becomes 0.6; 1.0 becomes 0.0; 0.4 remains untouched.
Fresnel
Similar to DotProduct. Creates a black dot surrounded by white, or in other words, it creates a white glow around the edge. Fresnel creates the effect on the bio blobs in UT3 for example. Inverting this with a OneMinus might also give cool results.
If
Simple mathematical function, although it may be hard for some to imagine exactly how it can benefit a material. Its use is restricted to complex materials where certain effects are only allowed to be displayed once they conform to certain requirements.
LightVector
Unknown to me.
LinearInterpolate - LERP
It blends two different inputs on top of each other by using a third input (usually the alpha map) to determine the location and intensity of the blend. Similar to two layers and a MaskMap in Photoshop.
MeshEmitterVertexColor
Used for materials used on meshes spawned by particles. Allows the particle editor to modify things like the color of the mesh through the curve editor.
MeshSubUV
Similar to ParticleSubUV but this time for meshparticles.
Multiply
Will multiply any value by any other value.
Normalize
Helps bringing an entire image up to another scale. Wikipedia explains this pretty well "If the intensity range of the image is 50 to 180 and the desired range is 0 to 255 the process entails subtracting 50 from each of pixel intensity, making the range 0 to 130. Then each pixel intensity is multiplied by 255/130, making the range 0 to 255."
OneMinus - 1-X
This simply inverts the input. Black becomes white, yellow becomes blue, and so on.
Panner
A feature many of you may recognize from UE1 and UE2. It simply continuously pans a texture, ideal for conveyors, rivers and so on.
ParticleSubUV
Similar to FlipBookSample, but this time specially designed for particles.
PixelDepth
Kind of similar to DestDepth.
Power
Think of it like the brightness and contrast sliders in Photoshop. It simply raises the brightness and lowers the contrast, or it raises the contrast and lowers the brightness. Multiplies itself X times, dependent on the Exp. value. Good to alter a washed out texture or to derive specularity of a diffuse texture.
ReflectionVector
Similar to CameraVector, only difference is that ReflectionVector operates on a different axis.
Rotator
Simply rotates anything.
ScalarParameter
Used to set a variable scale to the material that can be accessed and altered via code. Little use for this in every day use.
SceneDepth
Similar to DestDepth, although SceneDepth is a little more powerful.
SceneTexture
Unknown to me.
ScreenPosition
Takes over the angle of the camera.
Sine
Very similar to Cosine.
SquareRoot
Simple mathematical expression that alters entered values.
Subtract
Another simple mathematical expression. Subtracts a value off another, usually resulting into a darker material but it can also be used to filter out a given color of an image.
TextureCoordinate
Can alter both the amount of tiling of something, as what UV set/channel to use.
TextureSample
Simply holds a texture or other kind of "bitmap".
TextureSampleParameter
Allows the texture/bitmap to be changed externally via code.
TextureSampleParameter2D/Cube/Movie/3D
Identical to TextureSampleParameter but now for all other kind of content such as cubemaps or movies.
Time
A simple expression that, although entirely useless if not combined with other expressions, it can be of great use for things that only have to occur every once and a while. Think of lightning, rotating animations that need to be inverted after a while, and so on.
Transform
Can alter a material to use another kind of space than the default Tangent space. What this means in reality is that you can make the alignment of the material relative to the camera or the object itself. Especially the option of making it relative to the camera (View) can be quite handy as it will create a kind of camera facing effect.
VectorParameter
Much like ScalarParameter, VectorParameter allows a color to be altered externally via code, or an instanced material.
VertexColor
Allows you access to the vertexcolors that may be available on a mesh.








