Duplication finder in radius

   1903   2   1
User Avatar
Member
6 posts
Joined: July 2019
Offline
Hi All!

I have a VEX problem,I have a point cloud and I use it for instancing various objects to it. I would like to search all points in a radius and replacing the identical instances to an another what is not there. Like this I could get a nicer variation because the same instance would not be placed next to each other.
My theory was this :
- using pcfind search all points in a radius and put the variations into an array
- remove the source point value from the array
- pick a random one from the array and replace the identical neighbours
- run through this on all points

For some reason something does not work and If someone could help me that would be amazing !

Thanks a lot !
Karoly

Attachments:
Create_Point_Array.hiplc (72.6 KB)

User Avatar
Member
4700 posts
Joined: Feb. 2012
Offline
Hi,

What you are trying to solve is essentially a graph coloring problem:
https://www.sidefx.com/docs/houdini/nodes/sop/graphcolor.html [www.sidefx.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
6 posts
Joined: July 2019
Offline
Hi animatrix_

thanks for the fast answer ! Its kind of the same but not what I want , the graphcolor is too ordered . At least what I could do with it . I would like to set a radius for the inspection not just watching the closest points and I have at least 20 variations for the instancing. If i canould solve it with this node could you help me please ?

my vex code :

int pts = pcfind_radius(1, “P”, “pscale”, 0.0, 1 , 4, 5 );
string instance_array = s@unreal_instance;
removevalue(instance_array, s@instance);
foreach(int pt; pts)
{
string instance_string = point(0, “instance”, pt);
removevalue(instance_array, instance_string);
if(s@instance_string == instance_string)
{
s@instance_string = instance_array;
}
}

Cheers
Karoly
Edited by anon_user_54997945 - Dec. 9, 2020 09:54:12
  • Quick Links