Vex intersect(...) vs ray node performance

   900   3   2
User Avatar
Member
2 posts
Joined: March 2019
Offline
Hello,

I'm currently learning Houdini and vex. My test scene consist of a sphere which is projected unto a bigger sphere. Using the ray node, it works fine and the performance is fast. I then tried to do the same thing using an attribute wrangle node with vex intersect(…). It also works, but the performance is very slow.

While I understand why the vex code is slow, I don't understand why the ray node is this fast, and why it doesn't seem affected by the number of primitive from the collision geometry.

I would like to know how to do something in vex as fast (or faster ) as the ray node. Or at least understand why there's a difference in performance. I've attached a sample file to illustrate the problem.

Thanks for the help.

P.S. An easier question, why is the ray collision primitives connector dotted ?

Attachments:
VEX_Performance.hip (77.6 KB)

User Avatar
Member
5333 posts
Joined: July 2007
Offline
it's most probably caching of the acceleration structure
it seems that Ray SOP is able to detect that the collision geo is the same among all the iterations and therefore computes acceleration structure just once, while VEX intersect function is probably computing a new one each iteration
just a guess though
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2 posts
Joined: March 2019
Offline
That guess seems right. If I remove the foreach loop, performance are similar and really fast.

Thanks a lot for the help !
User Avatar
Member
573 posts
Joined: Feb. 2016
Offline
Funny I've always used the Ray Sop node because I was lazy to do it in vex and I always regretted about the lost performance.
Turns out that Ray Sop is way faster than intersect() function, even when you let it create and import all the attributes.
I didn't try profiling with intersect_all() too, though. But I guess it would be the same story.

A little annoyance about the Ray Sop is that if you want the hitpos, you need to create a rest position attribute in the collider geo, and then import it with Import Attributes from hits in the Ray Sop.

Regarding the Vex intersect(), why it doesn't come with the tol and ttol arguments like intersect_all()?
Is intersect() less precise than intersect_all()?
Edited by Andr - April 4, 2021 18:17:16
  • Quick Links