Jump to content

Source Pop - Setting Output Group By An Expression


Vormav

Recommended Posts

Hey. I'm trying to figure out how to set the output group for my particles in my source pop based on one of my attributes (For example, in the copy sop, you can do something like copygroup$CY).

None of the ways that I've tried to do this have worked so far.

I also tried just sending a string attribute through all the particles instead (lots of overhead, though...it's a bit of a hack), so that I could separate that into groups after the popnet in the modeling level. But I don't know how to do this procedurally - that is, creating multiple groups based on certain attributes. To attempt to do that, I tried creating a VOP operator that would create the separate groups, but hit a snag when I realized that there's no way (from what I can tell) to import a string attribute (the attribute I was passing around on my particles).

What I'm going for is multiple group names based on color values. Something like this:

group_R`rint($CR * 10)`_G`rint($CG * 10)`_B`rint($CB * 10)`

So, a point with a color of (0, 0.2 0.5) would be assigned to the group "group_R0_G2_B5"

(I specifically need separate groups because I'm passing the output off to an Add SOP, so that I can have separate curves be created for every separate group output from my particle system).

Any tips?

I'm finding myself confused on string handling in Houdini in general. Some places let me enter local variables as parts of the string, some don't. And is there way to use an expression within a string parameter?

Link to comment
Share on other sites

What I'm going for is multiple group names based on color values. Something like this:

group_R`rint($CR * 10)`_G`rint($CG * 10)`_B`rint($CB * 10)`

So, a point with a color of (0, 0.2 0.5) would be assigned to the group "group_R0_G2_B5"

(I specifically need separate groups because I'm passing the output off to an Add SOP, so that I can have separate curves be created for every separate group output from my particle system).

Any tips?

I'm finding myself confused on string handling in Houdini in general. Some places let me enter local variables as parts of the string, some don't. And is there way to use an expression within a string parameter?

25529[/snapback]

Hi Vormav,

Not sure if I'm missing your point, but I think you're on the right track with the group expression -- I tried a simple example by plugging your expression into a partition SOP after the POP network and it seems to work fine, no string expressions needed.

As far as the local variable stuff goes, it's very hit and miss -- some SOPS accept local variables and some dont... another problem is that an attribute may exist without having a local variable for you to use in expressions... that problem can usually be solved by putting down an Attribute Create SOP and passing the attribute value through, which will create a local variable for you to use in expressions.

For example, if I had an attribute called "fart" coming out of my particle system and I wanted to access it in SOPS, I would put down an Attribute Create SOP and set the attribute name to "fart", and in the Value field I would enter $FART, and the attribute would then be given a local reference and I could use "$FART" in various SOP expressions.

All that aside, I've attached my little example of the partition SOP to create groups by color, hope it helps!

-JS-

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