[REQUEST] Desaturation
#1
Control over the saturation by attribute. Where 100 is normal and 0 is gray-scale.

<texture sat="69">
<animation effect="desat" start="100" end="0">

Code:
uniform sampler2DRect S;
uniform float T;

void main()
{
    vec3 R0 = texture2DRect( S, gl_TexCoord[0].st ).rgb;
    gl_FragColor = vec4( mix( vec3( dot( R0, vec3( 0.2125, 0.7154, 0.0721 ) ) ), R0, T ), gl_Color.a );
}

-edit, added examples-

-Only use color on focus for menus (using shaders will also allow desaturation on fanart/posters).
-Desaturated layout on film classics library (custom node)
-Desaturate background on dialog.
-Watched status, ect desaturation
-Short desat for colorful notification
-General animation

So yeah, haha. Pretty much the same stuff as for blur.
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#2
Did You just paste random code You found on google or You actually now and understand what it is and can help with implementing it?
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#3
I was discussing this example with a co-worker (who was using it) when i got the idea to use it for skinning. Though it is for opengl i thought it would better explain to the devs where the idea came from. And that it is a lot of feature compared to the coding. You guys always ask for more then just a brainfart, without code i have 1 line of text and leave the rest to your imagination. From what my co-worker explained and my php i think i have a pretty good understanding of what would be needed. But no i never opened the sourcecode.

I really thought it was a good suggestion. From an artist point of view, black and white can do so much for mood and the feeling something gives you. And then the extra options in animation... Maybe run whole movies in black and white... jebus.

I really like a challenge, and if the documentation is there. Why not.
But really, i didn't expect a reply like this. I don't like having to give a personal defensive answer. As it's not about the idea or the code. And maybe i should have made it a feature suggestion. I decided to put it here because it's so skin specific. But, ok, drop this part of the discussion.

It's pretty damn cool feature, right?
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#4
Sorry that You took my answer as some kind of attack - it wasn't. I was just checking if You could help with implementing this stuff (given that you provided some code here)

Code you pasted is glsl shader (I think it is - i never dealt with shaders before). If we would have way to use shaders for gui effects it would be pretty simple then to add more effects (f.e blur effect which was asked for several times too). Obviously we would need to add support for both DirectX and OpenGL shaders and same effect would need to be written in glsl (opengl) and hlsl (directx). That's all my guesses.
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#5
Ok, ok, no problem. Text can lose it's subtlety.

Yes, you hit the nail on the head. Getting them in the same (kind of grayscale) is a potential dealbreaker. The other side is, will this give enough control for the features.

If we have to change color spaces we are looking at 2 pages extra code. And it would not be the light implementation (resource wise) i was hoping this code could do.
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#6
The hlsl is pretty similar.

Code:
float4 PixelShader(VertexOut input) : COLOR0
{
    float4 color;
    color = tex2D( ColoredTextureSampler, input.textureCoordinates.xy);
    return dot(color, float3(0.3, 0.59, 0.11));
}
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#7
The problem isn't the shader, rather it's the combining of shaders so that everything does what you want.

It's not necessarily straightforward to combine existing pixel shaders with additional ones in a way that can cope nicely with inherited vales from groups etc.

E.g. it makes sense to be able to desaturate everything behind the current control group if you throw a dialog up. This means desaturating the current back buffer values not the texture values.

Basically you'd have a stack of shaders all of which would need to be applied, ideally without multiple render passes.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
So I guess there still isn't any progress in implementing blurring, desaturating etc.? I downloaded the xbmc source code the other day and tried to apply a basic glsl shader but well, my knowledge with OpenGL is very low so I didn't get anything working. ^^

Can anyone give some pointers where to start? I first had a look at the VisibleEffect class where all the current animations are defined but since there is no OpenGL stuff going on, I looked at RenderSystemGL, GuiShader / Shader, tried to compile & link a shader but it changed nothing of course. Smile

What would be enough for a start is e.g. an extra attribute in an image control which blurs or desaturates everything which is behind this control. So e.g. taking a "screenshot" very quick, apply the filter and display it behind the image control. Apple is doing something like this in iOS 7 if I'm not mistaken.
Image
Reply

Logout Mark Read Team Forum Stats Members Help
[REQUEST] Desaturation0