Jump to content
magneto

Are there simple point cloud iteration examples in VEX?

Recommended Posts

Hi,

I am trying to experiment with point clouds in VEX, since it feels easier to loop, etc in code than in VOPs. Are there any examples that you know of that shows a simple search using a radius and then importing an attribute from each of these found points, and doing something simple with them?

If I get the correct syntax and usage, I can manage from there.

Thanks :)

Share this post


Link to post
Share on other sites

Hi,

I am trying to experiment with point clouds in VEX, since it feels easier to loop, etc in code than in VOPs. Are there any examples that you know of that shows a simple search using a radius and then importing an attribute from each of these found points, and doing something simple with them?

If I get the correct syntax and usage, I can manage from there.

Thanks :)

I think vex coding and point cloud operations are used a pretty good amount in this tutorial http://www.cmivfx.com/tutorials/view/330/Houdini+Flocking+Systems

Lemme know if want I could send you some of the code.

Share this post


Link to post
Share on other sites

Or you could create a vopsop doing roughly what you want and then right click on the vopsop and press "view vex code" (or something like that) which should might give you a good idea of where to start.

Share this post


Link to post
Share on other sites

Thanks John. I haven't used point clouds before so PC VOPs aren't easier for me :)

I have that dvd, so will check that out.

Share this post


Link to post
Share on other sites

Check out the source files for Peter Quint's point cloud tutorials.

It contains a vop with a custom pc loop, which you could just view in vex code.

https://sites.google.com/site/pqhoudinitutorial/home/houdiniprojectfiles

afaik:

A pc iteration loop is a pc open attached to a while loop that contains a PC iterate connected to the while condition. PC import is used to retrieve attributes from individual pc sample points.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks ikarus, I will check out Peter Quint's tutorials. I made some headway yesterday. But the "maxpoints" parameter confuses me. Is it the maximum number of points returned for each point, or the total number of all points that will be returned for the whole VEX operation (for all points)?

Is there a way to specify "return as many as you can find"?

Like if there are points within the search radius for each point that ranges from 0 to 120, I want to get all of them since I already specified a search radius.

Am I thinking wrong? :)

Share this post


Link to post
Share on other sites

maxpoints and radius are limits for poincloud query, they are both active all the time

so if you want all points within specified radius set maxpoints to extremely high number like 1e9

and similarly if you want lets say closest 10 points set maxpoints to 10 and radius to extremely high number

btw, if you want exact number of points pointcloud query has returned for current point you can use pcnumfound() function (Point Cloud Num Found VOP)

also search forums for pointclouds there is plenty of examples of iterating through pointclouds in VEX, VOPs, using While Loop, For Loop, No loop at all, in many different scenarios, I think forums are the best resource for this you can find

  • Like 1

Share this post


Link to post
Share on other sites

Thanks anim. So the points are returned by distance, from closest the furthest? I thought the order of points weren't guaranteed to be sorted by distance.

I saw the pc num found VOP, but since I can't feed it back to pc open, I didn't use it.

Share this post


Link to post
Share on other sites

I didn't say that the points are ordered, I don't consider it guaranteed either, but they are returned based on proximity to point

so it will return closest maxnum of particles from within specified radius

pcnumfound() returns number of particles which met the conditions of pcopen, so pcopen handle is meant to be plugged in no other way around (even though you can plug it to another pcopen if you desire so)

the returned number can be used to loop with the for loop since you know how many points were found (here is one example for that: http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=121576#121576)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks anim. I misread what you wrote previously, but now it's clear :)

Share this post


Link to post
Share on other sites

Thanks bunker. That's an interesting function. I ended up with a similar code looping wise :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×