Jump to content

What's the best way to copy generated shapes onto points?


magneto

Recommended Posts

Hi,

I am using a Foreach SOP to generate N different shapes and the result of the Foreach becomes the sum of all these shapes. That's fine but I want to copy these shapes onto a set of points, instead of having each shape to occupy the same space.

Should I just create a group for each shape inside the Foreach and then use this group as an input to a Blast SOP, which is controlled via stamping and feed this to a Copy SOP?

Also I am trying to use the centroid of each shape to be positioned at these points in my point set.

The result is exactly like what Sweep SOP does, except I have N shapes for N points, instead of 1 shape for N points.

Thanks :)

Edited by magneto
Link to comment
Share on other sites

the best way would be moving them to centroid within the same Foreach SOP as well as creating some id point attribute for each shape in there

then just one simple vopsop which will take position from second input points by id and offset each piece by it (or even using full transform from points if you want to rotate and scale your pieces)

  • Like 1
Link to comment
Share on other sites

Thanks anim, that should work. Although I forgot to mention I would like to use Copy SOP's ability to orient, align, etc. So that means in your technique, I would have to replicate those functionalities manually, right?

Also how would you store the id attribute? Because each shape can have N number of points, so if I use primitive, they might have no primitive (all or none for all), and detail attribute would only store 1 for the whole geometry.

Link to comment
Share on other sites

use point attribute, so all points of first shape will have id=0 etc

in that case all will be moved to point number 0 from source points

you would need to replicate it manually, but it's sort of trivial task, just getting orient, scale, pscale, position and transform points based on them

( P*scale*pscale*(orient converted from quaternion to matrix) + position )

if you have N or v and up instead of orient you can construct matrix from them using lookat VOP, or if you have rot as well, that's just an rotation offset on top

if you don't like that approach you can take slower one which would be doing everything in your original foreach SOP :

just have source points as a second input, isolate just one based on current iteration and copy shape on it (still within foreach)

this will be slower since it will need to recalculate foreach every time your source points change

similarly the method you mentioned by blasting everything except one shape and copystamping that to points will be slower

but for first method, your shapes would be prepared just once and then quickly moved to points every time points change, it's as fast as it gets

Edited by anim
  • Like 3
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...