asusralis
Topic Author
Posts: 152
Joined: 30 Jul 2018, 05:03

Is there an available tint shader for Unity?

01 Jun 2022, 12:00

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.
 
User avatar
sfernandez
Site Admin
Posts: 3364
Joined: 22 Dec 2011, 19:20

Re: Is there an available tint shader for Unity?

01 Jun 2022, 23:23

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.
 
User avatar
jsantos
Site Admin
Posts: 4825
Joined: 20 Jan 2012, 17:18
Contact:

Re: Is there an available tint shader for Unity?

02 Jun 2022, 11:39

Note that in Unity, for now, only HLSL platforms (D3D11, D3D12) support custom shaders.
 
asusralis
Topic Author
Posts: 152
Joined: 30 Jul 2018, 05:03

Re: Is there an available tint shader for Unity?

10 Jun 2022, 17:41

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?
 
User avatar
jsantos
Site Admin
Posts: 4825
Joined: 20 Jan 2012, 17:18
Contact:

Re: Is there an available tint shader for Unity?

15 Jun 2022, 17:03

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.

Who is online

Users browsing this forum: No registered users and 7 guests