UE4-Material Editing Common Nodes

This article is an introduction to the frequently used material nodes  in the material blueprint .

Texture coordinates: TextureCoordinate

Click on the node to display the parameters in the details panel:

Coordinate index: The material can have more than one set of UV channels, set the index value to use the channel. (0 for first channel, 1 for second channel)

U Tiling: Specifies the amount of tiling in the U direction.

V Tiling: Specifies the amount of tiling in the V direction.

Shortcut key: U + left mouse button

One: add, subtract, multiply, divide

1.Add

Related calculations involve constant + constant, same-dimensional vector + same-dimensional vector, multi-dimensional vector + constant.

(1) Constant + constant:

0.6+0.4 The result is: 1

(2) Same-dimensional vector + same-dimensional vector:

(0.2,0.3,0.4)+(0.1,0.2,0.3)

The result is: (0.3,0.5,0.7)

Explanation: Each channel in the material is added separately, and finally the color value is output.

(3) Multidimensional vector + constant:

(0.2,0.2)+1 result: (1.2,1.2)

(0.1,0.2,0.3)+1 result: (1.1,1.2,1.3)

Explanation: The constant 1 shows that the color in the material is white, and the RGBA values ​​in white are all 1, so the constant 1 is converted into a multidimensional vector, and each channel value is 1. Then the channel values ​​are added.

2. Minus Subtract

The principle is the same as addition, the value of each channel is subtracted, and the result is output at last.

Example: subtract 0.5 and 0.2 to get 0.3; subtract (0.2,-0.4,0.6) and (0.1,0.1,1.0) to get (0.1,-0.5,-0.4); subtract (0.2,0.4,1.0) and 0.2 to get (0.0,0.2,0.8)

3. Multiply 

The principle is the same as addition, the values ​​of each channel are multiplied, and the result is finally output.

Example: multiply 0.4 and 0.5 to get 0.2; multiply (0.2,-0.4,0.6) and (0.0,2.0,1.0) to get (0.0,-0.8,0.6); multiply (0.2,-0.4,0.6) and 0.5 to get (0.1,-0.2,0.3).

Note: The final result is not limited to 0-1. When the value is greater than 1, the material brightness will increase.

4. Except Divide

 The principle is the same as addition, the value of each channel is divided and calculated, and the result is finally output.

Two: component mask, append, power, texture rotation, time drive, 1-, sine, cosine, constant deviation ratio, coordinate conversion, limit, normalization, dot product, linear interpolation

1. Component Mask ComponentMask 

Specific channel values ​​can be selected for output.

 The UV channel value is extracted in the above figure. UV is a two-dimensional vector value, so there are only two channels of RG. The R channel gets the U value in UV, and the G channel gets the V value in UV. If you want to output the R channel, uncheck the G channel.

Note: Checking a single channel outputs a one-dimensional vector, and checking two channels outputs a two-dimensional vector.

2. Add AppendVector

Group the values ​​into a new vector group. For example: After A is constant 0.2 and B is constant 0.4, after using nodes, the output result is (0.2,,04).

A is the vector (0.2, 0.4) and B is the constant 0.1 After using the node, the output is (0.2, 0.4, 0.1).

3. Power 

Base: base, which number

Exp: power value, how many powers are calculated

Meaning: Which number needs to be raised to the power and output the final value.

4. Rotate Custom Rotator

UVs: accept UV coordinate values

RotationCenter: the coordinate value of the rotation center point

RotationAngle: rotation angle (the input value will be automatically converted into 0-360 degrees, input value 1, the corresponding angle after node conversion is 360 degrees)

 5. Time-driven

 Rotate the material effect with time, completed by two nodes 4 and 5,

parameter:

Ignore pauses: If true, time will always advance, unaffected by game pauses. When the pause command is invoked while the game is running, the material with this option checked will continue to produce effects.

6. OneMinus 1-node

Explanation: Takes an input value "X" and outputs "1 - X". This operation is performed channel by channel.

 For example: the OneMinus value of 0.4 is 0.6; the OneMinus value of (0.2,0.5,1.0) is (0.8,0.5,0.0); the OneMinus value of (0.0,-0.4,1.6) is (1.0,1.4,-0.6).

7. Sine, cosine

Sine: Sine

Note: Don't misspell it, it's Sine not Sign

Cosine: Cosine

The sine and cosine functions in mathematics, these two nodes can process the input value and control the output value between -1 and 1.

extension:

The sign node function is:

If the input value is negative, the output value is -1.

If the input value is 0, the output value is 0.

If the input value is positive, the output value is 1.

8. Constant bias ratio ConstantBiasScale

The output value is: input value + 1, multiplied by 0.5.

 9. Coordinate transformation search Transform Select the node name in the vector item

Transforms three-channel vector values ​​from one reference frame to another. The input values ​​are of RGB channels.

Simply put, it is a node for space transformation. Select the node in the details panel to set what space to convert to.

10. Limit node Clamp

