Floating-point buffers in ISF shaders

Here is an ISF fragment shader that uses a persistent buffer with "FLOAT": true:

/*{
    "DESCRIPTION": "Float buffer test",
    "ISFVSN": "2.0",
    "INPUTS": [
        {
            "NAME": "value",
            "LABEL": "Value",
            "TYPE": "float",
            "DEFAULT": 0,
            "MAX": 0.51,
            "MIN": 0
        }
    ],
    "PASSES": [
        {
            "TARGET": "buffer",
            "PERSISTENT": true,
            "FLOAT": true
        },
        {

        }
    ]
}*/

void main()
{
    if (PASSINDEX == 0)
    {
        gl_FragColor = vec4(value / 255., 0., 0., 1.);
    }
    else
    {
        vec4 color = vec4(0., 0., 0., 1.);

        vec4 pixel = IMG_PIXEL(buffer, gl_FragCoord.xy);
        color.x = 255. * pixel.x;
        if (pixel.x == 0. && gl_FragCoord.x > 0.5 * RENDERSIZE.x) {
            color.y = 1.;
        }

        gl_FragColor = color;
    }
}

In the first pass, the red channel in the persistent buffer is set to value / 255., and value can range from 0 to 0.51. In the second pass (the rendered image), the pixel is read from the persistent buffer, and the red channel of the rendered image is set to 255 times the red channel of the pixel from buffer. In addition, if the red channel of the buffer pixel is 0, the green channel of the right half of the image is set to 1.

When Videosync renders this shader, it produces an image where the right half is solid green and the left half solid black when value is less than 0.5. (This is the case even if value is 0.49999.) When value is 0.5 (or greater), the whole image is solid red.

This seems unexpected. What appears to be happening is that buffer is not stored using 32-bit floating-point numbers (even though "FLOAT": true is specified), but rather using 8 bits. When value is 0.5 or greater, writing value / 255. into buffer results in data being persisted. When value is less than 0.5, value / 255. is effectively rounded down to 0 due to lack of precision.

Does Videosync support floating-point persistent buffers? If not, is this support planned?

Apologies if this isn’t the right place for this question; I’m not sure if the ISF host is Videosync itself or Max.

I took another look at this, and it does appear that the issue is in Videosync, not Max. If I run this 4-object patch in Max v9.0.7 (b9109490887)—

—I see dark red in the Jitter window as expected. Videosync, however, shows an image where the right half is solid green and the left half solid black. This would seem to confirm that Videosync’s implementation of ISF does not support floating-point buffers.

Is there a plan to support floating-point buffers in a future release of Videosync?

Thanks for bringing this up.

Without looking into this in more detail, have you tried adding a Properties device to your track and enabling the Use 32 bit FBOs toggle? If all works as expected, this should control the data format of all buffers of the track, including the FBOs passed through the ISF Shader device.

If that doesn’t work, we’re happy to look into this in more detail.

Thank you for taking a look at this.

Unfortunately, using a Properties device with “Use 32bit FBOs” enabled has no effect, as far as I can tell:

Thanks for the quick reply!

All clear, that means we’ll have to look into it more deeply. I can reproduce the issue and identified a change in our ISF Shader processing code that fixes the issue on our side.

We’ll do some more checks and if this doesn’t introduce any issues we should be able to provide this fix in the next alpha. Let us know if you’d be ok with us adding you as an alpha tester so you can do a quick check to confirm that it fixes it on your end.

Excellent, I’m looking forward to a fix!

Let us know if you’d be ok with us adding you as an alpha tester so you can do a quick check to confirm that it fixes it on your end.

Please do!

Hey Nate,

It may actually take a while longer for this change to be added to our next private Alpha release, so instead here is a public Beta build that contains this fix specifically.

If you’d still like to also be part of the private Alpha testing community, let me know. The Beta and Alpha applications can co-exist on your machine, and we’re always happy to have more testers for upcoming releases.

…here is a public Beta build that contains this fix specifically.

Works like a charm, thank you!

Hey Nate! I just wanted to let you know that this fix has now been released as Videosync 2.0.12, so feel free to switch back to using the regular Videosync application instead of the Beta application, as the latter won’t receive updates as frequently.

Great, thank you so much!