How to switch materials in sequence of ue4

Switch materials in sequence

In sequence, you can modify the values ​​of some parameters while playing the sequence, just like the Alpha mentioned before. Of course, the same goes for materials.

There are two methods to switch materials in sequence:

1. The purpose can be achieved by setting the key value on the common. Of course, it not only includes the material ball, but also all other attributes can be switched through this method.

2. Create a material parameter set and modify the parameters in the parameter set through the key frames of the sequence to achieve the purpose of modifying the material. This method is particularly suitable for updating multiple shaders.

You can modify the parameters in the basic shader to affect all shader instances----Dago

Note: There are two different methods. The first is to switch the shader, and the second is to change the shader.

How to switch materials?

1. Directly switch the material ball

1. Drag the object into the scene, add it to Level Sequence and click Element 0.

2. Key any key frame in Material Element

3. Drag the sequence into the scene, check auto play in details, and play it in a loop

4. Run the test.

Summary: This method is relatively simple to switch materials, but the method is more versatile. You can also modify other parameters using this method.

2. Modify parameters in the material parameter set

By setting the parameter key in the material parameter set to a keyframe, the corresponding value is changed to modify the corresponding material ball.

1. Create a new material ball and a material parameter set.

2. Create two new variables in the material set parameters, one Scalar is used as EmissiveColor, and one Vector is used as BaseColor.

3. Drag the material parameter set into the newly created material ball. Choose the corresponding parameters

4. Create a new LevelSequence, add the material parameter set to Track, click +Parameter to add the two parameters created above.

And key some keyframes on the parameters.

5. Drag levelSequence into viewport, and check autoplay to loop.

6. Run the test

Summary: Modify the material ball through the material parameter set to achieve the purpose of switching materials. You can modify many material balls at one time.

Since material parameter sets can do this, can other parameter sets or data structures also be added to the sequence?

Guess you like

Origin blog.csdn.net/weixin_41363156/article/details/114552079