Please use english language
It is currently 21 Sep 2017, 17:40

All times are UTC




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 01 Nov 2016, 17:25 
Offline
*sensei*
User avatar

Joined: 03 Oct 2012, 06:12
Posts: 379
Location: Ottawa, Canada
Sweet, thank you.

_________________
Intel Core i7 4790K @4.3GHz | MSI Z97 SLI Krait Edition Motherboard | 2x NVIDIA - EVGA GTX 1070 SuperClocked | 32GB DDR3 Consair Vengeance Memory @1866 MHz | Samsung 850 EVO 500GB SSD | Creative Sound Blaster X-Fi Titanium

Flickr Gallery


Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 07 Dec 2016, 01:28 
Offline
User avatar

Joined: 05 Jan 2016, 08:14
Posts: 25
I realize this is an old post, but I thought it nice to update it.

But before going on, thank you kingeric1992 for reading my original blurb, and then updating your original post with new code. Also, thank you TKTK for your original code, which I lightly modified for use in my own ENBs.

Now, here's a simple LUT code for day/night/interior that is light on modifications, and doesn't require helper functions. I'll see about adding a dense-packed, neutral LUT at a later date. Meanwhile, if you're interested in seeing what you can do with a DNI set of 256x256 palettes, check out my tutorial.

///======================////======================//

When customizing a LUT I noticed it would probably be better with a LUT for Day, Night, and Interior. Here's a simple way to do it (thanks, TKTK!):

In your textures section, add the following lines above texture2D texs7; -
Code:
texture2D texs5 < string ResourceName="enbpalette__.tga"; >;   //   ENB interior palette (Added.)
texture2D texs6 < string ResourceName="enbpalette_.tga"; >;    //   ENB night palette (Added.)


Note that texture2D texs7; defaults to enbpalette.*, where * can be a BMP, TGA, or PNG file. The added files can also be set to BMP and PNG by changing the suffix to designate the appropriate file type.

Next, add the following lines to the sampler section -
Code:
sampler2D _s5 = sampler_state
   {
      Texture = <texs5>;
      MinFilter = LINEAR;
      MagFilter = LINEAR;
      MipFilter = NONE;
      AddressU = Clamp;
      AddressV = Clamp;
      SRGBTexture = FALSE;
      MaxMipLevel = 0;
      MipMapLodBias = 0;
   };

sampler2D _s6 = sampler_state
   {
      Texture = <texs6>;
      MinFilter = LINEAR;
      MagFilter = LINEAR;
      MipFilter = NONE;
      AddressU = Clamp;
      AddressV = Clamp;
      SRGBTexture = FALSE;
      MaxMipLevel = 0;
      MipMapLodBias = 0;
   };


Finally, buzz down to the ENB palette section, and replace the original code with this:
Code:
#ifdef E_CC_PALETTE
   
   float3 CLuTD1;      // CLuT for Days
   float3 CLuTD2;
   
   float3 CLuTN1;      // CLuT for Nights
   float3 CLuTN2;
   
   float3 CLuTI1;      // CLuT for Interiors
   float3 CLuTI2;
   
   float3 CLuTA1;      // CLuT Averages
   float3 CLuTA2;
   
   
   float2 CLut_pSize   =   float2(0.00390625, 0.0625);      // 1 / float2(256, 16);
   color.rgb         =   saturate(color.rgb);
   color.b              *=   15;
   float4 CLut_UV      =   0;
   
        CLut_UV.w         =   floor(color.b);
   CLut_UV.xy         =   color.rg * 15 * CLut_pSize + 0.5 * CLut_pSize ;
   CLut_UV.x         +=   CLut_UV.w * CLut_pSize.y;
      
   CLuTD1.rgb         =   tex2Dlod(_s7, CLut_UV.xyzz).rgb;
   CLuTD2.rgb         =   tex2Dlod(_s7, CLut_UV.xyzz + float4(CLut_pSize.y, 0, 0, 0)).rgb;
   
   CLuTN1.rgb         =   tex2Dlod(_s6, CLut_UV.xyzz).rgb;
   CLuTN2.rgb         =   tex2Dlod(_s6, CLut_UV.xyzz + float4(CLut_pSize.y, 0, 0, 0)).rgb;
   
   CLuTI1.rgb         =   tex2Dlod(_s5, CLut_UV.xyzz).rgb;
   CLuTI2.rgb         =   tex2Dlod(_s5, CLut_UV.xyzz + float4(CLut_pSize.y, 0, 0, 0)).rgb;
   
   CLuTA1.rgb         =   lerp( lerp(CLuTN1.rgb, CLuTD1.rgb, ENightDayFactor), CLuTI1.rgb, EInteriorFactor);
   CLuTA2.rgb         =   lerp( lerp(CLuTN2.rgb, CLuTD2.rgb, ENightDayFactor), CLuTI2.rgb, EInteriorFactor);
   
   color.rgb         =   lerp(CLuTA1.rgb, CLuTA2.rgb, color.b - CLut_UV.w);

#endif //E_CC_PALETTE


Last edited by Visitant on 09 Jun 2017, 21:23, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 07 Dec 2016, 07:54 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 491
Location: Taiwan
Code:
Color --> color
I presume.

op updated for DNI example.

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 03 Jul 2017, 03:23 
Offline

Joined: 06 Jun 2017, 00:11
Posts: 6
nvm


Last edited by Simjedi on 05 Jul 2017, 12:27, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 03 Jul 2017, 22:53 
Offline

Joined: 06 Jun 2017, 00:11
Posts: 6
I would like to say I figured out. It's not pretty since I'm not a coder but it works....lol


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2, 3

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:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group