Jump to content

performance of intersect vs custom version


marcosimonvfx

Recommended Posts

Hi

After reading this article on scratchapixel, where they talk about an efficient algorithm for finding intersections of a ray and a box I wanted to see how it compared to the built in intersect function. To my knowledge, the built in intersect function is looping over all the prims given in no particular order - I infer this information from the description of the primfind function, which states that it should be used with intersect, because"primfind uses an underlying tree structure to speed up search" (so I take it intersect does not).

 

My test scene creates boxes on n scattered points in a volume. On one attribute wrangle I use the built in intersect function, on another one I use the one from scratchapixel. I would expect the scratchapixel one to be faster, also because the intersect has to loop over n * 6 prims (6 prims per box) whereas the scratchapixel one only has to iterate over n points.

 

However the intersect is magnitudes (!) faster than the custom one. Does anybody have ideas why?

 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...