FOR EACH LOOP metadata

   13141   11   1
User Avatar
Member
8 posts
Joined: Nov. 2016
Offline
Hi there,

is there a way to have just last iteration of the for each loop? I mean the last “generation” ?

Im scattering points, looping a copytopoint node. So it is growing mesh. But i would like to have just the new ones every frame. metadata from each loop maybe, somehow?

I also have a popnetwork after scatter, to get age and tried to use “Just Born group”. But I still get the whole (growing) mesh every frame (for obvious reasons)

Iteration Method is by count. Im rising iterations with $F.

Thanks
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Hi, you could probably include a Blast node in your Loop, that would delete your previous pass.
For example, after the Begin Node, you create a group called “delete”, where all of the incoming geometry from the previous pass would get assigned to, do your thing inside the loop, while making sure, the new iteration doesn't inherit the group assignment and in the end, deleting everything in the “delete” group using a Blast node.


That said, there are probably better methods to go about this than computing a foreach loop for every frame. Maybe just let it run once with the count being the final number of frames and a filecache node, that would save out every iteration as a separate file. This way, you would just need to run over the Loop once and then load the cached data into the final animation.

Another way to go about this, without a blast node, would be to setup the for loop in a way it doesn't copy the previous data:
Make sure the Method of the Begin node is set to Fetch Feedback.
In the End node, set Gather Method to Feedback Each Iteration.
This method might or might not work depending on what goes on inside the Loop.
User Avatar
Member
18 posts
Joined: May 2014
Offline
Thanks for the great answer Ivan!
The one with running just one loop for the final number of iteration … great.

The first not work for me, and I'm not sure why, but if I delete it, the growing behave very differently. Not sure why exactly.

The last (Feedback Each Iteration) I have but it loads the whole geo this way every loop. So I will run it once and then use iteration metadata to take one iteration for one frame. Right? Thanks again!
Take care.
B.
User Avatar
Member
18 posts
Joined: May 2014
Offline
Hi Ivan, can I have one more please?
I scatter some new cubes every iteration. As i wrote. Now, I have a group of points (based on normals, so it is just on top of the objcet) and I want to expand the group, I mean every new iteration its more on sides not just top, so I put the “value” from metadata into a group (under “keep by normals” to spread angle) so I beleieve every iteration have a slightly bigger value of this angle. But its not working this way. It stays as a first iteration. Even the detail attr “value” is say 250 it still counts like 1.
But, if I put this into a pscale its working… Any idea?
Thanks.
BK
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Hi, sorry, I'm having a hard time imagining this just by description, could you post a test scene I could take a look at?

Cheers,
Ivan
User Avatar
Member
18 posts
Joined: May 2014
Offline
Sure, Thanks.

Attachments:
FOR_LOOP_TEST.hip (147.9 KB)

User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Ok, I see the problem.

Solution: change the expression for the Spread Angle in your group node from
@lastiteration+60
to
detail(“../foreach_begin3_metadata1”, “value”, 0)+60

The problem is, the Spread Angle parameter doesn't look for the attribute automatically in the geometry, that it's evaluating, so you need to tell Houdini specifically where to look for it.
Also, you want the Spread angle to have a global effect, therefore it makes more sense to link it to a single value, like the metadata node, than to look the same value up in a different primitive every time.

Hope this helps.
Cheers,
Ivan
Edited by ivanmalek - Aug. 11, 2019 09:10:02
User Avatar
Member
18 posts
Joined: May 2014
Offline
Thanks, Ivan, but I get a syntax error. I mean “Bad data type”..
I tried the op as well
detail(“op:../foreach_begin3_metadata1”, “value”, 0)+60
again it works for the @pscale btw
Edited by Bretislav Kaspar - Aug. 11, 2019 12:34:39
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
weird…. I copy and pasted the expression here from a working Houdini file, when I copy and paste it from the forum back to Houdini, I get the same error, but when I write the same thing again, it works. Maybe it could be something about how the forum interprets the “ sign. If you try to just delete all the ” signs in my original expression and write them again by hand, it should work properly.

Cheers,
Ivan
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Yeah, if I post it as VEX code to the forum, the " even looks different as in normal text, that must be the problem

"test"
Edited by ivanmalek - Aug. 12, 2019 03:54:31
User Avatar
Member
8 posts
Joined: Nov. 2016
Offline
I'm heading to a mountains right now, but as soon I Will be back I will give it a try. I'm sure it will be alright. But what I'm not sure is how the feedback loop working now.

I thought this: it will go through loop and every iteration it will copy the objects. These objects will inherit the current “value” from metadata, so I will create say for example the pscale. So every new “generation” of objects will be bigger as a “value” or “iteration” matadata growing.

But it is not really this way?? It's like these objects, all of them growing every iteration, even these old from previous iterations?

I tried to delete previous objects inside the loop, but it's not what I want, I want scatter on all objects from previous iterations..

But, If I pass the detail attribute to a point attribute. I see they are growing in spreadsheet.. I'm not sure I made this clear…. But anyway. Thanks a bunch!
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Strange, it seems to work just like you describe on my end. Either way, I'd recommend taking a look at the Solver node, which I find better at dealing with frame dependent iterations.

Cheers,
Ivan
  • Quick Links