x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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:

https://www.youtube.com/watch?v=oxjoQqdQhEE&feature=youtu.be

Product Version: Not Selected
Tags:
more ▼

asked Apr 23 '15 at 02:42 AM in Rendering

avatar image

vanlacke
1.5k 65 132 103

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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:

alt text

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

phase=0.1 alt text

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 alt text

more ▼

answered Apr 23 '15 at 04:12 PM

avatar image

RyanB STAFF
2.1k 56 24 118

avatar image RyanB STAFF Apr 23 '15 at 03:20 AM

'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.

avatar image vanlacke Apr 23 '15 at 03:45 AM

Hi Ryan, thanks once again for the help.

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

alt text

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:

alt text

time.png (237.3 kB)
time2.png (138.4 kB)
avatar image RyanB STAFF Apr 23 '15 at 02:49 PM

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.

avatar image BramV Oct 05 '15 at 12:33 PM

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.

avatar image Soul_Sur_Vivor Mar 29 '17 at 11:19 AM

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

avatar image vanlacke Apr 23 '15 at 07:54 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question