Simple Incrementing Counter

   240   3   0
User Avatar
Member
60 posts
Joined: 6月 2021
オフライン
Downstream of a Vellum simulation with animation after I use a Point Deform SOP to merge the simulation mesh with a high-res version I want to implement a simple counter. The counter should increment by one each time when @Frame % N == 0;

The counter will be used downstream to compare against @class generated by a Connectivity node.

Seems like something so fundamental to programming should be fairly straightforward but I'm having a heck of a time. I'm using a SOP Solver and things sort of work but not quite right.

What is the preferred workflow/nodes to use for this?

Thanks,
Greg
User Avatar
Member
64 posts
Joined: 4月 2013
オフライン
Try "floor(@Frame/24) it will simply increment the counter by 1 every 24 frames (working outside of a solver)

In hindsight you specifically said "The counter should increment by one each time when @Frame % N == 0;"

The way to achieve this is using a solver as you mentioned used to work with the "previous frame"

Confusing at first yes, but simple fact is Houdini works per frame so any calculation is done in "that frame"
and adjusted in future frames by some reference like @Time, @Frame that actually changes per frame
rather than the "result" of the calculation.


Attached is a hip that hopefully will do a much better job explaining than me.


The wrangle in the solver will know what count is from the previous frame and add 1 to it using your formula.
(pretty much like standard coding)

The wrangle outside the solver will only add 1 when frame % N == 0..(Frame 24)..otherwise the result will be 0
as it has no clue what it was on the previous frame.
(think excel spreadsheet)


Hope that helps.

Image Not Found

Attachments:
Counter.hipnc (95.8 KB)

User Avatar
Member
60 posts
Joined: 6月 2021
オフライン
EZiniT
Try "floor(@Frame/24) it will simply increment the counter by 1 every 24 frames (working outside of a solver)


Hope that helps.

Image Not Found

Thanks I see this. I also need to get the simulated/animated geometry through the solver as well. I know I have to wire opinput 1 to output somehow but can't get the wiring right.

Any ideas?

Greg
User Avatar
Member
64 posts
Joined: 4月 2013
オフライン
If you can, share a hip file and the final result you want to achieve.
  • Quick Links