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"

Sine node in material editor gives unexpected results

I'm trying to input degree angles in function. I convert the value to radians ( rad= deg/180 *pi). It seems to work correctly when the result is used as input for a cosine node, but not for a sine. As shown in the picture, cosine gives me "expected results" when passing from 0° to 180° ( white, grey, black, well... at 180° I'm expecting -1 as result, so a black color will be right... but I have white) but I can't say the same things for the sine node... alt text In fact, trying to obtain x,y coordinates of a versor I have a wrong vector. Am I missing something or there is a strange bug in the sine node?

Product Version: Not Selected
Tags:
more ▼

asked Aug 12 '14 at 08:10 AM in Using UE4

avatar image

berna
10 1 2 6

avatar image rebb Sep 26 '14 at 09:05 PM

I just stumbled over this as well.

Wondering what the reason is behind these Sin/Cos Nodes having a different period than the Sin/Cos Functions elsewhere.

Or is this the case in general for the sin/cos functions in HLSL/GLSL etc ?

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

4 answers: sort voted first

Ok... I've found the answer by myself... :) The sine and cosine nodes have a default period = 1. To obtain usual "geometric" values it needs to be changed to 2pi... With this adjustment all the values are correct. Ah, trigonometry... old friend :)

more ▼

answered Aug 12 '14 at 09:18 AM

avatar image

berna
10 1 2 6

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

The doc says the input is in radians, it is not true.

Imagine if you want a friendly 30 or 45 degrees.

If the input is in radians, the input should be: Pi x 30/180 = Pi / 6 = 0.524 radian. For 45 degress: Pi x 45/180 = Pi / 4 = 0.785 radian.

But actually you need to input: 30 / 360 = 1 / 12 circle. For 45 degress: 45 / 360 = 1 / 8 circle.

Conclusion: The input is in a fraction of a circle.

The legacy Rotator is in range: 0 ~ 65535, converting to 0 ~ 1 is easy so the input of sine is 0 ~ 1?

more ▼

answered Jul 01 '15 at 11:46 AM

avatar image

PowerDesign
181 14 21 32

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

The documentation is wrong on this (https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/ExpressionReference/Math/index.html#sine)

It said the input is in radians (as you would expect), but as other have stated before, it seems to be in radians/PI. Meaning an input of 1 is actually an input of PI radians...

Fix documentation, or fix the input type of the sine node please,

Thanks!

more ▼

answered Oct 05 '15 at 12:20 PM

avatar image

BramV
391 36 36 80

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

Bump!! How can Epic not have corrected this yet?!

more ▼

answered Oct 23 '15 at 03:32 AM

avatar image

RVillani
1.1k 28 40 90

(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