Jump to content

Transforming primitive groups with a particle per group?


Cornelius

Recommended Posts

Hi all,

I have a geometric object which has several primitive groups. To build the groups I used the Partition SOP. The group uses the color as group rule.

Now I want to create one particle at the center of a group. Then I want to "link" each group to a particle, e.g. the particles move the individual groups. Is this easily achievable?

I'm thinking to use the ForEach Sop to move the Center to each group and then create a point at the pivot. Using the generated points I might be able to use as emission source for the particle system. Then I just have to figure out a way to use the particle data to drive my groups...

I have to add, that I've only recently looking more deeply into Houdini...

Thanks in advance!

Kind regards,

Cornelius

Link to comment
Share on other sites

See this thread for a long discussion and a tutorial for doing things like this. This is all pre-ForEach SOP, though. You're generally on the right track for generating the points per primitive group I think.

I attached a quick example using ForEach. I haven't looked at the above tutorial in a long time, but I think some of the expressions (using things like argc and primgroupmask) are similar. There may be a better/faster way to do this now beyond just using the ForEach SOP but I can't think of it at the moment.

primgroups_to_particles.hip

Edited by johner
Link to comment
Share on other sites

Hi Johner,

thank you for your answer and your scene file! That's exactly what I tried to achieve. However, I have hoped, that there is an easier solution - nevertheless it works!

One small additional question: Is there a rule when to use the Copy SOP and when the Foreach SOP? (Performance, memory, etc.) At least in some cases, it seems, both can achieve the same effect.

Thanks again!

- Cornelius

Link to comment
Share on other sites

One small additional question: Is there a rule when to use the Copy SOP and when the Foreach SOP? (Performance, memory, etc.) At least in some cases, it seems, both can achieve the same effect.

You're right, there is some overlap. Generally speaking, ForEach is good for performing some operation on groups of primitives, possibly including creating new geometry per primitive group (it can of course do more than that, but in this context I'd say that's generally accurate). In this example, creating one centroid point per primitive group is a nice use of ForEach, though you could do it with a Copy I'm sure.

Copy is generally for creating new geometry per point (or a set number of copies), possibly differentiated with copy stamping. Thinking about it more in light of your question, I think the second step of this example, copying each primitive group to the particle, is really better done with a Copy SOP. And in fact it is a bit faster and restricts the ugly argc, primgroup stuff to one Blast SOP (which is a little faster than Delete SOP). So, see attached for a slightly improved version that uses a ForEach for the first step of a point per prim group, then a Copy for the second step of copying each prim group to a point.

primgroups_to_particles_copy.hip

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