Hello,
I’m looking for a list of math functions supported by Optix, like the cross product, square root, power, arccosine, PI,… I found nothing as well in the API documentation as in the programming guide.
Where can I find a such documentation ?
Thanks,
Arnaud
That’s not really part of the OptiX API.
For example, the OptiX 7 API itself only consists of a few headers defining the host API in form of an entry point function table and some device side functions to query handles, intersection results, transforms, etc.
The rest is native CUDA host and device code. You can use all CUDA built-in device math functions as usual.
Find a list here: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#mathematical-functions-appendix
and check include\crt<b>math_functions.h in your CUDA toolkit installation.
For everything else like overloads of these for vector types, dot(), cross() etc. you can implement them yourself as needed.
Because the OptiX SDK examples use some of these, they come with a header defining many of the vector overloads and additional linear algebra functions.
For OptiX 6.5.0 and earlier you can find them in OptiX SDK 6.5.0/include/optixu/optixu_math_namespace.h
See here as well: https://raytracing-docs.nvidia.com/optix_6_0/api_6_0/html/optixu__math__namespace_8h.html
For OptiX 7.0.0 they are part of the examples. See OptiX SDK 7.0.0/SDK/sutil/vec_math.h
A version with some more overloads can be found in these OptiX 7 examples:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/rtigo3/shaders/vector_math.h
Other than that, you can always use “Find In Files” in your favorite editor to search all OptiX SDK source code and additional examples to see if functions you need are already defined elsewhere.