First of all, optixRaycasting shouldn’t have noise because all that does is rendering a single image where the color of the hit surface is taken from the current shading normal as can be seen inside the shadeHitsKernel
function.
You mean optixWhitted vs. optixPathTracer?
That is because these two examples are using a different light transport algorithm.
Whitted renderers are usually rendering a final image, but not integrating the rendering equation fully. It’s usually not a global illumination renderer. Lighting, soft shadows, glossy reflections, etc. won’t happen correctly with these.
A path tracer follows many ray paths through the scene by bouncing off hit surfaces normally into one continuation direction to integrate the rendering equation as best as possible.
Since there are an infinite amount of paths which could be followed this way, these are implemented as “Monte Carlo” algorithms which are drawing random numbers. Means an integral (here the rendering equation) is approximated by shooting many different ray paths.
This usually happens in a progressive rendering algorithm where each sub-frame follows (“traces”) a different ray path through the scene. The more sub-frames you accumulate, the nearer you get to the final converged result (the value of the integral you’re solving).
Each individual sub-frame has a high-frequency noise (variance) characteristic for such progressive Monte Carlo algorithms.
Different methods have been developed to reduce the variance in path tracers. Most importantly direct lighting (next event estimation), importance sampling (shoot rays according to the material’s or light’s distribution functions, where they are more important), multiple-importance sampling (considering the importance of the material distribution function vs. light’s distribution function), low-discrepancy samplers (“better” random number generators), and a lot more.
There are also different variants of path tracers and other light transport algorithms.
And here start your studies:
https://en.wikipedia.org/wiki/J._Turner_Whitted
https://en.wikipedia.org/wiki/Ray_tracing_(graphics)
https://en.wikipedia.org/wiki/Rendering_equation
https://en.wikipedia.org/wiki/Path_tracing
https://en.wikipedia.org/wiki/Photon_mapping
https://en.wikipedia.org/wiki/Metropolis_light_transport
Come back if you have specific questions about OptiX.