Animate a Programmable Filter using GetActiveCamera

I need to do something odd. I want to compute field quantities based on the active camera position and orientation. I have a prototype working, where I use a Programmable Filter to compute these quantities based on GetActiveCamera().GetViewPlaneNormal() from VTK. The problem is, camera motion doesn’t trigger an evaluation of the filter. Is there a way to fake things so that I can force the animation to trigger a filter evaluation? The best idea I’ve had so far is to add a Transform filter upstream of the Programmable Filter and just do a very small translation.

This is indeed not really in the VTK philosophy… The content of a filter is intended to be rendering-agnostic.

To achieve that, I think you should have some external code that observes the camera and call some setters on your filter.

  • create a filter proxy (this can be based on programmable filter with some property, or with a python plugin)
  • create a pvpython code (like a macro) that observes the camera and update your filter accordingly

See Utkarsh’s message for an example Scale Scalar Value in Animation - #6 by reox

This uses a “Python” animation track where you have access to all the filters and camera as well. In ParaView 5.12, you can add a “Python” animation track in the Time Manager (the Animation View is gone).