Forum

Blend (Mixer) problems

Hello,

Comparing how blendmode are working in software such as Photoshop, Gimp, Blender, Davinci etc… and also in vvvv Beta, there are some bugs and behavior issues in the Gamma textureFX :

First the fader has to be set to 0.5 instead of 1.0.

Now I haven’t tested all of them but here are a few examples with the middle being from GIMP :

Softlight

Add :

Multiply (the alpha shouldn’t multiply)

Overlay :

It’s cool that stride comes with more of them but for sure the Normal blend mode and its behavior is missing and other “standard” one have problems.

thanks for the report. some slight differences are expected because the stride graphics pipeline operates in linear color space. in vvvv beta, we only had gamma space. there is no right or wrong, but in more modern and professional workflows linear color space is the default because it preserves the colors correctly.

This page has a lot of info about that: What every coder should know about gamma | John Novak

gimp, for example, can switch this blending mode per layer, maybe our blend node should have this too…

looks like a bug.

The Add is correct though, but you need to make sure that the input texture is really white. If you use SceneTexture you will have a ToneMap operator that maps HDR colors to screen colors. You can draw in the AfterScene render stage to skip the PostFX or use a RenderTexture and a QuadRenderer to do low-level rendering of primitives.

This could be defined either way. why do you think that the alpha should not multiply? doesn’t it give more options for the alpha channel of the output? if you set the color to black with Alpha = 1 you would get the output you are looking for.

looks like a bug, too.

The shaders for the blending operations can be found here:

most of them follow this reference:

we didn’t check each one in detail, but if you have any fixes or suggestions, let us know. otherwise, we will fix the erroneous ones in a future release.

I would consider fader going to 0.5 for full blend, and 0.5 → 1 for: full blend → full second input to be a feature, not a bug.

1 Like

Hi,

thanks for the resources, I’ll have a look.

The problem is I would say is the behavior I’m looking for and I believe people using graphic tools should be the same as GIMP, Photoshop, Blender etc…

Also when using blend mode like this you need to switch between them quickly. Now if Multiply works with a Black background with Alpha 0 then other like Normal won’t. It is in my opinion better if the alpha works the same for all of them.

If not then, people will be confuse that in VL things works (again) differently from other software. And some blendmode needs to be manage differently.

I found the Alpha compositing formula on StackOverflow and here is what I have done so far :
BlendShader.zip (9.9 KB)

For some reason here I don’t understand the Divide blendmode make the background slightly brighter and I had to use Saturate function where vvvv Beta didn’t need it.

Note that the Type is control by a switch case with Integer32 as I haven’t manage to get the enum working yet.

Hi, i would like to reactivate this topic again since it looks i’m not the only one having issues with the “new professional” way of blending textures.

I’ve tried to rebuild a kind of Superblender using only Stride “Blend” and i faced several limitations, mostly related to the way Alpha is handled.

Also there are some methods that don’t seem functional or just freeze for a few frames.

Non UNorm formats look problematic or just don’t work with certain combinations.

Blender.zip (18.4 KB)

I hope it is usefull in order to build together a robust and more designer oriented way to solve this.

Alpha is indeed the problem,

so for now if you use the blend I provided it should work just fine like in Gimp/Photoshop.

Why is it the problem ?

for example in the case of Add mode the alpha is also added :

shader ComputeColorAdd : ComputeColor
{
    compose ComputeColor color1;
    compose ComputeColor color2;

    override float4 Compute()
    {
        float4 tex1 = color1.Compute();
        float4 tex2 = color2.Compute();

        return tex1.rgba + tex2.rgba;
    }
};

Also in the Multiply blendmode :

shader ComputeColorMultiply : ComputeColor
{
    compose ComputeColor color1;
    compose ComputeColor color2;

    override float4 Compute()
    {
        float4 tex1 = color1.Compute();
        float4 tex2 = color2.Compute();

        float4 mix1 = tex1 * tex2;

        return mix1;
    }
};

the alpha channel is multiplied. So alpha is working differently in each blendmode but what we are use to is a common formula to handle alpha :

float AlphaCompositing (float as, float ab, float ar, float Cs, float Cb, float Bbs)
{
    return (1 - (as / ar)) * Cb + (as / ar) * (1 - ab) * Cs + ab * Bbs;
}

This is why i’m using the one you provide, it should be the standar btw.
thank you so much for the clarification.