[Request] Saturation mask DX11 with added feature

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I would like a shader that works like Muddymole's Please login to see this link. but I was wonder if it would also be possible to add a user set parameters like
    Saturation = value (anything covered in mask would be set to this) ?

    This would enable the option of doing effects with oversaturation like this:
    Please login to see this attachment.

    (maybe it would be better to switch it around ie. anything not covered in mask gets set to saturation)

    Pinging [MENTION=7947]MuddyMole[/MENTION] since you made this and I'm linking to your file (hope this is ok).

  • Yes, man you are fast!
    Thank you!

    I would like the effect to be blendable in this way:
    Please login to see this attachment.

    As seen it can be achieved by adding a lighten (photoshop blend mode) shader on the mask object but maybe it would be more efficient if it could do this on its own?
    Is there a better way or should I just do it like this?

  • What you asking for is impossible to do with a single shader.
    Since it's sampling the layer, it can only see what's in the layer, and in the layer the objects are covering each other.
    So you have to merge the light sources with a blending shader anyway. The shader applied to the layer can't possible differentiate each individual object.

    The only possible way of doing this in a more natural way would be using a palette or LUT (Color Grading) shader, cause then it would be able to do the stepped blended light in a natural way.
    Problem is that colors might not look exactly like you want, and blended light sources may increase the general size of it.

  • Okay, so I've tested having a toggle and a influence of alpha parameter, both doesn't behave as expected on DX11, no idea why.
    Either way, it doesn't look exactly like your picture, it nearby light sources would combine making a bigger light source, it would kinda of still be stepped, but lighter steps would combine creating a in between color.
    This in between color would not happen with the brightest point of the light source, but still not what you showed.

  • Right. Yeah, the in between colors is not the desired effect.
    I'm a bit confused, did you add the alpha channel toggle or was this just something you tested? Is there any difference in DX11 in the two versions you've posted ?

    In any case I'm happy with the effect SaturationMask 2 + lighten gives me. I'm only concerned about performance as my project can use 100+ lightsources and I figured using 1 fullscreen shader would be better/faster than using that plus another shader on 100+ objects. But I'm only guessing here, maybe it won't even matter. I need to do more tests.

  • 1920x1080 and the amount of lights shown at the screen could easily surpass 100+ objects. My project is a type of colony sim/village builder game so I have little control of how many lights being used in terms of leveldesign since it's the player who will control the layout. The theoretical max number of placed lightsources on a single screen would actually amount closer to 1000 but I'm probably going to add a hard limit of around 100 lights max since it would make little sense for the player to place more.
    You mean pixel shaders only process what's actually being drawn on screen? Never thought about it but yeah that makes total sense.

  • Ugh...I'm getting very inconsistant results using various saturation filters. For example this is the difference between Complex-softwares saturation shader (left) and ShaderMask 2 (right)
    Please login to see this attachment.
    Muddymole/Sketchy's "Color-adjust" saturation gives me third result and of course I get yet another result in the photo editor Gimp.
    I can understand Gimp being different but all the others are in the same enviroment (ie CTF 2.5). Are they using different methods? Surely there's a "correct" way to calculate saturation and if so which is it?

  • Yeah sorry my test apps are a mess. I think my initial testing might have been done with C-S shader and then I have switched to muddymole's for the mockup, wrongfully assuming they were the same, which ultimately might have messed up the result I wanted.
    It's hard since I can't show you exactly what I want and also it seems that some colors do produce the same result whereas others dont. I realise this makes it hard to help and apprechiate all your help very much.

    My lighting system has become a real nightmare. I've worked weeks on this testing every method, shader, combinations of shaders, distance-calculated transparency, with and without alpha-channels, rgb-coefficent but I still havent quite found what I'm looking for. I thought saturationbased simple radialgradients would be a fairly straightforward way to get an acceptable result but now I'm not sure...

  • Ugh...I'm getting very inconsistant results using various saturation filters. Are they using different methods? Surely there's a "correct" way to calculate saturation and if so which is it?

    Yes, they are using different methods, because they are effectively using different color models (there are lots of different color models that contain a saturation component, and chroma is sometimes incorrectly referred to as saturation too).

    The Complex Softwares "saturation" shader calculates a grey value with the same lightness as the original, but with a saturation of zero. It does that by simply finding the average of the red, green and blue components. It then does linear interpolation between the grey and the original color (S is equivalent to S in HSV or HSL color models).

    My "saturation mask" shader does the same, except that it calculates the grey color in a different way, which is perceptually uniform, taking into account the fact that to the human eye, pure green pixels appear almost 6 times as bright as blue pixels, and twice as bright as red pixels (S is equivalent to S in HSI color model).

    My "color adjust" shader (if you can call it mine), I have no idea what's going on - I must have adapted it from a code sample I found on the internet somewhere...

  • I actually got a little of the terminology wrong myself in the last post, so it is confusing!
    This example from wikipedia demonstrates the difference pretty well:

    Please login to see this picture.

    Complex softwares should give a result like 13d.
    The "saturation mask" shader should give a result like 13c.
    The "color adjust" shader should give a result similar to 13c, but it uses a different set of coefficients (rec.709 instead of rec.601, if you want to get technical).

  • Right. Thanks for the clarifications, color models is a complex subject. Just to be clear I didn't mean to imply that anyone was doing things "wrong" (thats why I wrote "correct" with citations) since I am aware of the different color models. I meant it more in the way of what's best for my purposes, but I guess that's ultimately for me to decide unless there's some real performance perk one way or the other?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!