Archive 17/01/2023.

Vibrance (GLSL)

rasteron

Some vibrance effects…

[gist]https://gist.github.com/bc75bae59873e342ec94a08e57752046[/gist]
[gist]https://gist.github.com/ceddd66430d24f676e0583201d2ace34[/gist]

enjoy. :slight_smile:

godan

love it!

sabotage3d

Looks cool.

rasteron

thanks guys, hope you’ll find this useful. :slight_smile:

sabotage3d

Thanks for sharing those. I would create a whole repository with all these shaders they are wonderful addition to any game or toolset.

Victor

Agreed, this is awesome! I’ve gone ahead and used your example to implement the HLSL for those using DX11

HLSL for DX11

<renderpath>
    <command type="quad" tag="Vibrance" vs="Vibrance" ps="Vibrance" output="viewport">
        <texture unit="diffuse" name="viewport" />

        <parameter name="Amount" value="1.0" />
        <parameter name="Coeff" value="0.299 0.587 0.114 0.0" />
    </command>
</renderpath>
#include "Uniforms.hlsl"
#include "Samplers.hlsl"
#include "Transform.hlsl"
#include "ScreenPos.hlsl"
#include "Lighting.hlsl"

cbuffer CustomVS : register(b6)
{
    float cAmount;
    float4 cCoeff;
}

void VS(
    float4 iPos : POSITION,
    out float2 oScreenPos : TEXCOORD0,
    out float4 oPos : OUTPOSITION
)
{
    float4x3 modelMatrix = iModelMatrix;
    float3 worldPos = GetWorldPos(modelMatrix);
    oPos = GetClipPos(worldPos);
    oScreenPos = GetScreenPosPreDiv(oPos);
}

void PS(
    float2 iScreenPos : TEXCOORD0,
    out float4 oColor : OUTCOLOR0
)
{
    float4 color = Sample2DLod0(DiffMap, iScreenPos);

    float lum = dot(color, cCoeff);
    float4 lum4 = float4(lum, lum, lum, lum); // hlsl wants this expressed explicitly.

    float4 mask = (color - lum4);

    mask = clamp(mask, 0.0, 1.0);

    float lumMask = dot(cCoeff, mask);
    lumMask = 1.0 - lumMask;

    oColor = lerp(lum4, color, 1.0 + cAmount * lumMask);
}
rasteron

Sure thing and that’s great sabotage3d!

@Victor

Awesome! nice addition.