UE4 Material Blueprint Shortcuts

Software:
Unreal\n Engine 4.24

Some useful Unreal Editor Material Blueprint shortcuts:

  1. Hold 1 and LMB Click to create a 1D Constant node:
    Annotation 2019-12-26 005530
  2. Hold 2 and LMB Click to create a 2D Constant node:
    Annotation 2019-12-26 005549
  3. Hold 3 and LMB Click to create a 3D Constant node:
    Annotation 2019-12-26 005605
  4. Hold S and LMB Click to create a Scalar Parameter node:
    Annotation 2019-12-26 005618
  5. Hold V and LMB Click to create a Vector Parameter node:
    Annotation 2019-12-26 005631
  6. Hold L and LMB Click to create a Lerp (Linear Interpolate) node:Annotation 2019-12-26 005653
  7. Hold M and LMB Click to create a Multiply node:
    Annotation 2019-12-26 005722
  8. Hold A and LMB Click to create a Add node:
    Annotation 2019-12-26 005736
  9. Hold T and LMB Click to create a Texture Sample node:Annotation 2019-12-26 010504
  10. Hold U and LMB Click to create a Texture Coordinate node:
    Annotation 2019-12-26 010449
  11. Just press C to create a comment:
    Annotation 2019-12-26 005808

More UE4 Material Editing posts

UE4 – Basic Material Blending

Software:
Unreal Engine 4.24

The example explained in this article is creating a blend between a mud material, and a mud-leaves material using a mask (Alpha) texture.
>>
The scanned PBR materials in demonstrated in this post are from Texture Haven (texturehaven.com)

How does it work?
There is actually no blending of Unreal materials, but rather a regular Unreal material in which each of the parameters is defined as a linear blend between 2 different source values for that parameter.
We could create such a material blueprint that uses a Lerp (Linear Interpolate) node’s to provide each of the material parameters with a blend of 2 input textures/colors or parameters, connecting the alpha texture to all the Lerp nodes’s Alpha input, and effectively achieve blending of 2 different materials, but it would be a complex blueprint in which it’s very inconvenient to design each of the individual materials participating in the blend:
Annotation 2019-12-25 232734

This complexity can be greatly simplified by collecting each of the participating materials parameters into a Material Attributes data structure.
The Material Attributes data structure contains all the data needed to compile a material, and allows input, output, and processing of this data as a single blueprint data stream (connection).
For example, when the material parameters are grouped as a Material Attributes data structure, they can be blended by connecting them into a single BlendMaterialAttributes node, instead of “Lerping” (blending) between 2 inputs to create each individual material parameter, which produces an unworkable complex material blueprint like the previous example.

> To collect material parameters into a Material Attributes data structure, connect them into a MakeMaterialAttributes node:
annotation-2019-12-26-015532.jpg

> To create a blend between 2 Material Attributes data streams, use the BlendMaterialAttributes node:
* The Alpha parameter determines the weights of the blend (a black and white texture can be connected to it as the blend mask)
Annotation 2019-12-26 015717

> In order for the material output to receive a grouped Material attributes input instead of individual inputs for each parameter, select the material output, and in the Details panel, check the Use Material Attributes option:
matatts

Using the Material Attributes data structure, the blended material’s Blueprint in now much simpler and cleaner, while producing the exact same result as before:
Annotation 2019-12-26 021435

But designing 2 different materials within one material Blueprint is still far from being ideal..
What if we want to use just one of these materials on some surfaces?
What if the individual materials are not as simple as the materials shown here, it would be mush more efficient to be able to have one Blueprint for each of the materials allowing to focus on its development and preview it.
We can achieve this desired workflow by developing each of the materials as a Material Function.
Each of the participating materials is created as a Material Function with a Material Attributes output.

> One of the huge advantages of UE4’s material editing is that it allows us to preview a full material while developing it as a Material Function.
* This may sound trivial, but it isn’t. the Material Function isn’t compiled by itself as a material, it just produces data needed to define a material. in many other media production systems, this would have meant that you can develop data within the function but only preview it in the main material where the function is used.

