wayfire icon indicating copy to clipboard operation
wayfire copied to clipboard

animate: Add helix animation

Open soreau opened this issue 1 year ago • 2 comments

Add helix animation.

soreau avatar Jul 30 '24 22:07 soreau

The effect works quite well but I think it uses lots of CPU and I also think we can make it work almost entirely on the GPU .. let me know what you think about that.

My initial thought is that it would be a lot of work for relatively little payoff.

The effect works quite well but I think it uses lots of CPU and I also think we can make it work almost entirely on the GPU .. let me know what you think about that.

Looking at this, I have an idea on how to make this less CPU-intensive, because I am getting 50%+ cpu usage even on 1080p (the effect will be much more pronounced on 4k displays since the algorithm is linear in height):

Compute a vertex buffer with strips spanning a simple [0,1]x[0,1] rectangle (the rectangle can be easily scaled to match the view size with a matrix multiplication in the vertex shader).

Based on the actual view height at runtime, we select how many strips to render.

Rotation is also doable in the vertex shader - for example by using something like floor(gl_VertexID / 6.0 you can get the strip index, and from the strip index you can calculate the rotation for the strip.

Does that sound about right? Maybe I misunderstand the implementation, but feels like the computation-intensive part of this effect can thus be offloaded completely to the GPU.

Maybe, but I'll leave you to experiment with this idea.

soreau avatar Aug 29 '24 04:08 soreau

The effect works quite well but I think it uses lots of CPU and I also think we can make it work almost entirely on the GPU .. let me know what you think about that.

You previously mentioned that helix takes about 50% cpu in your tests. I did my own tests, of each animation, running wayfire with nothing more than what is required to do the tests. Here are the results:

Duration: 5000ms
No animation (idle): 2% cpu
Fade:        14% - 2% = 12%
Zoom:        14% - 2% = 12%
Fire:        42% - 2% = 40%
Zap:         14% - 2% = 12%
Spin:        14% - 2% = 12%
Helix:       17% - 2% = 15%
Blinds:      24% - 2% = 22%
Shatter:     40% - 2% = 38%
Vortex:      15% - 2% = 13%
Squeezimize: 18% - 2% = 16%

It seems fire is the worst, at 40%, followed by shatter at 38% and blinds at 22%. Helix is nearly on par with the built-in transformer animations at 15%. Please let me know what you think in light of this.

soreau avatar Aug 29 '24 17:08 soreau

Closing this because this animation is now part of wayfire-plugins-extra 'extra-animations' plugin.

soreau avatar Dec 30 '24 16:12 soreau