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?

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.

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

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

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.