Jump to content
tagosaku

VOP questions, while loop, for loop, each loop, if block, while loop

Recommended Posts

Hi, 

I have used Houdini for a few years, but have not used these loop block nodes so much in VOP. This is because it's really hard to understand what's happening on the way and how to use input and output exactly, although I understand SOP level's loop nodes well.

Thus, I really appreciate if anyone explain each usage of input and output with typical examples for each block/loop node!  For instance, blockA is good for creating primitive line. blockB is convenient with checking nearest points, blockC is same as loop-SOP but faster, etc...

Many thanks!!

 

 

blockBeginEnd.png

2019-11-24 01_02_17-Houdini Apprentice Non-Commercial - Help.png

Share this post


Link to post
Share on other sites

Well, I don't know have you ever used loops in vex or not. The loops in vops is the same with the vex. There is not much specifically which one is better for what kind of condition, but normally foreach loops will need to plug in an array to loop over each array element. And do_while, foreach_until and for_until will loop have the condition for stopping the loop. And while loop will have condition to start the loop. Same as vex.

So for example if you wanna use point cloud with for loop, better use pcopen and length_in(how many iterations) should be the pcnumfind. And if you wanna use point cloud with foreach loop, better use pcfind or pcfind_radius, cuz the result is an array. If you wanna use while loops, better use pcopen and the condition_in should be pciterate.

In for loop, the for_begin length_in is how many total iterations you want it to loop over, and the index_out is the current iteration inside of the loop. So think about in vex, you have something like for(int i = 0; i < 50; i ++), and in vops, length_in is 50, and i is the current index_out, which is the iterator. For example if you plug a contant 0 into the next_in, and call it something like "val", and inside the loop you just addconstant 1, and connect to end_for next_in and named it same as "val", the loop will start, you can see a purple line connect from right to left. It equals like:

int val = 0;
for(int i = 0; i < 50; i++){
    val += 1;                  
}

 

And in foreach loop is very similar, it needs a array to loop over each array elements, the element_out is the current iteration of the array element and index_out is the current iteration. 

I know loops in vop can be a little bit of confusing, but I hope this can help you for a better understanding.

 

 

Edited by jimeng20

Share this post


Link to post
Share on other sites

Ideally I want to see comparison, but will take a look at them deeply weekend. Thank you for the link.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×