> Learn how to create Material Functions

The Material Function defining the mud material:
Annotation 2019-12-26 024834.jpg

The Material Function defining the mud-leaves material:
Annotation 2019-12-26 024906.jpg

The Blend material using the Material Function nodes:
Annotation 2019-12-26 025111

Note:
When blending a non-metallic material with a metal material, the alpha values (mask colors) should be only 0 or 1 (black or white), otherwise blend areas that have a mid-range metallic value will make no sense visually.
> A RemapValueRange node can be used to force a color threshold on the mask texture or value.

Related:
Material Functions
Material Instances
Texture Painting

UE4 – Material Functions explanation and Example

Software:
Unreal Engine 4.24

Material Functions encapsulate shading flow graphs (material blueprints) into reusable shading nodes that have their own inputs and outputs.
This allows development of custom shading nodes, and saving the time it takes to recreate the same flow graphs multiple times or even copy and paste material flow graphs.
Common shading processes and operations that have to be performed in many different materials, and even multiple times in a single material can be defined as a Material Function for quick and easy re-usability.
Material functions can also be used to encapsulate a full material blueprint with a Material Attributes output. this provides a convenient workflow for blending different materials together.

In this post I’ll detail the steps needed to create and use a Material Function.
The Material Function example we’ll create, called “ColorAngleBlend” performs a commonly needed shading operation of blending 2 colors or textures according to the surface viewing angle (facing ratio).

The ColorAngleBlend Material Function will have the following inputs:

  1. color a:
    The color or texture appearing when viewing the surface at perpendicular angle.
  2. color b:
    The color or texture appearing when viewing the surface at grazing view angle.
  3. curve exponent:
    The steepness of the blend curve between the colors, 1 being a linear blend and higher values displaying color a at more angles “pushing” color b to be seen only at grazing angle.
  4. base color blend:
    The percent of color b seen at perpendicular view angle.
  5. normal:
    bump normals input.

The final “ColorAngleBlend” Material Function Blueprint:
* The internals of the “ColorAngleBlend” Material Function
Annotation 2019-12-24 151655.jpg

An example of the “ColorAngleBlend” Material Function node used to create a reach view-angle dependent color blend for a steampunk metal material:
Annotation 2019-12-24 152625

An example of the “ColorAngleBlend” Material Function node used to create a reach color for a car-paint material:
Annotation 2019-12-24 152036

An example of the “ColorAngleBlend” Material Function node used to create a washed-out effect for a cloth material:Annotation 2019-12-24 151927
Steps for creating the “ColorAngleBlend” Material Function:

  1. In the content browser, create a Material Function Object and name it “ColorAngleBlend”:
    Annotation 2019-12-24 161420
    Annotation 2019-12-24 162132
  2. Double click the ColorAngleBlend Material Function to open it for editing:
    Annotation 2019-12-24 162209
  3. Click the background of the work space to deselect the Output Result Node,
    So that the Details panel on the left will display the Material Functions‘s properties.
    Type a description into the Description field, check the Expose to Library option so that the new Material Function will be available to all materials in the Palate and node search, and define in which node categories it should appear:
    Annotation 2019-12-24 162805
  4. Select the Output Result node and in the Details panel on the left set its output name to “color”:
    Annotation 2019-12-24 163948
  5. Add a Linear Interpolate (Lerp) node, a Fresnel node and a Transform Vector (Tangent space to World space) node to the Blueprint and connect the nodes like this:
    * The Lerp node will blend the 2 color inputs with the Fresnel providing view angle data as the alpha for the Lerp.
    The Transform Vector  node is needed to convert normal (bump) input to world space for the Fresnel node.
    Annotation 2019-12-24 164646.jpg
  6. Adding function inputs:
    Create 2 Function Input nodes, in their Details panel, name them “color a” and “color b”, leave their Input Type as default Vector3D, check the option Use Preview Value as Default, number their Sort Priority parameters 0 and 1 to make them appear as the first inputs of the ColorAngleBlend node as it will appear when used in a material, and connect them to the Lerp node’s A and B inputs:
    Annotation 2019-12-24 165934
  7. Adding function inputs:
    Create 2 new Function Input nodes, name them “curve exponent” and “base color blend”, this time set their Input Type to Scalar, check the option Use Preview Value as Default, set their Sort Priority parameters to 2 and 3 and connect their outputs to the Fresnel node’s ExpoentIn and BaseReflectFractionIn inputs:
    Annotation 2019-12-24 171212.jpg
  8. Adding function inputs:
    Create the final Function Input node, name it “normal“, set its Input Type to Vector3D, check its Preview Value as Default option, set its Sort Priority to 4, and connect its output to the Fresnel node’s Normal input:
    Annotation 2019-12-24 171640
  9. Adding default inputs:
    Finally, add constant nodes to serve as default input values for the Material Function.
    A pure white Constant3Vector (color) constant as the default value for “color a” input,
    A pure black Constant3Vector (color) constant as the default value for “color a” input,
    A Constant with value 1.0 as the default value for “curve exponent” input,
    A Constant with value 0.0 as the default value for”base color blend” input,
    A pure blue Constant3Vector (color) constant as the default value for “normal” input.
    > Tip for quick creation of constant value nodes
    Annotation 2019-12-24 172438
  10. Save the new Material Function.

