[BUG] Documentation in error for sin and cosine in Material Editor

The documentation for sine and cosine in the Material Editor state that they take the input angle as radians, but in reality they take a 0.0 to 1.0 scale (e.g. for 45 degrees, the value of 45/360 should be used).

This has been discovered by others in problems

or

but I’m inputting this bug report to make clear that it is the documentation that is incorrect (i.e. the hover text)

Hey Dustums,

I went ahead and entered a documentation ticket for this issue. The sine value is normalized to be a value between 0 and 1 because the UV space is normalized to be between 0 and 1, which needs to be stated in the documentation in some form.

Let me know if you have further questions.

Thank you,

Andrew Hurley

What does it mean when you say the sine value is normalized between 0 and 1? Are you talking about the inputs or the outputs?

Do the sine and cosine material node both output from 0 to 1?

I think I understand that the input is dependent on the period that is set in the node. This means that if the period is at the default 1 then you would input a degrees angle as Angle/360.

Does this mean that cosine(90/360) outputs .5?

Can you input negative numbers into these nodes (would it understand that -.25 is .75 with a period of one)?

The documentation directly conflicts itself from one sentence to the next.

So I actually confused myself and provided incorrect information. Here is a quick rundown of Sine and Cosine as described in the engine, which can be found in the Math_Hall content examples level.

Sine is a function of an angle that represents a ratio between the sides of a right triangle. In UE4 the default period of sine is 1.0. This means it repeats itself every 1 unit. The sine wave is represented as a range from -1 to 1.

Cosine represents the ratio between the length of the sides of a right triangle, specifically the ratio between the side adjacent an angle and the hypotenuse.

It is the ABS (absolute) which maps the Sine wave to positive values, which in turn creates a bouncing effect if applied to a material using world position offset.

Hopefully these graphs and the example maps can get you moving in the right direction. If we are talking Sine wave, and using the question that if you input -0.25, it would actually equate to -1.0 along the Y axis.

Are you referring to our online Documentation, the tooltips, or something within the editor that is contradicting itself? I do see that Sine and Cosine have the same explanation within our Docs, so I am assuming that is what you are talking about. I believe Sine should mention the -1 to 1 range however, and not the 0 to 1 range.

Let me know if you have further questions.

Cheers,

Andrew Hurley

Seconding that this is confusing. I just spent over an hour trying to debug a material function before realizing that the cosine function was nonstandard.