Planetside Software Forums

Function Nodes In Practice => Function Node General Discussion => Topic started by: WAS on February 25, 2020, 01:42:15 PM

Title: Trig Functions
Post by: WAS on February 25, 2020, 01:42:15 PM
Are the functions like tan/sin/cos true functions in this sense or are they approximated? If not, I was wondering if an approximate mode would help certain things speed up that done need exacting maths.
Title: Re: Trig Functions
Post by: Matt on February 25, 2020, 09:47:06 PM
They call the math functions in the C runtime library. I have not experimented with faster approximations. I suspect that there is enough overhead in the use of blue nodes in general that it wouldn't really save you much time, but I'm not sure.  You could try using an image map shader and see if that's faster (but that also adds overhead so I doubt it will be).
Title: Re: Trig Functions
Post by: WAS on February 25, 2020, 09:52:43 PM
Alright. I was wondering cause I'm doing some experimenting in C++ and I came across a article in google scholar doc for C/C++ from a stack overflow topic reply advising someone to optimize their trig Functions in their ray tracer with approximations where appropriate. I'm not at home now and can't find the article searching Google scholar but I'll link it when I get home.
Title: Re: Trig Functions
Post by: WAS on February 26, 2020, 01:43:00 PM
Didn't realize my Firefox is set to clear temp and history when I close it. But I found other references and it's basically saying for more primitive functions to use lookup tables where possible and approximation. Also found this while trying to find the same article

http://www.ue.eti.pg.gda.pl/~wrona/lab_dsp/cw04/fun_aprox.pdf