ENBSeries
http://enbdev.com/enbseries/forum/

Luma Sharpen with GUI enable/disable function
http://enbdev.com/enbseries/forum/viewtopic.php?f=28&t=3252
Page 1 of 1

Author:  Insomnia [ 07 Jul 2014, 15:18 ]
Post subject:  Luma Sharpen with GUI enable/disable function

Hey!
So I've been trying to have a simple on/off switch in the GUI for Luma Sharpen. Trying to understand how it all works, but I've never seen stuff like "half4".
So I need some help... :)

Whenever there's a res=origcolor I can usually create an on and off switch by adding:
Code:
   if (XXX==true) {
      res = lerp ( blablabla );
   }
   if (XXX==false) {
      res.rgb = origcolor.rgb;
   }


But I don't know how to make this in Luma Sharpen shader...
Tried this:
Code:
          // -- Combining the values to get the final sharpened pixel   --
       if (LumaSharpen==true) {     
     half4 done = ori + sharp;    // Add the sharpening to the original.  //Wait shouldn't I be adding it to luma and then add chroma?
   }

       if (LumaSharpen==false) {     
        half4 done = ori.rgb;
   }

But the shader doens't load obviously... I'm still a noob at this so be gentle. ^^
Can it even be done with Luma Sharpen? If all else fails I'll use a #ifdef instead. But I'd rather have all in the GUI so...pls help!

Author:  kingeric1992 [ 07 Jul 2014, 17:42 ]
Post subject:  Re: Luma Sharpen with GUI enable/disable function

Hi, Insomnia
half is 16-bit float according to this http://msdn.microsoft.com/en-us/library/windows/desktop/bb509646(v=vs.85).aspx
I don't know if there are any constrains about half, but if the shader can work before your modification, it shouldn't be the problem.

Is there any error message?? Can you post the whole shader? I would love to look into this.

Author:  ENBSeries [ 07 Jul 2014, 20:12 ]
Post subject:  Re: Luma Sharpen with GUI enable/disable function

#ifdef not work, it's static thing. Also much faster instead of if/else statement to use interpolation via lerp. More than that, you can't declare variable half4 done inside if/else statement, because it can't be used outside of it, it's basic coding rules. half, half2, half3, half4 replace with float, float2, 3, 4, because they are same internally, it's alsmost obsolette variable type (performance is a bit faster when used with certain instructions set, but you will not use them for sure).

Author:  Miratheus [ 24 Jul 2014, 13:43 ]
Post subject:  Re: Luma Sharpen with GUI enable/disable function

Hi, Insomnia!
You need to paste right after
Code:
half4 ori = tex2D(SamplerColor, coord.xy);

only one line:
Code:
if (LumaSharpen == false) return ori;

I've done the same thing with LumaSharpen code from ZeroKing's effect.txt and it works.

Author:  ENBSeries [ 25 Jul 2014, 10:05 ]
Post subject:  Re: Luma Sharpen with GUI enable/disable function

Do not use return at all! And in condition also. Shaders 3.0 do not allow this and this somehow works only because developers doing mistakes and microsoft updated shader compiler to support this.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/