Please use english language
It is currently 26 Feb 2020, 10:37

All times are UTC





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 07 Jul 2014, 15:18 
Offline
*sensei*
User avatar

Joined: 17 Apr 2014, 22:12
Posts: 422
Location: Schweden
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!

_________________
| i5 3350p @3.1 | 8 GB RAM | MSI GTX 660 | Skyrim on SSD |
My Flickr
My Soundcloud
CGI ENB


Top
 Profile  
 
Tomoko
PostPosted: 07 Jul 2014, 17:42 
Offline
*blah-blah-blah maniac*

Joined: 05 Apr 2014, 10:29
Posts: 557
Location: Taiwan
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.

_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube


Top
 Profile  
 
PostPosted: 07 Jul 2014, 20:12 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
#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).

_________________
i5-4690k, 16Gb RAM, GTX 1060 6Gb, X-Fi Titanium, Win7 x128
I am INFP, not the brutal, godamnit.


Top
 Profile  
 
PostPosted: 24 Jul 2014, 13:43 
Offline
User avatar

Joined: 24 Jul 2014, 13:37
Posts: 10
Location: Moscow, Russia
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.


Top
 Profile  
 
PostPosted: 25 Jul 2014, 10:05 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 27 Dec 2011, 08:53
Posts: 14816
Location: Russia
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.

_________________
i5-4690k, 16Gb RAM, GTX 1060 6Gb, X-Fi Titanium, Win7 x128
I am INFP, not the brutal, godamnit.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group