How does the "Time" node in the material editor work?

I initially thought it ‘ticked’ inside the material, and that the timer started when the material was spawned, but this doesn’t seem to be the case.

What I’m trying to do is have my shield material start playing right when it’s created, that way I can delete it after it’s finished. How can I do this?

It doesn’t matter when I spawn the material, they are all synced up to the same time.

Video to show what I mean:

‘Time’ is basically a globalparameter that is set based on the engine’s internal time parameter. Materials don’t need to tick or execute code on their own to access it.

‘Time’ starts when the game/editor starts and keeps increasing. In blueprint you can access the same value by using “Get real time in seconds”. There is another time called “game time” that also pauses when your game is paused but I believe real time is the one used by materials.

If you want to fade with timing on spawn, you need to create a material instance dynamic. Once you have an MID created by the blueprint you can use one of two ways to control the fade. One is via timelines where you manually control a scalarparameter and set the “time” as the value output from the timeline. In this case, the output pin of the timeline DOES tick and update the MID. There is some cost however small to this method.

The second method is to simply create a scalarparameter called “spawntime” and on spawn, create an MID and set the scalarparameter to the value of real time.

Then in the material, by using “Spawntime” minus “Time” you can automatically get a time value increasing from spawn time without having to pay the cost to continually tick the MID or blueprint during the whole thing.

Additionally, you can easily do operations like power or sin/cos on the spawntime-time value to create nonlinear response to time in the material that is very similar to typical curves created via timelines.

Hi Ryan, thanks once again for the help.

Right now this is what I have based on the UDK Example…

Now, that’s the same as in the UDK, so I’m wondering if the way this is setup would work differently in UE4.

I’m trying to figure out the code he uses, here:

https://justpaste.it/kp0h

EDIT: I just can’t seem to understand the way he set it up…

I think he’s somehow using the StaticSwitch to “start” the time? But that parameter seems to be unchangeable. If that’s the case, everything he put in false is useless… Except he does use it in his code. I’m so confused! Did “time” work differently in UDK?

Here’s his node setup:

My guess is either there is actually a regular “Time” node connected somewhere to the right offscreen in that UDK example, or “ImpactTime” is actually being driven by matinee or something so it is changing over time. That switch looks like True is for debug to see the effect loop over and over again.

For what its worth, there is really no “correct” way to do this effect. I can think of a bunch of different approaches so IMO you might as well try building it from scratch if there are issues seeing how the example is built.

I would look at it as two simple problems. Two expanding spheres need to be made, a larger outer sphere and then an inner sphere to cut out the center. The size of each sphere could either by changing by driving radius directly with time, or by “offsetting” the values of the gradient like the UDK example above. Later today if I get a second I’ll try to make a simple example.

Ok here is how I would do this. It’s a much more literal way of controlling the ring.

First, you use a spheremask to create a gradient for the “Final Size” of your effect. Param “Final Size” defines the size of your ring at its largest, or the end of the animation:

Next, do “1-x” on that SphereMask and then place another spheremask node connected like so:

phase=0.1

In this example “Phase” is the parameter that moves the ring along the gradient. It should be in the range of 0 to 1. 0 means the very center of the circle (as a soft dot), and 1 means the outer edge. Phase could either be timeline driven or Time-SpawnTime with a divide for speed and clamp to keep 0-1.

Notice that Phase is multiplied by 1-RingWidth. That is to keep the black area outside of the radius of the initial gradient from turning white when the ring reaches the outer edge (aka phase=1). It’s really rescaling the circle by however wide your ring is to maintain the full animation range of the given gradient.

phase=0.9

Thanks!!

Telling me that he was using the switch simply to see the material in the editor is what made it all click for me… That, and the time node, were really confusing me big time.

It all makes perfect sense now, though. Thanks again so much.

Why is this information (that it is in seconds, that is uses a global timer from the engine etc.) not in the documentation? I don’t understand why UE staff keeps replying to these kinds of questions without placing the information in the documentation.

Thanks Ryan, you gave me the answer is was looking for!!