Animating materials

 31/03/23

Animating materials. 

Using Blueprints to Animate Materials during Gameplay Tutorial UE5 - YouTube

Colours need to be parameters (click convert to parameter) Name it something simple. 

Can't animate materials (as far as the video creator is aware) but can animate material instances. 

Go to world level blueprint. At the top, to the left of the sequencer/timeline button.

Event begin play > Create dynamic material Instance.

Input>Timeline (add colour track), colour track name will appear on the node. > Sequence(might not need) > Set Vector parameter value on materials, set parameter name and connect the colour track to the parameter value. Then set the parent (object with material, make sure the object has material instance.)

 I then watched this video UE4 Tutorial - How To Use Timelines - YouTube to get a better understanding of using timelines in blueprints (I know it is UE4 and I am using UE5 but I couldn't find any for 5 and I'm guessing these sorts of things would work similarly)

In this video, they add the timeline to the level blueprint. They use play from start and connect Event begin and connect the timeline to a "set" node using update. This is similar to the other tutorial. 

You can also animate movement and rotation through this using float tracks and set world location/rotation. connect other "set" nodes using the white update arrow. They also use "get" nodes to be able to animate just the x, y or z axis without changing the others. 

They also show how to use box triggers to stop and start the timeline which could be useful in my project since I was thinking that the events would progress as the user walks through the scene. 

This requires the box trigger, On Actor Begin Overlap (Similar to on player enter from unity) and End Overlap. Then add two cast to third-person character nodes and connect them using the white arrow and other actor to the begin and end nodes. 

When I tried some of the things I learnt I couldn't find the "Set Vector Parameter on Materials" So I tried looking at a different tutorial to see what they used How to change the colour of a material via Blueprint in Unreal Engine – JAY VERSLUIS This blog showed using "Set Vector Parameter Value" instead. 

This didn't work the same either because this node wants a MaterialParameterCollection as an input rather than the output of a dynamic material instance, therefore I made a collection and assigned some colour parameters which I then added to the materials to replace the normal colour parameters. This surprisingly worked and I managed to animate the colours of the clouds, however, for the 3D clouds the darker colour didn't look too good.

I also looked at some videos to change the sky like this (1) Unreal Engine 5 - Create a day night cycle in 90 seconds - YouTube Which was a bit too quick and didn't really go into detail. 

I also found a forum post where someone gave some tips for cloud materials 


I tried the Fresnel into Opacity but it didn't really look much better, I did have the idea of putting a non-translucent cloud shape inside the clouds but since I was using a material for the 3D clouds I didn't end up trying this.

Comments

Popular Posts