r/Houdini • • 17h ago

Help Add a diffent bend for each leaf

Post image

Hello,

I trying to add a slightly bend for each leaf.

I'm outputing the copynum att from copy1 feeding it for each named primitive, then feeding the iteration in the bend angle, but it just doesnt work. im cooked please help me
leaf_test.hip

3 Upvotes

12 comments sorted by

1

u/DavidTorno Houdini Educator & Tutor - FendraFx.com 17h ago

I misread the visual initially. So your issue is that the capture direction for the Bend per element needs to be defined also. You set the bend parameter fine with the expression. It's the Capture Origin, and Capture Direction that needs to be updated per copy.

1

u/galacta07 16h ago

Hm, maybe I dont get it.

since the size and position of the leaf its same why it needs to chance the Capture Origin, and Direction

1

u/DavidTorno Houdini Educator & Tutor - FendraFx.com 16h ago

Because the Bend will need to be inside the For Loop. Right now you are causing an infinite recursion since the Bend is outside the loop, but referencing the loop. I'm working on an example for you.

1

u/galacta07 12h ago

Thanks u/DavidTorno, you saved my day. I managed to replicate your approach and it worked like a charm

I'm wondering if a took the best approach that, because damn it looks so tricky to achieve such effect. That must have easier way.
Other then that thank you so much

1

u/DavidTorno Houdini Educator & Tutor - FendraFx.com 12h ago

The order of operations has to be factored in. Can you bend a geo then copy it multiple times? Certainly, and that is fairly easy with the Copy And Transform SOP like what you had.

What complicates things are variations per copy. That node only handles transform operations per copy. Which means it returns a result without carrying over any prior information of it's previous state. There is a copynum attribute as what you used to help isolate each copy after that fact, but that's it. It doesn't carry an attribute of translation, scale, or rotation operations that it performed. Copy And Transform was not designed to do much beyond that.

When however you control the copying process like in my example, you can better micro manage how copies are handled. Including stacking other processes like the Bend.

Houdini definitely is a different way of thinking. It's not always a linear process, unless doing basic processes. Variation almost always involves doing something more involved node wise.

1

u/Octopp 11h ago

I think the easiest path would be a copystamp, bend before inputting it into the loop, set the amount per point and not worry about the angles.

1

u/DavidTorno Houdini Educator & Tutor - FendraFx.com 11h ago

Copy With Stamp SOP has been depreciated for awhile now. I think around H19 or so it was removed. Mainly due to it's upstream backtracking overhead.

Copy To Points is the current recommended method.

1

u/Octopp 11h ago

I know it's not used like before, but within a for loop instead..same concept though.

3

u/DavidTorno Houdini Educator & Tutor - FendraFx.com 16h ago

So I reworked your file.

Basically the Bend goes in the For Loop to prevent the infinite recursion. This is why the varied bend was not working. The expression was updated to use the fit01() method which saves setting the old min / max values. It assumes the input is 0-1 which rand() does produce. So you had that right.

The direction and origin are now needing to be updated because the copies are now placed, and the simplicity of just bending once and then copying does not work. At least if you want a varied bend per copy that is.

To get that info you can use the PolyFrame SOP on a curve to get fast N vectors. Just rename them so the Copy To Points doesn't strip it out. Which it does with the N attribute by default.

2

u/CupMcCakers 16h ago

You've got the right pieces in your graph, just need to jig it around a bit. Look at the "scale by" option in the bend node and run it after the copy. An attribute randomize might come in handy ;)

There's lots of ways to skin a cat. You'll get there. Don't give up ^

1

u/galacta07 12h ago

Idk if I took the best approach on that, man it looks so tricky to achive such randomness

1

u/DavidTorno Houdini Educator & Tutor - FendraFx.com 16h ago

Actually this would probably be an easier setup. I just ran with OPs initial setup.