After looking at a lot of existing implementations, I am currently implementing a path tracer in OpenCL. However there seems to be divergence to what parts of the pipeline can actually benefit from OpenCL acceleration.

So is it possible to construct a complete path tracer in OpenCL? What parts of the pipeline will benefit the most? Which will benefit the least? Are there any parts that is recommended to keep out of OpenCL?


1 Answer 1


In short: All of it can benefit from OpenCL.

Path tracing is done by taking many individual ray samples from a scene and combining them into a final image. As the number of samples increase, so does the quality of the resulting image.

If you are doing regular path tracing (not photon mapping or bidirectional path tracing or anything like that), each sample needs just READ ONLY access to the scene so can work completely independently of the other samples.

That fact makes path tracing astonishing parallelizable. If you had an output image resolution of 1000x1000, for a total of 1,000,000 pixels, and took 10,000 samples that would mean you needed to take 10,000,000,000 (10 billion) samples.

Each one of those samples is parallelizable, so if you had 10 billion cores, you could make use of all of them.

There are pragmatic concerns when doing this including cache coherency, but the costs of getting that wrong with the naive implementation are much smaller than the benefits of going massively threaded in the first place.

Here is some more information about the details of naive path tracing if you are interested: http://blog.demofox.org/2016/09/21/path-tracing-getting-started-with-diffuse-and-emissive/

  • $\begingroup$ It's funny, I joined this stack site because of you :) (i read your tags after you answered my UDP question on gamedev). Cheers! $\endgroup$ Nov 30, 2016 at 23:34
  • $\begingroup$ Small world! There's a great graphics community on twitter too. Check out who i'm following (@Atrix256) if you want to get into that. BTW, now I'm wondering what sort of remote control robot application needs to do OpenCL path tracing. It sounds like you run an interesting business (: $\endgroup$
    – Alan Wolfe
    Nov 30, 2016 at 23:36
  • 1
    $\begingroup$ That is just the tip of the iceberg... I am writing the path tracer to render images for training a machine learning algo to make a SLAM for robots. Project is not officially launched yet, but site is online to cath some early SEO: octomy.org $\endgroup$ Nov 30, 2016 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.