algorithmic modeling for Rhino

This is the normal way of using Kangaroo with the timer, to see the movement on screen:

However, if you want to produce and save an animation, you can do this:

The 'NOT' component (found in Math>Boolean) means that when the slider is at 0, the input to SimulationReset will be True, and for any other value it will be False.

When you then animate the slider in the usual way by right clicking it, the first frame will reset the simulation, and every subsequent frame will be another iteration of the physical system. Note that with this setup there is no need for a timer component. Also, the upper limit of the slider is unimportant - however many frames you choose in the animate dialogue will be the number of physical iterations. To speed up or slow down the simulation, change the number of subiterations in Kangaroo settings.

This can also be combined with Giulio's 'renderanimation' script, if you want the result to be properly rendered, not just Grasshopper preview.

The sequence of images produced can then be easily assembled into a video or animation using a free software like VirtualDub.

Views: 10129

Replies to This Discussion

Hello :)

are there any tips/examples on how to achieve this in Kangaroo 2? The custom iteration script is probably the way to go?

A particular challenge I have is that my simulations are very large (and therefore slow). The slider animate steams ahead before Kangaroo has had time to settle. Does anyone have a recommendation for controlling the image capture rate (or perhaps the slider animate rate)?

Thank you!


Cheerio Greg :) A simple approach would be to call the Rhino command -ViewCaptureToFile from within a scripting component. So basically trigger this component to execute every time you want to capture the viewport. I put together a quick example of how to do this last year (see attached file, should be fairly self explanatory). I suppose it might become a bit of a bottleneck on your large simulations, so it might make sense to only capture every N iterations for instance.

Edit: You could even add this as part of the K2 script (if you're using the Zombie-style solving script).



That's brilliant. Just what I was imagining. Thank you (again!).

Now I just need to figure out how to do that second part... i.e. limiting the number of iterations in combination with the viewport capture. I'm trying to merge it with your custom elastic solver demo but my complex and multitude goal inputs seem to be upsetting it. I'll stick at it...

Thank you

No worries,

You can check (using modulo) if the current frame number is at your desired N. Then only send the filename downstream and execute the capture if this is true (see attached where I only capture every fourth frame). There's probably more slick ways of doing this (scripting, wink wink, nudge nudge).

Ps. I hardcoded a couple of the capture settings (i.e. grid is off etc.). You can fiddle with this in the script if you need to.







  • Add Photos
  • View All

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service