for loop question

   266   2   1
User Avatar
Member
48 posts
Joined: Feb. 2016
Offline
Hi,

PS: these questions to understand for loops in Houdini, i.e. some loops are inefficient and could've been implemented using sigle nodes


(1) I have 3 tubes that I want to boolean each individually with a grid (e.g. boolean the grid with the first tube on first loop, then the result feed it to the second loop, ...). To do so, in "Block End", I'm setting "Iteration method" = "Pieces", "Gather Method" = "Feedback". However, I only get one cut instead of 3?

(2) I have one tube, I set "class" on primitives to 0, I pass the tube over begin/end loop, I use metadata "iteration" to set the color on the primitives. Even though it's one iteration (because there is only one class), every quad will have a randome number?

(3)Let's say I set "Iteration Mothod" to "Pieces" in Block End, then I set "Method" to "Feedback" in Block Begin --> what does that mean, it's like saying: you will have X loops based on Pieces (so each loop is indepdent), but then each loop will need the previous loop output????



Also, happy holidays
Edited by catchyid - Dec. 30, 2024 20:23:27

Attachments:
illustration.png (1013.1 KB)
OneTube.png (1.8 MB)
question_loops.hiplc (266.8 KB)

User Avatar
Member
8854 posts
Joined: July 2007
Offline
1. you need another Block Begin set to Feedback, that's where the previous iteration will be fed back to so that you can do boolean on that rather than on fresh grid each iteration

2. Color SOP in Random Mode does random per element, in your case per primitive
seed is just a different dimension of the random sequence
- to get what you need you don't need For Each Loop, just base your random on class attribute
- including multiple options in the file

3. Iteration Method set to Pieces just says to figure out number of iterations based on the attribute on the input geometry of the node specified on Piece Block Path OR input geometry of the second input of Block End if connected
- any Block Begin (that points to the same Block End) set to Piece will output particular piece per iteration
- any Block Begin (that points to the same Block End) set to Fetch Feedback will output geometry of previous iteration
- any Block Begin (that points to the same Block End) set to Fetch Input will output input geometry, this is mostly used to clearly define scope and it's required when nesting inside of Compile Blocks
- for use look at the modified 1. where I added second Block Begin in Fetch Feedback mode that you were missing

Attachments:
question_loops_fix.hipnc (449.9 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
48 posts
Joined: Feb. 2016
Offline
Thx Tomas Appreciate your help
  • Quick Links