so I am in the process of making my own GPU path tracer based on OpenCL as part of my bachelor thesis. I have already made a CPU and a GPU ray tracer based on OpenGL compute shaders but all I have ray-traced are simple spheres and planes.

1) Onto the main question, what do I need to path trace actual models like the teapot/dragon etc. Are there any standard, well known libraries for this purpose? Or do I have to write my own model loader?

Writing my own loader seems all nice but I won't just have to read the data but maintain a proper data structure for all the triangles (K-d tree or octree perhaps) as well and then pass that structured data onto the GPU. If there is a library that can give me the data structure it'd be nice as I'll have to write the code for traversing it on the GPU only as I have already written one to traverse octrees for my GPU raytracer.


1 Answer 1


AssImp library may be a good choice for you, assuming you are using C++ ?. It supports a decent number of model formats.

  • $\begingroup$ Ok, what about the data strucure? Does it have the functionality to generate k-d trees or some other structure? If not is there any other library that could be used in conjunction with assimp? $\endgroup$ Commented May 2, 2018 at 2:46
  • 2
    $\begingroup$ You will get an array of vertices / triangle lists / materials / etc. KD-Tree splitting a mesh is something you need to do yourself, this will be tied to your compute implementation anyway so having a third party library handle your KD-Tree could result in a less than ideal tree. I don't think there is a standard for transforming a mesh to KD-Tree as different implementations have different split heuristics depending on the programmer and application (e.g. Min triangles per leaf / KD-Rope / maximum depth / triangle area based measurement / sparse leaf nodes / etc). $\endgroup$
    – PaulHK
    Commented May 2, 2018 at 2:53
  • $\begingroup$ Dang, that's a lot of work then. I was hoping to find a library for that because I'm basing my path tracer on the gpu. So I'll have to send the structured data in the form of heap on the GPU and use the traversing scheme on the heap. So wanted to stay away from coding on the cpu side. Anyways thanks for the help, keeping the question open for a little longer in case someone wants to add something. $\endgroup$ Commented May 2, 2018 at 6:36
  • 1
    $\begingroup$ Assimp is primarily a loader (and a good one at that). I feel what you're looking for is a mesh library. If you do not care for supporting all sorts of formats, that's what you should probably look up. libMesh, openMesh, CGAL are some C++ based libraries I know of. Most of these libraries will support some sort of mesh import. $\endgroup$
    – ranagraw
    Commented May 2, 2018 at 19:04

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.