Matchbox resize filter question

Quick question: does anyone know if matchbox supports other resize filters that are outside the flame defaults? Cubic for instance?

I don’t see why not. ChatGPT certainly seems to think it’s possible. I doubt this would compile nicely on the first go but I bet with a few rounds of revisions it might work.

#version 330 core

uniform sampler2D inputTexture;
uniform vec2 outputSize;

in vec2 TexCoord;
out vec4 FragColor;

float cubic(float x) {
    return max(0.0, 1.0 - abs(x) * (2.5 - 1.5 * abs(x)));

void main() {
    vec2 texelSize = 1.0 / outputSize;
    vec2 texel = TexCoord * outputSize;

    vec4 result = vec4(0.0);

    for (float i = -1.5; i <= 1.5; i += 1.0) {
        for (float j = -1.5; j <= 1.5; j += 1.0) {
            vec2 offset = vec2(i, j) * texelSize;
            result += texture(inputTexture, TexCoord + offset) * cubic(offset.x) * cubic(offset.y);

    FragColor = result / 16.0;

Wouldn’t we have to define what cubic is for the script to apply it?

As in define what kind of cubic filter or define the parameters that determine kernel size?

I’m hoping I have a slow day tomorrow so I’ll try and take a look about making an actual matchbox.

1 Like

Both really. define cubic filtering since it’s not part of the flame ecosystem and the parameters.