Lypheo / vs-placebo

libplacebo-based debanding, scaling and color mapping plugin for VapourSynth
GNU Lesser General Public License v2.1
73 stars 13 forks source link

Shader "parameters" #5

Closed theChaosCoder closed 3 years ago

theChaosCoder commented 3 years ago

Some shaders have "parameters" like:

#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number

https://github.com/bloc97/Anime4K/tree/master/glsl

Is it possible to change those parameters on the fly with placebo.Shader()? If not, would it be hard to implement?

Lypheo commented 3 years ago

No, in the general case, there is no way of knowing which #defines are supposed to be tunable parameters. And even if there was, I can't think of a way to pass those parameters to placebo.Shader() that isn't horribly ugly. What I could implement, though, is passing the shader directly as a string instead of a filename. That way, you could implement your own tunable shader generators in python.

theChaosCoder commented 3 years ago

I will take that, better than nothing. Some string replacement will do the rest.