Please use english language
It is currently 14 Dec 2017, 22:46

All times are UTC





Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 17 Jan 2016, 22:36 
Offline
User avatar

Joined: 04 Jan 2016, 14:59
Posts: 18
Thanks for your fast answer kingeric!

The "problem" I have is that I've implemented your 3DLUT code through JawZ modular shader library and the DNI separation mentioned earlier. What I'm planning to do is to switch the 3 textures (D, N, I) independently ingame (didn't mention that, sorry).

I might be wrong with the following statement: using techniques would not only require to implement the code directly without helper files but also to set up techniques with numerous combinations of those three textures. I'm planning to start off with 10 textures to choose from, which leads to n!/((n-k)!*k!)= 120 sets of techniques if I want to have the maximum of combinations to choose from.

I've never seen this, but having a dropdown list for D, N, I 3DLUT texture, each with 10 textures to choose from would be the most convenient way.


Top
 Profile  
 
Tomoko
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 18 Jan 2016, 01:03 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 499
Location: Taiwan
then do this instead. you would need to combine your textures into texture atlas. so for DNI, you would end up with 3 of this.
Image ( by MS paint)

UI:
Code:
int   lut_D <   string UIName="lut_D";   float UIMin=0;   float UIMax=9;> = {0};
int   lut_N <   string UIName="lut_N";   float UIMin=0;   float UIMax=9;> = {0};
int   lut_I <   string UIName="lut_I";   float UIMin=0;   float UIMax=9;> = {0};

resources:
Code:
Texture2D          LUTtex_D< string UIName = "3DLut0";  string ResourceName = "LUTtex_D.png"; >; //day
Texture2D          LUTtex_N< string UIName = "3DLut0";  string ResourceName = "LUTtex_N.png"; >; //night
Texture2D          LUTtex_I< string UIName = "3DLut0";  string ResourceName = "LUTtex_I.png"; >; // interior

Code:
if(enablelut)
{
    float2 CLut_pSize = {0.00390625, 0.0625};// 1 / float2(256, 16)
    color.rgb         = saturate(color.rgb) * 15;
   
    float3 CLut_UV;   
    CLut_UV.z = floor(color.z);
    color.z  -= CLut_UV.z;
    color.xy  = (color.xy + 0.5) * CLut_pSize;
    color.x  += CLut_UV.z * CLut_pSize.y;
    color.y  *= 0.1; // 1 / 10

    CLut_UV.x = color.x;
    CLut_UV.z = CLut_UV.x + CLut_pSize.y;
    CLut_UV.y = color.y + lut_D * 0.1;
    float3 lutcolor_D = lerp(LUTtex_D.SampleLevel(Sampler1, CLut_UV.xy, 0).rgb, LUTtex_D.SampleLevel(Sampler1, CLut_UV.zy, 0).rgb, color.z);
    CLut_UV.y = color.y + lut_N * 0.1;
    float3 lutcolor_N = lerp(LUTtex_N.SampleLevel(Sampler1, CLut_UV.xy, 0).rgb, LUTtex_N.SampleLevel(Sampler1, CLut_UV.zy, 0).rgb, color.z);
    CLut_UV.y = color.y + lut_I * 0.1;
    float3 lutcolor_I = lerp(LUTtex_I.SampleLevel(Sampler1, CLut_UV.xy, 0).rgb, LUTtex_I.SampleLevel(Sampler1, CLut_UV.zy, 0).rgb, color.z);

    color.rgb         = lerp(lerp( lutcolor_N, lutcolor_D, ENightDayFactor), lutcolor_I, EInteriorFactor);
}

_________________
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: 18 Jan 2016, 17:46 
Offline
User avatar

Joined: 04 Jan 2016, 14:59
Posts: 18
Now that looks neat! Thanks alot! I'm going to test it rightaway.

Works like a charm! Implemented it straightaway for my OLYMPUS preset.


Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 23 Jan 2016, 22:07 
Offline
*master*

Joined: 18 Mar 2015, 18:39
Posts: 167
Awesome job, but can 4096 x 64 LUT be supported? It would be more accurate than 256 x 16, which is important for those who would use this feature to calibrate their display.

_________________
i7 3770K @ 4.8Ghz | P8Z77-V Pro | Corsair 16GB @ 2200Mhz | GTX 1080 @ 2100/11000Mhz | Xonar DGX | Sennheiser HD-280 Pro | 768GB SSD | 2TB HDD | Corsair 850W | Eizo Foris FG2421 1080p Turbo 240 MVA | Logitech G402 | Razer BlackWidow | Windows 10 Pro


Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 24 Jan 2016, 00:14 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 499
Location: Taiwan
Code:
//dx10/11
    float2 CLut_pSize =  1 / float2(4096, 64);
    color.rgb  = saturate(color.rgb) * 63;
    float4 CLut_UV;
    CLut_UV.w  = floor(color.b);
    CLut_UV.xy = (color.rg + 0.5) * CLut_pSize;
    CLut_UV.x += CLut_UV.w * CLut_pSize.y;
    CLut_UV.z  = CLut_UV.x + CLut_pSize.y;
    color.rgb  = lerp(LUTtex.SampleLevel(Sampler1, CLut_UV.xy, 0).rgb, LUTtex.SampleLevel(Sampler1, CLut_UV.zy, 0).rgb, color.b - CLut_UV.w);

if possible, can you upload a comparison shot on 16 vs 64 ?

_________________
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: 24 Jan 2016, 09:40 
Offline
User avatar

Joined: 04 Jan 2016, 14:59
Posts: 18
MonarchX wrote:
Awesome job, but can 4096 x 64 LUT be supported? It would be more accurate than 256 x 16, which is important for those who would use this feature to calibrate their display.


Could you upload your neutral 4096 x 64 LUT for testing? If there's a noticeable effect I'd like to implement that too.


Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 31 Jan 2016, 17:44 
Offline
User avatar

Joined: 04 Jan 2016, 14:59
Posts: 18
The difference between 4096x64 to 256x16 is pretty subtle (at least for me). The difference is visible if you blend two screenhots with "difference" in photoshop. Seems like edges are affected especially.

256x16
4096x64
difference


Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 31 Jan 2016, 20:15 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 499
Location: Taiwan
Thanks.

the difference will be more visible if there are drastic change applied on LUT.
It use linear interpolation where the texture scale represent total segment count.
the larger the scale, the more detailed manipulation can be preserved in lut texture.

_________________
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: 31 Oct 2016, 21:40 
Offline
*sensei*
User avatar

Joined: 03 Oct 2012, 06:12
Posts: 379
Location: Ottawa, Canada
Is there code to tie in adaptation/brightness (much like how Palette has adaptation/brightness) to the LUT shader?

_________________
Iɴᴛᴇʟ Cᴏʀᴇ ɪ₇ ₈₇₀₀K ﹫₄.₅GHᴢ | MSI Z₃₇₀ Gᴀᴍɪɴɢ Pʀᴏ Cᴀʀʙᴏɴ | ₂x NVIDIA ﹣ EVGA GTX ₁₀₈₀Tɪ ɪCX | ₃₂GB DDR₄ Cᴏɴsᴀɪʀ Vᴇɴɢᴇᴀɴᴄᴇ LPX ﹫₃₂₀₀Mʜᴢ | Wᴇsᴛᴇʀɴ Dɪɢɪᴛᴀʟ Bʟᴀᴄᴋ ₄TB HDD﹐ Sᴀᴍsᴜɴɢ ₈₅₀ EVO ₅₁₂GB SSD

Flickr Gallery


Top
 Profile  
 
 Post subject: Re: [HLSL CODE] 3D LUT
PostPosted: 31 Oct 2016, 23:28 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 499
Location: Taiwan
You can use both of them at the same time, just add the 3dlut part after enbpalette.

Here is the code to load additional texture
Code:
texture2D 3dlut < string ResourceName="lutname.png"; >;
sampler2D 3dlutSampler = sampler_state
{
    Texture = <3dlut>;
    AddressU  = Clamp;
    AddressV  = Clamp;
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = NONE;
    MaxMipLevel  = 0;
    MipMapLodBias  = 0;
    SRGBTexture   =   FALSE;
};


And replace the "_s7" in LUT code with 3dlutSampler.

_________________
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  [ 25 posts ]  Go to page Previous  1, 2, 3  Next

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