To use the new ColorAngleBlend Material Function create a new material, in the node search start typing color… to locate the ColorAngleBlend node and create it, and connect it to the desired material input.

Annotation 2019-12-24 173747

Annotation 2019-12-24 173809.jpg

> Material Functions can also be used by dragging them from the Content Browser into the Material Blueprint.

Related posts:
UE4 – Procedural Bump Normals
UE4 – Material Instances
UE4 – Fresnel node
UE4 – Triplanar mapping

UE4 – RemapValueRange Node

Software:
Unreal Engine 4.24

Having to remap a value range is very common in designing shaders, whether it’s to perform a traditional “levels” operation on a texture, or use just a specific range of values in a float input.
The RemapValueRange node let’s us do just that. this node has 5 inputs:

  1. Input: The input value
  2. Input Low: Input mapping range minimum
  3. Input High: Input mapping range maximum
  4. Target Low: Output range minimum
  5. Target Height: Output range maximum

Mono Noise examples:

  1. The original noise pattern:0
  2. Mapping input 0 -> 1 to output 0 -> 1 obviously has no effect:1
  3. Mapping input 0 -> 1 to output 0.3 -> 0.7 reduces the pattern contrast:2
  4. Mapping input 0.3 -> 0.7 to output 0 -> 1 increases the pattern contrast:3
  5. Mapping input 0 -> 1 to output 1 -> 0 inverts the pattern:4

In this example RemapValueRange nodes are applied to a texture’s individual color channels to increase contrast (Levels):
> Note that this operation can be performed using a simpler graph by using float3d adding and multiplication operations on the texture color (this will be a subject for a different post)
> Note that a different remapping operation can be performed on each color channel of a texture to adjust its color balance.

Before the value remapping:5

After the value remapping tha value in each channel 0.1 -> 0.9 to 0.0 to 1.0:6

The same operation performed by multiplication by 1.2 and subtracting 0.1:7.jpg

UE4 Blueprint Delay node

Software:
Unreal Engine 4.18

Untitled-1

The Delay node serves as a timer that will execute the connected blueprint after a predefined time in seconds.

An example of usage could be triggering a game event at a set time after the player entered a location.
You can use random values or other expressions connected to the Duration input to create a richer and less predictable interaction.

The magic of Blackmagic Fusion

Software:
Fusion 8.2

Untitled-1

 

The quest to find an affordable Node-Based Compositing software

I generally prefer doing compositing for video and 3D animation using Node Based Compositing software.
In the past I worked happily with Autodesk Combustion, until it was discontinued, than I went on working with Autodesk Composite (Toxik) which was also kind-of discontinued, and was installed as part of the 3ds max package, and can still be downloaded for free at Autodesk Exchange.

