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"

acos(x) in material editor

Hello!
I need to use an inverse trigonometrical function in material editor in order to obtain angle from cosine which I need for some equations(to be specific - atmospheric scattering equations). However, there doesn't seem to be any of inverse trigonometrical functions in UE4 material editor. I'm wondering how can I obtain acos(x) of a number in UE4 material editor?

Product Version: UE 4.12
Tags:
more ▼

asked Aug 25 '16 at 10:27 AM in Rendering

avatar image

adriansnetlis
81 13 17 24

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

2 answers: sort voted first

http://http.developer.nvidia.com/Cg/acos.html
I wrote this code into a material function and it seems to work well. Even though it took some time, I at least have working acos function. Still, it'd be cool if UE4 implemented acos node that uses the HLSL acos(x) function.

more ▼

answered Aug 25 '16 at 11:51 AM

avatar image

adriansnetlis
81 13 17 24

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

You could safely use custom node with HLSL return acos(x); . I think It would be faster than recreating its functionality with material nodes.

more ▼

answered Aug 27 '16 at 09:12 PM

avatar image

Deathrey
7.9k 130 31 293

avatar image adriansnetlis Aug 29 '16 at 10:22 AM

It'd be nice if you shown me a tutorial on how to use those.

avatar image Deathrey Aug 29 '16 at 11:13 AM

Here is a reference article.

You would need to :

  • Drag and drop Custom material node into your material

  • Set Output Type to CMOT Float

  • Expand Inputs rollout

  • For input 0, enter input name x

  • In the Code input field copy and paste the following code: return acos(x);

Now just connect this node as you would normally do.

(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