Point and particle density

   14776   5   3
User Avatar
Member
795 posts
Joined: April 2020
Offline
Hello all,

I am looking for a way to calculate the density of a group of points or particles. This values is determined by finding the neighbours within a certain radius and caluculating the density by adding the points weighted by the distance.

Two operators which seem very close to beeing able to do this are the proximity sop and the interact sop. The hard part is determining the closest particles in a spedy way (using a kd tree or something similar proabably.) Both these operators seem to have this implemented.

The proximity misses the step where it loops over the list of neighbours and calculates the density and the interact pop could be abused to do its calculations, but then, instead of applying the force, storing the magnitude of it in an attribute.

Are there any operators I am missing? (I would love to be able to do this both in sops and in pops.)

The next step would be to calculate the density gradient. I imagine using some of the iso surface tools in Houdini would be helpfull here. When the density gradient is known, creating a vector perpendicular to this would give a reasonable estimate for the normals of a goup of points, which would be the ultimate goal.

Any tips or tricks, or just stupid things I missed? I migh dig into the HDK for this, sounds like a fun project ;-)

Cheers,
Koen
Dreamworks animation
User Avatar
Member
1390 posts
Joined: July 2005
Offline
If I understand correctly your needs, you missed the main player in case, which is a point cloud method you can use both in SOP and POP area (via VEX or VOP Operator). Point cloud is accelerated internally (like a KD-Tree or similar) and lets you query neighbors practically for free. You can get thun any of their attribute like position or so. Point cloud query computes also for you distance to the point in question by point.distance attribute.
What is perhaps most interesting for you is that VEX performs much faster then any scripts. It can bit quite a few operators also since it's multithreaded. In any case requiring speed, VEX is a first place to look at.

There are plenty examples around, here is my code written as a fast, dirty snippet (the second one), sorry for that. Surly you can find much more comprehensive examples around:
http://forums.odforce.net/index.php?showtopic=6240&st=0&p=41746&#entry41746 [forums.odforce.net]

hope this helps,
Simon.
User Avatar
Member
795 posts
Joined: April 2020
Offline
That sounds exactly like what I need. Querying the neighbours cheaply, cool!

Thanks
Koen
User Avatar
Member
29 posts
Joined: Sept. 2007
Offline
Hi, I'm trying to generate edges between pairs of closest neighbouring points.
any ideas welcome, thanks allot!

Gon
User Avatar
Member
1390 posts
Joined: July 2005
Offline
gonzifroni
Hi, I'm trying to generate edges between pairs of closest neighbouring points.
any ideas welcome, thanks allot!

Gon

Does the scene by petz attached above my post in that thread do what you need?
User Avatar
Member
29 posts
Joined: Sept. 2007
Offline
Hey! sorry for the silence. So in fact yes the script helps, but my point cloud is too big, maybe you could explain a little where to place exactly the VEX script you made SYmek? Thank you so much guys.
Gon
  • Quick Links