How to force emissive material to restart

Hi,

I am coding in C++, but this question may be general to materials.

I’ve created a ring pulse emissive material (taken from YouTube), that does not use any texture. It just scales a small ring outwards to create the effect, all done in the material editor. So far so good.

I copied the Plane static mesh, that comes in the basic shapes folder of UE4, and renamed it for my game. In the mesh, I set the material to my ring pulse. Ok now I can drag the mesh into the viewport and it appears great, with my red ring pulsating nicely, over and over again.

Now, in my game I use an instanced static mesh component, attached to the root component of an actor, to render many ring pulses. This works fine. Or, I can just have an lone actor to spawn the mesh, then I spawn many of these mesh actors. Either way works.

Trouble is, the pulse effect on each mesh (seen on the screen) seems to start from where it left off. On one mesh it may be correct and start from small and pulsate to large and on another mesh it may render as already big and pulsate a bit outwards then start again from small.

I think may be when UE4 loads the material at the start of play, it is continuously pulsating in memory, and whenever it is rendered, it just appears, “as is”, at that particular moment in time.

What I need, is someway of saying to the mesh (or better, the material), please “reset” when rendering and start over from the beginning.

Can this be done in the code (I can access the mesh and the material in C++) or is there some setting on the mesh or material I can change? Or, do I need to add something to the blueprint code in the material editor?

Thanks in advance,
M.

You need to control the ring size with a parameter in the material, rather than a sine (?) which is what I’m assuming you have now.

Use a timeline to set the parameter.

Thanks ClockworkOcean!

You are right about using a parameter to control the ring size. I am using sine, but that was not the issue.

I used a Time node to control the ring size and it turns out that the time is the number seconds from when the editor opened or game started. It seems to be global value incremented by the engine.

Anyway, whenever my mesh was spawned, the time at that particular instance could be anything and there is no way to get it to start from 0. So that is why my rings were all over the place!

I’ve got around it by dynamically increasing the ring size parameter in my Tick() and not use the time node.

Obviously, having it done by the actual material would be more better and probably more efficient.

It would be very useful if there was a “counter” node, where I could say count from 0 … N, but I can’t find one!