### Help me understand the "Swiss Cheese" loop example

988   5   2
Member
291 posts
Joined: Aug. 2019
Offline
I'm reading the official document on Loop: https://www.sidefx.com/docs/houdini/model/looping.html [www.sidefx.com]

The example it provides look like:

But I really don't understand what the point is for this complex loop setup. I made a similar setup:

It seems to do the same thing (the "Swiss Cheese" effect) with the same nodes as the official example, minus the loops.

The official document doesn't provide an HIP file so I can't study it. Could someone enlighten me why they use loops here?

Attachments:
Screenshot 2022-01-04 222958.png (671.2 KB)
Screenshot 2022-01-04 231016.png (448.2 KB)

Member
44 posts
Joined: May 2017
Offline
the difference is that in your case the vdb subtraction is done in one go while in the doc example the air bubbles are subtracted one by one while feeding the intermediate result into the for loop every time.
Its not so much of a tutorial of how to create a setup to subtract spheres from a box but showcasing some useful workflows with for loops that were pretty difficult to achieve prior to the current way to do loops in vops and sops.
Member
291 posts
Joined: Aug. 2019
Offline
frostfx
the difference is that in your case the vdb subtraction is done in one go while in the doc example the air bubbles are subtracted one by one while feeding the intermediate result into the for loop every time.

I know, but what's the benefit of "subtracting one by one" over "subtracting in one go"?
Member
6241 posts
Joined: Sept. 2011
Offline
raincole
I know, but what's the benefit of "subtracting one by one" over "subtracting in one go"?

Probably none, although converting overlapping shapes to a single sdf is less reliable than converting one at a time.
Member
214 posts
Joined: April 2018
Offline
The main reason you'd want to use a For Loop when instancing is to get variant control over any incoming parameter from your source geometry.

https://www.sidefx.com/docs/houdini/copy/tutorial_stamping.html [www.sidefx.com]

The above is a simple example, but if you latch on to this, it's an absurdly powerful system to give you precise and high level control over your copies.
Member
396 posts
Joined: July 2013
Offline
Your solution will always subtract from the Whole.

The ForLoop solution subtracts from the Remainder, recursively.
Houdini Indie
Redshift 3D