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

CC BY-SA 4.0
2018-05-02T02:46:52.530Z
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?
gallickgunner
CC BY-SA 4.0
2018-05-02T02:53:20.540Z
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).
PaulHK
CC BY-SA 4.0
2018-05-02T06:36:46.107Z
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.
gallickgunner
CC BY-SA 4.0
2018-05-02T19:04:31.160Z
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.
ranagraw
CC BY-SA 4.0
2018-05-02T02:35:24.490Z
2018-05-02T02:35:24.490Z
PaulHK
<p>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.</p>

<p>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? </p>

<p>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.</p>

CC BY-SA 4.0
2018-05-03T13:55:11.987Z
Here is a good source of the models you are looking for: http://casual-effects.com/data/ for loading them I recommend this header only obj loading library: https://github.com/syoyo/tinyobjloader
Alan Wolfe
<pathtracing><geometry><model>
Path Tracer - Model loading Libraries?
gallickgunner
# Path Tracer - Model loading Libraries?

(Asked by: username_0 on 2018-05-01)

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.

**Tags:** pathtracing, geometry, model

> **Comments:**
> **username_1**: Here is a good source of the models you are looking for: http://casual-effects.com/data/ for loading them I recommend this header only obj loading library: https://github.com/syoyo/tinyobjloader  

---

## 1 answers

### Answer by username_2 on 2018-05-02. Score: 2 | Accepted answer

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

> **Comments:**
> **username_0**: 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?  
> **username_2**: 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).  
> **username_0**: 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.  
> **username_3**: 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.  

---

