Jump to content

Copy random points to surface


Recommended Posts

Got a little home project going with a tricky little problem to tackle:

I basically want to copy a set of points all over a polygonal object's surface, scattered randomly (and uniformly, if possible) -- much like using a Source POP to generate particles by "Surface (random)" or by "Surface (attribute/area)" -- I don't want to use POPs because:

(A) don't want to have to "runup" the particle simulation whenever I want to create these points

(B) I want the points to move with their source geometry, whenever it scales/transforms/bulges/deforms/whatever

(see picture below)

--I'm open to anything -- VOPs, VEX code... just no simulations if possible. Anyone got any tips for me?

Many thanks in advance!



Link to comment
Share on other sites

maybe this helps....

Thanks Mike for offering your help! raying the points onto the surface is a decent idea, but it wouldn't work well for convex surfaces or complex shapes (a body with arms+legs, for example)... thx for the idea though!

Link to comment
Share on other sites

What are you going to do with these points? How many points do you have?

Hey, Ed--

Think home-made cheesy hair solution... I saw a thread in the General forum that had a decent solution, by splattering particles all over a surface, then setting their state to "stopped", and then creeping them onto the surface. That looked pretty great except that the creep surface has to be mesh or nurbs, right?

How about a way to creep points onto a polygonal object, not by parametric U/V but by texture U/V, is there any way to do that?

Link to comment
Share on other sites


Perhaps this is something for you (although it might be too slow)

I'm using some expressions to put the points onto the object. First I create random barycentric coordinates in the x- and y-coordinates of the points. Their z-coordinate will be random, too, and will be interpreted as a primitive number into the object to rebuild. The second point-SOP will then place the points on the triangles using the formula

position = P0 + bary1*edge1 + bary2*edge2

Drawback of this technique is, that it is pretty slow. And it only works on triangle meshes :-(

Hope I could help you


Link to comment
Share on other sites

WOOHOO Yeah, that looks pretty good! Rather slow, but it's the best solution I've got so far! I Duped your crazy point expressions to work with the normals too, so far it's working out really nice, thanks so much! Your free case of beer will arrive within 4 to 8 weeks.

Thanks very much!


P.S. why didn't you think of this, Wolfwood!

Link to comment
Share on other sites

Antoine just recently made me realize that you can generate uv's for points by simply using the collision pop. I'm sure there there's a way to do it with xyzdist() within some attribcreate sops but it's way too late for me. It was supposed to work with polygons too but I think the uv method for polygons isn't consistent between the collision pop and the primuv() function.

So here's what I've got so far. I've added comments to all the operators so please read them. Hit play when you load the hip file for fun.


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