Download

Time node.

Hello,

Quick question. Why sinus(time node) is very fast. I expected to see black at each 3.1 seconds but I see the black at each ~.5 second.

I am new in material and I would like to understand different behavior. See the picture.

Thanks

Divide time.

I don’t understand. The time node is divided?

The built in UE4 Sine is normalized to the 0-1 input range:

However, you can achieve the result you want by using a custom function that returns sin(x) using HLSL code:

Wow that’s a really cool explanation with the plot. I implemented it and I see it on my material! Awesome! so the inputs for sine is normalized [0, 1]. But if we do this sine(time), time node is not normalized, the time output is x seconds, so it’s not normalized.

An other topic, I just started to read GLSL from this web site: thebookofshaders.com and this book is using GLSL language. Does UE4 support it in the custom node?

Not sure I understand what you’re saying here, but time goes from 0-1 in 1 second and the normalized UE4 sine completes a cycle when it goes from 0-1. Meaning if you make it absolute, it will flash black every 0.5 seconds, the result you see in your first post. Time’s output is not normalized, but that doesn’t matter in this case because sine will just repeat.

Afaik it has to be HLSL, they’re very similar though. Microsoft has a guide up explaining most (all?) of the differences.

You said that sine input is [0, 1] only. But the time node could be for example 10 seconds… so what’s the result of sine(10) ? 10 is not normalized in the [0, 1] range.

Ok I understand now my problem. sin(0) is 0, sin(0.25) is 1 sin(0.5) is 0 sin(0.75) is 1 sin(1.0) is 0. So 10 seconds is 10 cycles. So sin(10.0) = 0, sin(10.25) = 1, etc.

You’re right, normalization is the wrong word. It repeats at a 0,1 interval.

From the documentation:

Thanks for your help, I appreciate it! I continue now to understand how to build a shader. And the maths behind the hood! The plot helps me to see the result!!.

Make sure you check out the other Debug nodes too, they’re very helpful for making complex materials.