Please use english language
It is currently 30 Apr 2017, 16:43

All times are UTC





Post new topic Reply to topic  [ 23 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: 377
Location: Ottawa, Canada
Sweet, thank you.

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

Flickr Gallery


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

Joined: 05 Jan 2016, 08:14
Posts: 17
I've slightly edited this so it doesn't have redundant info in it.
But before going on, thank you kingeric1992 for reading my original blurb, and then updating your original post with new code. Now I just need to figure out how to implement it... :lol:

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

I noticed it would probably be better with a LUT for Day, Night, and Interior. So, I read tktk's page and then tried (several times, several different ways) to implement his code, which was based directly on kingeric1992's original (pre-updated) LUT code. As at least one other member noted, it just didn't work. I figured out why: you have to delete and replace, or add to, the original enb texture reference (_s7). Then, after adding some relevant lines and cleaning up a bunch of weirdness in the code you copy-n-paste from tktk's page (I think it was the web page that mucked things up), the enbeffect.fx file will once again show up in the enb gui.

This is what I've done thus far:

Replaced original code:
Code:
texture2D texs7;//palette enb


With this - it was necessary or the enbeffect.fx file won't load:
Code:
texture2D texs7 <string ResourceName="enbpalette_d.bmp";>;   //CLuT Day Palette


I then added the following to define the night and interior palettes:
Code:
texture2D texs8 <string ResourceName="enbpalette_n.bmp";>;   //CLuT Night Palette
texture2D texs9 <string ResourceName="enbpalette_i.bmp";>;   //CLuT Interior Palette


And their relevant samplers (simple enough with a copy-paste and quick edit)
Code:
sampler2D _s8 = sampler_state
{
   Texture   = <texs8>;
   MinFilter = LINEAR;
   MagFilter = LINEAR;
   MipFilter = NONE;
   AddressU  = Clamp;
   AddressV  = Clamp;
   SRGBTexture=FALSE;
   MaxMipLevel=0;
   MipMapLodBias=0;
};

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


I then cleaned up and changed a few things in tktk's code, which he based on kingeric1992's original code:
Code:
#ifdef E_CC_PALETTE
   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;

   float3 CLuTD;
   float3 CLuTD2;
   float3 CLuTN;
   float3 CLuTN2;
   float3 CLuTI;
   float3 CLuTI2;
   float3 CLuTA;
   float3 CLuTA2;

   CLuTD.rgb = tex2Dlod(_s7, CLut_UV.xyzz).rgb;
   CLuD2 = tex2Dlod(_s7, CLut_UV.xyzz + float4(CLut_pSize.y, 0, 0, 0)).rgb;

   CLuTN = tex2Dlod(_s8, CLut_UV.xyzz).rgb;
   CLuTN2 = tex2Dlod(_s8, CLut_UV.xyzz + float4(CLut_pSize.y, 0, 0, 0)).rgb;

   CLuTI = tex2Dlod(_s9, CLut_UV.xyzz).rgb;
   CLuTI2 = tex2Dlod(_s9, CLut_UV.xyzz + float4(CLut_pSize.y, 0, 0, 0)).rgb;

   CLuTA.rgb = lerp( lerp(LUTN.rgb, LUTD.rgb, ENightDayFactor), LUTI.rgb, EInteriorFactor);
   CLuTA2.rgb = lerp( lerp(LUTN2.rgb, LUTD2.rgb, ENightDayFactor), LUTI2.rgb, EInteriorFactor);

   color.rgb  = lerp(CLuTA.rgb, CLuTA2.rgb, color.b - CLut_UV.w);
#endif


Once done, the enbeffect.fx file loaded and is being read. Sort of.

I say "sort of" because now no adjustment to any of the LUTs render in-game. I'd like to finish this and figure out why, so if anyone can explain I'd really appreciate it. I know the original code has been updated, but this is just something I'm trying to figure out and I'm stumped.

Thanks all!


Last edited by Visitant on 07 Dec 2016, 23:45, edited 1 time 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: 471
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  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 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