Creating a delay function in the material.

Hi, everybody. I can’t figure out if this is possible in the material. Need a delay function. The material uses the node “Lerp” alpha must be equal to 1 every N seconds for N seconds. I can do this using Blueprints. But I am interested in the possibility of doing this in the material. Perhaps someone will tell you the code for a custom node or another implementation. In the screenshot, I showed more clearly what I need.Thanks.

Thanks. But unfortunately it doesn’t fit. Standard Time Period, outputs a value from 0 to 1 every N seconds, this happens almost instantly. The goal is that every N seconds the value is equal to 1 for N seconds. It seems to me that it is possible to do this using a custom node and the necessary code, unfortunately I do not have enough experience to create it.

Thank you for your response but this does not allow you to set a delay.
This scheme switches colors every n value. But it does not allow you to set a delay for the blue color.

It is necessary that after switching the color after N time, the blue color was N time.

As an example. After 5 seconds, the color changes to blue, it remains blue for 2 seconds (the second N value) then the color changes to red and again after 5 seconds, it changes to blue for 2 seconds.

you can change speed to whatever u want like this

Then use a if node to output 1 if A=1 and zero if A<0. in this way you can get just 1 every N seconds.

I made a full example

if u want to have ratio between time of 1 and 0 (like 5 secs “1” is passed and 2 sec “0” is passed you can move sin wave up using add node after sine node .

Thanks for the detailed example, this almost solves the problem, but not completely. The problem in this example is that the second value is a coefficient from the first total time and will not allow you to set exact values. The best option is the one where you can set the time independently of each other in seconds.

maybe this is your answer

Thank you very much, your advice and example helped! I changed the scheme a little so that I could accurately set the time of the period and the delay in seconds.

1 Like

This is another for you N sec blue M sec Red

2 Likes

thanks for posting the extra work you’ve done here - turned a 2 hour task into a 5 minute one, this works great

This is genius