Jump to content

Scatter Point


hologen

Recommended Posts

I don't think the scatterSOP can do this as it scatters.

What geometry do you want to process?

Maybe you can create a regular pointcloud and project the points onto your geometry.

Maybe you can create this point cloud based on your geometry and refinde/subdive it.

This would still introduce some distortions based on projection.

Or you unwrap you geometry in a undistorted way project a grid to it and transfer the point positions back to the source mesh.

Or you wait for the next answer that offers the oneSOP solution I am not aware of.

Geog

Link to comment
Share on other sites

Having the points exactly equidistant is not possible.

One thing you could try is scatter a bit too many points, and then use the FuseSOP to remove points closer to each other than your predefined minimum distance.

eetu.

Link to comment
Share on other sites

yes its very difficult i think,

i need equidistant between point, cause i will copy box with the same size so they don't overlap each other but still random.

aswin.

yes its very difficult i think,

i need equidistant between point, cause i will copy box with the same size so they don't overlap each other but still random.

aswin.

Link to comment
Share on other sites

The easist way to do such things is POP. Emit particels with self collision (interact) and set their scale to proper distance. After few frames you will be see that every particle finds its own space.

The same thing goes for DOPs and intersection resolving but takes more time for big scene.

Another way is VEX and HOM.

Here you have the discusion on similar topic (the same even?):

http://forums.odforce.net/index.php?showto...non-overlapping

You'll find there some examples in VEX_SOP (+ great *.hip by petz with foreachSOP usage). Another incarnation of the same basic idea would look like this:

sop
deleteByDistance(string pointcloud = "";
			   int	tries	  = 10;
			   float  min_dist   = 1;)
{

	 int handle = pcopen(pointcloud, "P", P, 1, tries);  

	 vector pos;
	 int	pc_num;
	 float  pc_dist;

	 while (pciterate(handle) ) {

		 pcimport(handle, "P", pos);
		 pcimport(handle, "point.number", pc_num);
		 pcimport(handle, "point.distance", pc_dist);

		 if ( (P != pos) && ( pc_dist <= min_dist)) 
			addgroup("delete", pc_num);
	 }			
}

Now you can delete all points in the "delete" group. This solution isn't perfect. There is a slight misconception here as "tries" takes too much importance in that flow.

Another code not directly on subject but solving quite similar problem (and I have it on my sketchpad right now so I can share it) is in HOM. It simply deletes prims group's members if they are too close to each other. Hope this will help you find the right solution for you.

Cheers,

sy.

geo = hou.pwd().geometry()
min_dist = hou.pwd().parm("dist").eval()

for prim in geo.prims():
	if prim.attribValue("group") == 1:
		prim_pos = hou.Vector3(prim.attribValue("Cd"))
		for nei in geo.prims():
			if nei.attribValue("group") == 1 and prim != nei:
				nei_pos = hou.Vector3(nei.attribValue("Cd"))
				if prim_pos.distanceTo(nei_pos) <= min_dist: 
					nei.setAttribValue("group", 0)

This is a PythonSOP. It assumes:

- "Cd" prim attribute with prim position copied onto it (with PrimitiveSOP for example)

- "group" prim attribute with group membership indicator (0 or 1)

Edited by SYmek
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.

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