projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.22k stars 364 forks source link

Add shader-based smooth transitions between presets #741

Closed kblaschke closed 7 months ago

kblaschke commented 7 months ago

New Preset Transitions

This changeset implements a new transition method using fragment shaders to smoothly blend from one preset to another. Currently, there are six different, randomly chosen transitions, most having some varation to make the transitions less repetitive:

  1. A simple crossfade blend.
  2. A sweeping effect with a random direction and slightly differing width of the blend edge smoothing.
  3. A circular inside-out or outside-in blend, again with a random edge width.
  4. A radial blur/zoom effect.
  5. A sweeping "warp" effect, either horizontally or vertically with a random direction.
  6. A plasma dissolve effect with a randomized pattern and scale.

More shaders can be added quite easily. Documentation to write the shaders is available as a Gist here, will move it to the Wiki after merging the PR. I've implemented them in a way that makes it really easy to test them on Shadertoy and use them with minimal or even no changes in projectM.

Other Changes

While the main focus was implementing the transitions, a few other changes were done either to aid in the implementation or to improve smaller things which I've stumbled upon during the implementation and didn't find big enough to create a separate PR:

kblaschke commented 7 months ago

Updated projectm-eval submodule to contain the yyerror function signature fix.

kblaschke commented 7 months ago

Added a fix for blur textures. Was using the wrong input texture, and the blur textures weren't properly flipped to align with the main texture.

kblaschke commented 7 months ago

The last commits should also wrap up all known rendering issues, except for some preset shaders rendering blackness due to NaN/Inf values in the calculations. These aren't easy to fix (if at all), but not affecting too many presets.

Will then merge this branch shortly.