Help me understand the "Swiss Cheese" loop example

   1903   5   2
User Avatar
Member
431 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)

User Avatar
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.
User Avatar
Member
431 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"?
User Avatar
Member
7737 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.
User Avatar
Member
330 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.
User Avatar
Member
603 posts
Joined: July 2013
Offline
Your solution will always subtract from the Whole.

The ForLoop solution subtracts from the Remainder, recursively.
Houdini Indie
Karma/Redshift 3D
  • Quick Links