User defined functions / shaders

I have been working on a “shader” based UI to create user functions for led strip control. This can control any mapping of leds, zo also panels, disks or custom shapes. There are 2 components to it:

First is a mapping file, which maps led index to x,y,z coordinates as well as optional u,v,w coordinates. The latter are useful for example for disks, where u and v can be polar coordinates.

The second is a shader, which is a function that is called for every led and receives the coordinates, as well as the led index and current time.

The UI I made allows to compose shaders in a visual way and crosscompile it to source code. I currently support javascript (for in browser viewing) and micropython.

I created a rudimentary micropython implementation to be able to run it, which works reasonably well. However, it is not nearly as feature complete as wled. Also, I am not experienced enough to create an implementation in C. The problem is getting user code to upload to the device and run it. I have not found a way to do this in C, hence the micropython approach.

The benefits of this approach are

  • user defined effects
  • composable shaders
  • effects based on coordinates
  • possible syncronisation of multiple strips in world coordinated for room-wide effects

So some questions are:

  • could this be integrated into wled?
  • what code should be generated (json / c / some binary data)?
  • do you have other ideas that may be useful here?