Page 1 of 1

Saturation Effect Usage

Posted: 21 Jun 2023, 00:18
by stonstad
Should Saturation Effect work in Unity projects? From what I can tell, NoesisGUIExtensions is installed for Unity. Most extensions work, but this one does not for me. To clarify, I am not trying to get Blend to recognize this extension -- I'm just trying to use it within Unity w/ Noesis.

I'm trying the following code
<StackPanel
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:noesis="clr-namespace:NoesisGUIExtensions"
  Orientation="Horizontal">
  <Image Source="Images/tulip.png"/>
  <Image Source="Images/tulip.png">
    <Image.Effect>
     <noesis:SaturationEffect Saturation="0"/>
    </Image.Effect>
  </Image>
</StackPanel>
[NOESIS/E] Assets/User Interface/UIStateMachine.xaml(29,17): Unknown element type 'noesis:SaturationEffect' (NoesisGUIExtensions.SaturationEffect)

Re: Saturation Effect Usage

Posted: 22 Jun 2023, 11:25
by jsantos
ShaderEffects listed in the Class Hierarchy are not available in Unity. You can find some of them (but not Saturate) in the VideoEffect sample that comes with the Unity package.

Saturate effect is available in the C++ SDK, you can use it to create something similar in Unity:
#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
    );
}
And yes, this is something we should fix.

Re: Saturation Effect Usage

Posted: 05 Jul 2023, 17:41
by stonstad