Jump to content

Copy stamp / for each loop


Zetha

Recommended Posts

Hello,

I made a grid with circles that change size depending on how close are to a point. I used a copy stamp SOP for it, but after reading in the Side FX site, they said that it is better to use the for each loop instead of the copy stamp.I cant figure how to achieve it.

Also, I am trying to make a grid with circles that change density from left to right with a random effect.

Thanks!

Grid circle.hipnc

grid circle.jpg

circle Grid 2.jpg

Link to comment
Share on other sites

I did few edits to your file, you may learn from that, I hope. I used copytopoints and directly pscale to drive the circle scale. The Copy SOP node reads @pscale attribute, see the attached text.
For the second example, I used the attribute wrangle, as I am not that good in Attribute VOP. But you may use the IF Vop and compare random values in the VOP too.

if (@pscale * rand(@pscale) > 0.5)
{
    @pscale = 1.0;
} else {
    @pscale = 0.0;
}

I have also attached the For Each attitude, simple example, may not be universal solution (it doesn't solve normals, for examples).

 

copy.PNG

pscale.PNG

foreach.PNG

Grid circle - v2.hipnc

  • Like 1
Link to comment
Share on other sites

The old Copy Stamp is not compilable, so it is deprecated. That stamp() function cannot be compiled. Copy to points is compilable. Compiled SOPs can be multithreaded, so you use all the CPU cores you have. Tutorial is here.

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