Jump to content

Get random but connected points on a geometry


Recommended Posts

Hey there!

I'm totally new to here and Houdini. Trying to learn it by doing some practical tests.

How can I get random points on a grid or any geometry? The condition is that they have to be connected. So, I would give it some number(or a range), it would create one "island" of points with that number. With some seed value I can change the pattern. (example below)

Can anyone give me some pointers?

Thanks a lot


Edited by cur10us
Link to comment
Share on other sites

///1 points wrangle

float r = rand(@ptnum * chf("randseed"));
i@group_sources = r > 0.85;

/////2 wrangle
//group sources
int nears[] = nearpoints(0, @P, chf("maxdist"));
foreach (int pt; nears) {
    setpointgroup(0, "nears", pt, 1);


Link to comment
Share on other sites

Hi @cur10us,

I think I would mainly use the surfacedist() function.

First group a few target points:

rand(@elemnum, chi('seed')) < chf('chance')

Add noise to a custom position attribute:

v@pos = v@P + noise(v@P * freq);

Then measure the distance over the noised position attribute:

int pt_close = -1;
float dist = surfacedist(0, 'target', 'pos', i@ptnum, pt_close, 'edge');

And apply random ranges for each island.

float range = fit01(rand(pt_close), 0.2, 0.4);
i@group_island = dist < range;




  • Like 1
Link to comment
Share on other sites

this is great. thanks guys! I'll check these out as I get the chance and come back If I have question. though, a quick one: is it possible to do this with vops? is one method more preferable over the other?

to me this is more readable and faster to analyze.

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.

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...