0
$\begingroup$

So I'm in the midst of implementing a path-tracer. I have chosen to use Assimp library to load models and scene information.

According to it, it will provide mesh data and meshes may contain point, line, triangles and polygons primitives. It gives the option to triangulate polygons but I don't know what to do with lines and points. Should I ignore them?

This leads to a bigger question that came in my mind. Can we ray-trace points and lines? I wanted to use this kind of thing once to show my Bounding boxes in wire frame mode but didn't know how I would trace only the boundaries.

I'm guessing this has to do with providing a specific line/point width? Else they are too thin for intersection.

If we can render lines and points, then should I ignore them or not in my path tracer? Will I be missing out on details etc? Don't know what are they used to represent in 3D models as I have only seen triangles/polygons.

$\endgroup$
0
$\begingroup$

I'm guessing this has to do with providing a specific line/point width? Else they are too thin for intersection.

Exactly. True points and lines have no spatial extent: a point is infinitely small, a line is infinitely thin. You can't intersect those with a ray. But a point with a size is just a sphere, and a line with a size is a cylinder, and those are classic ray-casting primitives, so of course you can intersect them.

The only difficulty is if your path-tracer currently only has one geometry primitive (the polygon or polygon mesh): adding new primitives might be hard for you, if you've structured it for just one. But even in that case, instead of intersecting the points and lines directly, you can just turn them both into polygon meshes inside the renderer, before casting any rays. If you know how to polygonise a sphere and a cylinder you already know what to do.

$\endgroup$
  • $\begingroup$ I haven't actually written the model loading part at all so I'm still open to ideas. My main approach was to load any model/scene through assimp and set a post processing option which "triangulates" anything having more than 3 indices. This assures I only need to check for ray-triangle intersection. However according to assimp it won't modify lines and points. Thus I wanted to know if ignoring these points and lines would make any real difference to the appearance of the model? $\endgroup$ – gallickgunner Jul 15 '18 at 9:34
  • $\begingroup$ @wandering-warrior That depends on the particular model and the format you're loading. Try it on some models you're interested in and see what happens. Chances are they won't contain any points or lines anyway. $\endgroup$ – Dan Hulme Jul 15 '18 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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