User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Saturation Effect Usage

21 Jun 2023, 00:18

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

Re: Saturation Effect Usage

22 Jun 2023, 11:25

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.
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Saturation Effect Usage

05 Jul 2023, 17:41

Who is online

Users browsing this forum: saji8k, Semrush [Bot] and 4 guests