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"

Why is there no tangent node?

Hi I'm working on a material, and I am trying to avoid custom node (because it might be slower). However at some point I want to calculate an angle, but I noticed there is no atan2 node or any other tangent node in the material editor. There are sin and cos nodes though. Why is this not there, or is it under a different name?

Product Version: UE 4.9
more ▼

asked Oct 06 '15 at 01:30 PM in Rendering

avatar image

401 36 36 81

avatar image Logan Bailey ♦♦ STAFF Oct 06 '15 at 07:04 PM

Hello BramV,

In order to further understand this issue I need a little more information.

  1. What are you trying to accomplish with this material?

  2. Why are you needing to calculate an angle and for what purpose?

  3. Can you link a screenshot of your material?

After I have this information I believe I can answer this question better.


avatar image BramV Oct 07 '15 at 01:42 PM

I'm making a material that has a circular wave (ripple) on it, by manipulating the normals and some texturing deformation. The angle that I use in the calculation is the angle between the current pixel (in uv coordinates) and the center of the wave (in uv coordinates). I've made it in a custom node which worked fine, but I thought it might be faster to only use internal nodes. I did already find a way around calculating the angle, it's not 100% neccesary for what I wanted, however atan2 is a intrinsic HLSL function, and I see no reason why UE wouln't have a node for each intrinisic HLSL function. I find your question therefor kind of odd (but I seen this question often: why do you need it, what are you making? who cares what it;s for if it's basic functionality that UE is lacking?). It's like you are trying always to find alternatives for what users want, instead of just implementing basic functionality and letting the users do what the want to do... Instead of wondering what I'm trying to accomplish it would seem more logical to wonder; yeah why would we implement cos and sin, but leave out tan??? makes no sense to me...alt text

wave material.png (126.3 kB)
avatar image Logan Bailey ♦♦ STAFF Oct 08 '15 at 05:12 PM

Those decisions are based off of hour calculations to how our systems calculate information. Sometimes we have to use alternative methods because it interferes with UE4's basic functions. For this instance, however, I believe since you have already found a work around this is a feature request.

I can enter one for you. I cannot guarantee that it will be implemented nor guarantee that it will be a feature inside the current engine.

Would you like me to do this?


avatar image BramV Oct 08 '15 at 09:13 PM

Yes I think it would improve the overall usefullnes of the engine if all basic HLSL functions are implemented as nodes. Thanks.

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

2 answers: sort voted first

Alright, there is a ticket in for a Tangent material node like there is for sine and cosine.

The ticket number is UE-21943.

more ▼

answered Oct 08 '15 at 09:18 PM

avatar image Martin Mittring STAFF Oct 09 '15 at 08:51 PM

We might expose "tan" at some point but you can make a Custom node and expose it material function (with the checkbox to make it appear in the list). That is likely what we would do anyway. Sin and Cos have been made before material functions - this is why they are different.

avatar image The XGood Mar 26 '17 at 07:31 PM

Mr. Marting Mittring, I have one note on why it should be a priority: You can not use custom nodes for Tessellation Shaders, or not easily at least. Therefore with the simple HLSL custom code solution, would prove entirely invalid in that case.

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


In math, Tang is the division of Sin over Cosine (Sin/Cosine). Actually there is a node called divide. I believe by dividing Sin by Cosine (linking Sin to pin 'A' and Cosine to pin 'B', you should have your Tang function in result. Here take a look at my graph for instance.

alt text

An important thing that you should note, is that both Sin and Cosine nodes have to link to a same node, otherwise you won't have the correct result. Actually this is all a theory I'm not pretty sure that in materials this is going to work. But in math it does. ;D


capture.png (147.1 kB)
more ▼

answered Mar 26 '17 at 09:30 PM

avatar image

1k 29 14 48

(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