Autodesk Composite is an awesome compositing technology, and I did a lot of work with it, but the only reason I could afford it in the first place was that Autodesk stopped actively developing it and shipped it as a (rather powerful) ‘goody’ along with 3ds max and Maya. while I can still go on working with Autodesk Composite, Its lack of active development is showing, and I decided to look for a better solution.

Obviously, this discussion can’t be serious without mentioning The Foundry’s Nuke compositing software, which as far as I understand the leading node based compositing solution in the VFX industry today.
But in my small indie studio perspective Nuke is expensive, and for my compositing needs, there’s simply no justification to make the investment.

Another node based compositing software that must be mentioned here is the open source software Natron.
Natron is a very serious development, there’s a growing community around it, and it seams to me that it might be on its way to become the ‘Blender’ of the compositing industry.
I did some tests with Natron 2.1.4, it’s interface is very similar to Nuke’s interface, and from the way the interface is designed, its approach to reading and processing 32 bit float multi-channel EXR file sequences, and it’s current library of available nodes, it’s pretty obvious that this development effort is aiming to be a high end VFX node based compositor.
But for me, there are still some key features missing, like 3D compositing, a vector blur node and more.
* It should be noted that you can add Re-Vision Effects ReelSmart Motion Blur plugin to get vector blur functionality and other features like motion estimation.

 

Enter Blackmagic Fusion

Fusion is actually not a newcomer in the field of node based compositing.
Initially developed by Eyeon software, it was named ‘Digital Fusion’, than just ‘Fusion’, and in the past decade was heavily developed in the direction of 3D compositing.
If I remember correctly, Fusion was also expensive, I think it cost around 6000 dollars…
But than magic happened..
A couple of years ago Blackmagic Design, which is by-far the most disruptive company in the production and post-production gear industry, has purchased Eyeon software, continued developing it, integrated it into their product pipeline and made it available as a free edition of the software and a more heavily equipped ‘Studio’ edition of the software, that costs 299$, which is absolutely accessible in small indie studio terms.

I downloaded the free edition of the software, and immediately started working with it, getting used to the interface while working on actual animation projects in the past year,
And to cut the long story short, it’s awesome and it’s a very happy ending to my quest for finding a compositing solution, for the following reasons:

  1. Node based.
  2. Full 32 float workflow.
  3. Robust support for multi-channel EXR file sequences.
  4. Excellent Vector-Motion-Blur and Depth-Blur (DOF) effects,
    And many other 3D channel based tools like Volume-Mask, and more.
  5. 3D compositing.
  6. Very fast GPU accelerated OpenCL processing (render are extremely quick).
  7. Many more..

In conclusion, my opinion is that it’s a no brainer,
If your looking for an affordable, robust node-based compositing software that’s well equipped for 3D animation needs,
Blackmagic Fusion is the answer.

UE4 – Material Fresnel Node

Software:
Unreal Engine 4.18

The UE4 Fresnel node is actually a “Facing Ratio” node (aka Perpendicular / Parallel) with some extra control.
It basically allows controlling material effects according to the incident angle the surface is viewed at, which is a hugely important feature for designing advanced material effects.

Untitled-3

Exponent:
The steepness of the value / angle curve.

Base Reflect Fraction:
The value at perpendicular angle.

Normal:
An option to connect World Space surface normals input to affect the output of the Fresnel node.
* Tangent Space normals must be converted to World Space by using a Transform Vector node.

Note:
A value of 1.0 for the Exponent parameter, and a value of 0.0 for the Base Reflect Fraction will produce a linear “Facing Ratio” (“Perpendicular / Parallel”) falloff blend.

Examples of different values:
Untitled-3
Untitled-4

More info:
https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/HowTo/Fresnel/

Related posts:

  1. UE4 – basic architectural glazing material
  2. Understanding Fresnel reflections