After setting the minimum and maximum values, judge the input value. If it is within the range, output the input value. If the input value is less than the Min value, return the Min value. If the input value is greater than the Max value, output the Max value.

11. Normalize Normalize 

This node converts the input vector to a unit vector. The value is compressed into the range (0~1)

12. Dot Product

It can be described as the length of one vector projected onto another vector, and the final output is a number. DotProduct requires that both vector inputs have the same number of channels.

13. Linear Interpolate LinearInterpolate

 Mix the two values ​​of A and B according to the value of Alpha.

If Alpha is 0, then the first input will be used.

If Alpha is 1, then the second input will be used.

If Alpha is between 0.0 and 1.0, then the output is a blend between the two inputs.

NOTE: Mixing is by channel. The value of Alpha should be between 0-1

3. Move, blend, normal strength adjustment, selection, world space vertex normal, Finier, open displacement, depth node

1. Mobile node Panner

 parameter:

Coordinate accepts the incoming UV value, if not connected, it defaults to ConstCoordinate.

Time: If not connected, it will follow the game time by default and keep offsetting. Set a fixed value, calculate the offset corresponding to this value and display it, without dynamic changes. This value can be controlled by Blueprint or Cinematic input.

Speed: Movement speed. This value is a two-dimensional vector, corresponding to the RG channel, which affects the movement speed of the image in both UV directions.

2. Blend Blend_Overlay

Filter or multiply blend the Base and Blend.

Base base color value a, 0 <= a <= 1, Blend mixed color value b, 0 <= b <= 1, ab is mixed, and the output value is divided into two cases:

1. When a < 0.5, the output value is: c = 2ab, 0 <= c < 2b

2. When a > 0.5, the output value is: c = 2(1-b)a+(2b-1), 2b < c < 1

Official example:

3. Normal strength adjustment FlattenNormal

 parameter:

Normal: normal value

Flatness: flatness

This node is used to adjust the normal strength. After testing, when the input Flatness value is between 0-1, the larger the value, the flatter the normal effect on the material.

More than 1 or less than 0, the normal effect will be enhanced.

4. Select Static Switch

 parameter:

Value: Judgment condition, used to control the output value, this value is a Bool value.

True: Entered parameters when correct

False: Parameters entered on error

5. World space vertex normal VertexNormalWS

This node outputs world space vertex normals and can only be used for material inputs to vertex shaders, such as WorldPositionOffset. Used to set the growth or shrinkage of the mesh.

Note: By default, all shader calculations for materials are done in tangent space.

Example:

 By manipulating the nodes so that each vertex moves in its own normal direction, the sphere appears to scale with sinusoidal motion.

Note: The last output connected is the world scene position offset.

6. Fresnel

The attenuation calculated by the Fresnel formula is based on the scalar product of the surface normal and the orientation of the camera. When the surface normal is facing the camera, the output value is 0. When the surface normal is perpendicular to the camera, the output value is 1. The result is limited to the range [0,1] to ensure that no negative colors are produced in the center.

Exponentln: Specifies the rate at which the output value decays. Larger values ​​indicate tighter or faster decay.

BaseReflectFractionln: The strength of the specular reflection when viewing the surface from its direction. Smaller values ​​are more reflective, a value of 1 will effectively disable the Fresnel effect. The Fenier effect is 7. Turn on the sphere in the first picture in the displacement.

The model vertex normal and camera normal are used

Example: glass material production

7. Turn on replacement

 In the shader blueprint editor, click on the blank space, find the tessellation in the details panel, modify the tessellation mode and replace without cracks.

 Crack-Free Replacement: No seams after replacement.

If you want to have a displacement effect on this object, you need to cooperate with the world space normal vertex node. 

Note: the result is concatenated with the world displacement,

Tessellation Multiplier: Controls the amount of tessellation on the surface, the larger the value the more pronounced the effect.

Comparison of displacement and normal map effects:

1. The normal map is to make the object look like a bump effect. Displacement is the deformation of the model.

2. Replacement consumes more resources.

4. The difference between world scene position offset and world scene displacement

World Position Offset: is to allow manipulation of mesh vertices in world space by materials. It is the operation performed on the vertices of the model.

World Displacement: Allows the material to manipulate tessellation vertices in world space, an operation that enables displacement.

8. Depth node DepthFade

Function: It is used to hide the unsightly seams that appear when translucent objects intersect with opaque objects.

parameter:

Opacity: Receives the object's existing opacity before depth fade.

FadeDistance: Fade distance.

Official example:

9.CameraVectorWS

The expression outputs a three-channel vector value representing the orientation of the camera relative to the surface, that is, the pixel-to-camera orientation.

Example:

CameraVector is typically used for fake environment maps by connecting the CameraVector to a ComponentMask and using the CameraVector's x and y channels as texture coordinates.

Effect: The texture seen on the surface of the object changes as the camera moves.

Guess you like

Origin blog.csdn.net/lei_7103/article/details/123004178