Page 1 of 1

Is there an available tint shader for Unity?

Posted: 01 Jun 2022, 12:00
by asusralis
I looked at the thread here and found you can;t use the tint effect in Unity. Is there not one available out of the box? I have a white png with a transparent background, and I would like to change its color depending on triggers.

Re: Is there an available tint shader for Unity?

Posted: 01 Jun 2022, 23:23
by sfernandez
Hi, you can install the BrushShader and VideoEffect samples from our package to learn how to create your own shaders.

In the VideoEffect sample there is in fact a TintEffect, although I recommend you transform that into a BrushShader because it is more efficient and you don't need an Effect in your case, effects are better to modify a group of objects.

Re: Is there an available tint shader for Unity?

Posted: 02 Jun 2022, 11:39
by jsantos
Note that in Unity, for now, only HLSL platforms (D3D11, D3D12) support custom shaders.

Re: Is there an available tint shader for Unity?

Posted: 10 Jun 2022, 17:41
by asusralis
Are there any plans to include this in Noesis? Graying out images is incredibly common in game UIs, but you can't do this if there is any transparent background right now. Out of the box, you have to include multiple images in order to make images look disabled. I sadly don't know how to make a shader like this.

The tint effect won't work on Android?

Re: Is there an available tint shader for Unity?

Posted: 15 Jun 2022, 17:03
by jsantos
Are there any plans to include this in Noesis? Graying out images is incredibly common in game UIs, but you can't do this if there is any transparent background right now. Out of the box, you have to include multiple images in order to make images look disabled. I sadly don't know how to make a shader like this.
We don't plan to include this shader in the core, but it should be easy to create your own starting with our examples. For example, in C++ we have the following saturation shader that can be used for B&W effects (as sergio said, we recommend having a look at BrushShaders and VideoEffect samples included in the Unity package)
#include "HLSLHelpers.hlsli"

cbuffer Constants: register(b1)
{
    float saturation;
}

float4 main(in In i): SV_TARGET
{
    float4 c = GetInput(i);

    return GetOpacity(i) * float4
    (
        c.r * (0.213f + 0.787f * saturation) + c.g * (0.715f - 0.715f * saturation) + c.b * (0.072f - 0.072f * saturation),
        c.r * (0.213f - 0.213f * saturation) + c.g * (0.715f + 0.285f * saturation) + c.b * (0.072f - 0.072f * saturation),
        c.r * (0.213f - 0.213f * saturation) + c.g * (0.715f - 0.715f * saturation) + c.b * (0.072f + 0.928 * saturation),
        c.a
    );
}
The tint effect won't work on Android?
For now only renderers supporting HLSL (D3D11, D3D12, Xbox) will render custom effects. But we are working on supporting the rest of platforms.