A Wave Of Effects | New Shadertoy Plugin for Kdenlive

I wanted to add support for OpenFX so that I could use natron effects, but I guess it’s not for me right now. So I created the next best thing!!

Instead of creating individual effects, why don’t we make something that makes use of the thousands of effects already available and make it way easier for people to make new effects and generators? I present you..

Shadert0y

A Frei0r filter plugin that runs Shadertoy GLSL shaders inside Kdenlive, or other MLT-based hosts. The shader is rendered offscreen using EGL + OpenGL 3.3 core, then written back to the host video frame.

It has simple buffer support, iChannels support, iMouse input and iResolution input. Example:

More examples included in the repo.

Note: Heavy shaders might break for the entire session, appearing black and causing you to restart kdenlive to reset.
And I haven’t found a consistent iResolution control yet.

More Info and Installation:

GitHub Repository: GitHub - YousufPro67/shadert0y · GitHub

Deepwiki Wiki: https://deepwiki.com/YousufPro67/shadert0y

Thanks to PakeMPC (PakeMPC) · GitHub for making me aware that I could make a custom effect for kdenlive in some way…

3 Likes

And btw is this good enough for gpu effects in roadmap?

OpenFX integration was added to MLT lately. So there is a good chance that we can integrate OpenFX in Kdenlive now.

2 Likes

re: Shadert0y

This is awesome!

re: OpenFX
Indeed, thanks to the work of @joinlaw (see Basic OpenFX Support development log)

1 Like

I figured I couldn’t edit the main topic so I’ll just showcase it here:

Shader On A Shader:

Unfortunately, I can’t post the video here.

Above is the showcase of using buffers, iChannels, and other parameters. It also showcases that a shader can be applied to another shader, like normal effects.

Don’t worry, it’s laggy because I have a low-grade laptop.

2 Likes

Update: Added iParams0-7 for custom settings and keyframing. Added a switch for using shaders own alpha value for some cases. Added an extra File param incase the shader is all without the parent clip.

Currently planning a better and easier way to install with a file instead of manually compiling. Any tips are welcomed.

I tried it out by downloading a shader that simulates a misted-up window with raindrops. It worked a treat. It’s brilliant, thanks – I’m sure I’ll be using it to the full!

1 Like

So I have a question (actually two):

  1. How future proof is GLSL since vulkan is moving in to replace it and MacOS/Windows have their own APIs, you can’t even use OpenGL on macs without some API translation of some sort.
  2. How difficult math wise is GLSL? Yeah, I can assume advanced calculus might be overkill, but does one need to rebrush up for a year on high school math to get good at GLSL/OpenGL?

Also, thanks for the plugin. I know this will be a phenomenal addition.

Windows and Linux installers are FINALLY available!!

Also added a build tutorial for multiple distros and Windows.

And the new Pling page:

GLSL is just a language and can be used for Vulkan as well. When you write Vulkan shaders, you write them in GLSL and compile them to SPIR-V (Vulkan’s bytecode)
Vulkan is more future-proof, but it’s much more complex to implement (at least for me) and quite overkill for this purpose. Windows support was implemented by porting EGL to WGL (Windows Graphics Library), and it’s fully supported, not deprecated. For macOS, it is deprecated, but you can still use it using CGL (Core OpenGL). I haven’t tested the Mac version yet, but I have implemented the support as a guess for now, need for tester.

I’m not that good at it either, but I will say it would only take about a month; just remix shaders from Shadertoy and try to understand and change them. I can recommand you some books and tutorials online:

This guy is so sweet he teaches raymarching so goood

Given how slow frei0r github is for merging PRs, glad you’re making this an an independent plugin. I also didn’t know you could make a frei0r filter without needing to recompile frei0r.

Now, are there any directions on getting this to work with the flatpak version of kdenlive? Or the appimage? It appears the README is tailored to native non sandboxed versions of it like windows or fedora/debian/anything else.

Also, do I have to make an xml file for every single shader I create? Or is there a primary xml file that I list the path to all the shaders?

EDIT: The instructions should be updated to mention you can’t have the the shadert0y.xml file in the same exact directory where the plugin is. It must be placed in a predefined path such as ${HOME}/.local/share/kdenlive/effects for the shader selector to work.

It’s not that it’s slow, but it requires some specific dependencies to build, and it’s not a full plugin for shadert0y, and I don’t want frei0r to have incomplete plugins. It’s quite bigger than other plugins as well, and I don’t think they will merge this at the current state. As for the PR, it only contains a small version of the plugin that doesn’t have custom params and other features. It also can’t run on Windows and Mac since it still uses EGL. A treat for those running Linux.

Unfortunately, I haven’t found a way yet. The Flatpak version uses /app/lib/frei0r-1 but it is read-only.

For AppImage, you have to rebuild it using appimagetool. I’ve added the guide for editing the AppImage and provided a prebuilt AppImage.

No need; you can just copy the shader code and basically just open the text editor or Notepad, paste the code, save it as a .frag or .glsl file, and select that file in the effect itself.

You can just run install.sh, and it will place them for you.

The only XML file needed for shadert0y to be useable by Kdenlive is the one provided. You then need to specify the shader file(s) to be used.