Jump to content

SOP effect from attribute


Recommended Posts

Hey guys!

I've been lurking for quite some time soaking up all the wonderful Houdini knowledge you all have posted, so I'll start with a huge thanks that you all exist.

Now my question:

How can I have a SOP's effect be based off of a custom point attribute? Say I have a grid, and a sphere->isooffset->vop sop hooked up to store an attribute called "sel" as 1 if the grid point is inside the sphere and 0 if out. I can easily view this attribute in a point sop and I can use it in other vop sops to drive vex effects. BUT, how can I use this attribute in factory nodes to drive those effects?

I have tried a few things with limited or no success. First I can obviously use the @sel>0 group expression in some sops, but not all seem to work (mountain sop works fine but facet sop doesn't). Second I tried writing a custom expression to loop through all the points on the incoming geometry

string loopPoints(){
string result = "";
for (i = 0; i < (npoints(opinputpath(".", 0))); i++)
result = i;
return result;

with the point function:

point(opinputpath(".", 0), loopPoints(), "sel", 0)

in the 'magnitude' paramter of a given sop (ie the height paramter of a mountain sop), but this doesn't do anything, though there is no error. Also the reason I would prefer to do it this way vs a point/primitive group is that I can blur the attribute creating a falloff effect.

Am I missing something (probably haha!)?



Link to comment
Share on other sites


Your function doesn't work in conjunction with the point expression because the expression is expecting an integer where looppoint() is. If you just put a $PT there it'll already loop through the points and retrieve the value of your attribute for each point..

The only catch is that not all the factory nodes work with a point expression, but you can still create groups based on the the value of your attribute and run the factory nodes through the group.

There are many ways to make operations based on point attributes, just sometimes one method will work where another doesn't, you'll have to go on adjusting as it goes.


Link to comment
Share on other sites

Ah indeed it was expecting a float there. The only problem is that groups have a selection set to 1 or 0, so there isn't a way to have a nice controlled falloff if you just assign a group to a sop. So there isn't anyway around this if a node won't take the $PT variable?

Link to comment
Share on other sites

Just to re-iterate - you have a grid, and and a sphere, and you want to know when the grid's pts are within the sphere? How about this (see attached ,it's easier to see that then describe).

The ex uses a group SOP to figure out which points are in the bound volume (The sphere -> isoffset obj), note that the default tab is turned OFF, and that it uses a bounding input, which can be any geo you want. Then I create an attr called insideAmt, set it to 0.0. Add a point SOP that only for the grouped points we created earlier, and set the insideAmt attr to 1. Then you can either create another point SOP to modify the adjusted points or use a VOP SOP. I've done both.


Link to comment
Share on other sites

Hey guys,

Thanks for the replies. @jim getting the point attribute assigned is no problemo, I will try your technique though a volume sample seems to work rather well.

@ikarus a vop sop works wonderfully but the goal here is to get this working with factory nodes. It would be a pain to go through and recreate all the factory nodes as vop sop networks right?

Maybe I have a bit of a case of wishful thinking but there MUST be a way to do this inside a factory node parameter field....

Link to comment
Share on other sites

Ok well I figured it out for SOPs that don't change the topology of the incoming object. Was stupid easy as well, just plug the original object into a VOP SOP and then the deformed one and blend between using the $SEL attribute created from the other VOP SOP. So any ideas for how to make it work with changing topology (IE a polyExtrude) ?

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