Emphasize LUT (background color grading)
- Cul
- Topic Author
Less
More
4 years 3 months ago - 4 years 3 months ago #1
by Cul
Emphasize LUT (background color grading) was created by Cul
Hello. Hope you have a good year.
Emphasize.fx uses depth to select everything but the subject and then desaturate it. I was wondering, would it be possible to use a LUT instead?
For example in this game, the gray is what Emphasize touches, which can be closer or further apart.
In PS terms, it would be like always having a "mask" for the background, with any color correction you want in the LUT. Very powerful, I think. For "local contrast," when something looks "nicer" if everything around looks dull. Maybe what Otis had in mind.
Any help is appreciated, and again, hope you enjoy 2020.
This was the code for Emphasize.fx
And for instance this one applies a LUT based on Luma, so if the game had clear night/day differences you could have two LUTs.
And I saw a LUT.fx with even a LUT selector.
Emphasize.fx uses depth to select everything but the subject and then desaturate it. I was wondering, would it be possible to use a LUT instead?
For example in this game, the gray is what Emphasize touches, which can be closer or further apart.
In PS terms, it would be like always having a "mask" for the background, with any color correction you want in the LUT. Very powerful, I think. For "local contrast," when something looks "nicer" if everything around looks dull. Maybe what Otis had in mind.
Any help is appreciated, and again, hope you enjoy 2020.
This was the code for Emphasize.fx
Warning: Spoiler!
//////////////////////////////////////////////////////////////////
// This effect works like a simple DoF for desaturating what otherwise would have been blurred.
//
// It works by determining whether a pixel is outside the emphasize zone using the depth buffer
// if so, the pixel is desaturated and blended with the color specified in the cfg file.
///////////////////////////////////////////////////////////////////
// Main shader by Otis / Infuse Project
// 3D emphasis code by SirCobra.
///////////////////////////////////////////////////////////////////
uniform float FocusDepth <
ui_type = "slider";
ui_min = 0.000; ui_max = 1.000;
ui_step = 0.001;
ui_tooltip = "Manual focus depth of the point which has the focus. Range from 0.0, which means camera is the focus plane, till 1.0 which means the horizon is focus plane.";
> = 0.026;
uniform float FocusRangeDepth <
ui_type = "slider";
ui_min = 0.0; ui_max = 1.000;
ui_step = 0.001;
ui_tooltip = "The depth of the range around the manual focus depth which should be emphasized. Outside this range, de-emphasizing takes place";
> = 0.001;
uniform float FocusEdgeDepth <
ui_type = "slider";
ui_min = 0.000; ui_max = 1.000;
ui_tooltip = "The depth of the edge of the focus range. Range from 0.00, which means no depth, so at the edge of the focus range, the effect kicks in at full force,\ntill 1.00, which means the effect is smoothly applied over the range focusRangeEdge-horizon.";
ui_step = 0.001;
> = 0.050;
uniform bool Spherical <
ui_tooltip = "Enables Emphasize in a sphere around the focus-point instead of a 2D plane";
> = false;
uniform int Sphere_FieldOfView <
ui_type = "slider";
ui_min = 1; ui_max = 180;
ui_tooltip = "Specifies the estimated Field of View you are currently playing with. Range from 1, which means 1 Degree, till 180 which means 180 Degree (half the scene).\nNormal games tend to use values between 60 and 90.";
> = 75;
uniform float Sphere_FocusHorizontal <
ui_type = "slider";
ui_min = 0; ui_max = 1;
ui_tooltip = "Specifies the location of the focuspoint on the horizontal axis. Range from 0, which means left screen border, till 1 which means right screen border.";
> = 0.5;
uniform float Sphere_FocusVertical <
ui_type = "slider";
ui_min = 0; ui_max = 1;
ui_tooltip = "Specifies the location of the focuspoint on the vertical axis. Range from 0, which means upper screen border, till 1 which means bottom screen border.";
> = 0.5;
uniform float3 BlendColor <
ui_type = "color";
ui_tooltip = "Specifies the blend color to blend with the greyscale. in (Red, Green, Blue). Use dark colors to darken further away objects";
> = float3(0.0, 0.0, 0.0);
uniform float BlendFactor <
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_tooltip = "Specifies the factor BlendColor is blended. Range from 0.0, which means full greyscale, till 1.0 which means full blend of the BlendColor";
> = 0.0;
uniform float EffectFactor <
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_tooltip = "Specifies the factor the desaturation is applied. Range from 0.0, which means the effect is off (normal image), till 1.0 which means the desaturated parts are\nfull greyscale (or color blending if that's enabled)";
> = 0.9;
#include "Reshade.fxh"
#ifndef M_PI
#define M_PI 3.1415927
#endif
float CalculateDepthDiffCoC(float2 texcoord : TEXCOORD)
{
const float scenedepth = ReShade::GetLinearizedDepth(texcoord);
const float scenefocus = FocusDepth;
const float desaturateFullRange = FocusRangeDepth+FocusEdgeDepth;
float depthdiff;
if(Spherical == true)
{
texcoord.x = (texcoord.x-Sphere_FocusHorizontal)*ReShade::ScreenSize.x;
texcoord.y = (texcoord.y-Sphere_FocusVertical)*ReShade::ScreenSize.y;
const float degreePerPixel = Sphere_FieldOfView / ReShade::ScreenSize.x;
const float fovDifference = sqrt((texcoord.x*texcoord.x)+(texcoord.y*texcoord.y))*degreePerPixel;
depthdiff = sqrt((scenedepth*scenedepth)+(scenefocus*scenefocus)-(2*scenedepth*scenefocus*cos(fovDifference*(2*M_PI/360))));
}
else
{
depthdiff = abs(scenedepth-scenefocus);
}
if (depthdiff > desaturateFullRange)
return saturate(1.0);
else
return saturate(smoothstep(0, desaturateFullRange, depthdiff));
}
void PS_Otis_EMZ_Desaturate(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 outFragment : SV_Target)
{
const float depthDiffCoC = CalculateDepthDiffCoC(texcoord.xy);
const float4 colFragment = tex2D(ReShade::BackBuffer, texcoord);
const float greyscaleAverage = (colFragment.x + colFragment.y + colFragment.z) / 3.0;
float4 desColor = float4(greyscaleAverage, greyscaleAverage, greyscaleAverage, depthDiffCoC);
desColor = lerp(desColor, float4(BlendColor, depthDiffCoC), BlendFactor);
outFragment = lerp(colFragment, desColor, saturate(depthDiffCoC * EffectFactor));
}
technique Emphasize
{
pass
{
VertexShader = PostProcessVS;
PixelShader = PS_Otis_EMZ_Desaturate;
}
}
And for instance this one applies a LUT based on Luma, so if the game had clear night/day differences you could have two LUTs.
Warning: Spoiler!
/**
* Adaptive Color Grading
* Runs two LUTs simultaneously, smoothly lerping between them based on luma.
* By moriz1
* Original LUT shader by Marty McFly
*/
#ifndef fLUT_TextureDay
#define fLUT_TextureDay "lutDAY.png"
#endif
#ifndef fLUT_TextureNight
#define fLUT_TextureNight "lutNIGHT.png"
#endif
#ifndef fLUT_TileSizeXY
#define fLUT_TileSizeXY 64
#endif
#ifndef fLUT_TileAmount
#define fLUT_TileAmount 64
#endif
uniform bool DebugLuma <
ui_label = "Show Luma Debug Bars";
ui_tooltip = "Draws debug bars on top left of screen";
> = false;
uniform bool DebugLumaOutput <
ui_label = "Show Luma Output";
ui_tooltip = "Black/White blurry mode!";
> = false;
uniform bool DebugLumaOutputHQ <
ui_label = "Show Luma Output at Native Resolution";
ui_tooltip = "Black/White mode!";
> = false;
uniform bool EnableHighlightsInDarkScenes <
ui_label = "Enable Highlights";
ui_tooltip = "Add highlights to bright objects when in dark scenes";
> = true;
uniform bool DebugHighlights <
ui_label = "Show Debug Highlights";
ui_tooltip = "If any highlights are in the frame, this colours them magenta";
> = false;
uniform float LumaChangeSpeed <
ui_label = "Adaptation Speed";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_step = 0.001;
> = 0.05;
uniform float LumaHigh <
ui_label = "Luma Max Threshold";
ui_tooltip = "Luma above this level uses full Daytime LUT\nSet higher than Min Threshold";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_step = 0.001;
> = 0.75;
uniform float LumaLow <
ui_label = "Luma Min Threshold";
ui_tooltip = "Luma below this level uses full NightTime LUT\nSet lower than Max Threshold";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_step = 0.001;
> = 0.2;
uniform float AmbientHighlightThreshold <
ui_label = "Low Luma Highlight Start";
ui_tooltip = "If average luma falls below this limit, start adding highlights\nSimulates HDR look in low light";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_step = 0.001;
> = 0.5;
uniform float HighlightThreshold <
ui_label = "Minimum Luma For Highlights";
ui_tooltip = "Any luma value above this will have highlights\nSimulates HDR look in low light";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_step = 0.001;
> = 0.5;
uniform float HighlightMaxThreshold <
ui_label = "Max Luma For Highlights";
ui_tooltip = "Highlights reach maximum strength at this luma value\nSimulates HDR look in low light";
ui_type = "slider";
ui_min = 0.0; ui_max = 1.0;
ui_step = 0.001;
> = 0.8;
#include "ReShade.fxh"
texture LumaInputTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = R8; MipLevels = 6; };
sampler LumaInputSampler { Texture = LumaInputTex; MipLODBias = 6.0f; };
sampler LumaInputSamplerHQ { Texture = LumaInputTex; };
texture LumaTex { Width = 1; Height = 1; Format = R8; };
sampler LumaSampler { Texture = LumaTex; };
texture LumaTexLF { Width = 1; Height = 1; Format = R8; };
sampler LumaSamplerLF { Texture = LumaTexLF; };
texture texLUTDay < source = fLUT_TextureDay; > { Width = fLUT_TileSizeXY*fLUT_TileAmount; Height = fLUT_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTDay { Texture = texLUTDay; };
texture texLUTNight < source = fLUT_TextureNight; > { Width = fLUT_TileSizeXY*fLUT_TileAmount; Height = fLUT_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTNight { Texture = texLUTNight; };
float SampleLuma(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target {
float luma = 0.0;
const int width = BUFFER_WIDTH / 64;
const int height = BUFFER_HEIGHT / 64;
for (int i = width/3; i < 2*width/3; i++) {
for (int j = height/3; j < 2*height/3; j++) {
luma += tex2Dlod(LumaInputSampler, float4(i, j, 0, 6)).x;
}
}
luma /= (width * 1/3) * (height * 1/3);
const float lastFrameLuma = tex2D(LumaSamplerLF, float2(0.5, 0.5)).x;
return lerp(lastFrameLuma, luma, LumaChangeSpeed);
}
float LumaInput(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target {
const float3 color = tex2D(ReShade::BackBuffer, texcoord).xyz;
return pow(abs((color.r*2 + color.b + color.g*3) / 6), 1/2.2);
}
float3 ApplyLUT(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target {
float3 color = tex2D(ReShade::BackBuffer, texcoord.xy).rgb;
const float lumaVal = tex2D(LumaSampler, float2(0.5, 0.5)).x;
const float highlightLuma = tex2D(LumaInputSamplerHQ, texcoord.xy).x;
if (DebugLumaOutputHQ) {
return highlightLuma;
}
else if (DebugLumaOutput) {
return lumaVal;
}
if (DebugLuma) {
if (texcoord.y <= 0.01 && texcoord.x <= 0.01) {
return lumaVal;
}
if (texcoord.y <= 0.01 && texcoord.x > 0.01 && texcoord.x <= 0.02) {
if (lumaVal > LumaHigh) {
return float3(1.0, 1.0, 1.0);
}
else {
return float3(0.0, 0.0, 0.0);
}
}
if (texcoord.y <= 0.01 && texcoord.x > 0.02 && texcoord.x <= 0.03) {
if (lumaVal <= LumaHigh && lumaVal >= LumaLow) {
return float3(1.0, 1.0, 1.0);
}
else {
return float3(0.0, 0.0, 0.0);
}
}
if (texcoord.y <= 0.01 && texcoord.x > 0.03 && texcoord.x <= 0.04) {
if (lumaVal < LumaLow) {
return float3(1.0, 1.0, 1.0);
}
else {
return float3(0.0, 0.0, 0.0);
}
}
}
float2 texelsize = 1.0 / fLUT_TileSizeXY;
texelsize.x /= fLUT_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 color1 = lerp(tex2D(SamplerLUTDay, lutcoord.xy).xyz, tex2D(SamplerLUTDay, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
const float3 color2 = lerp(tex2D(SamplerLUTNight, lutcoord.xy).xyz, tex2D(SamplerLUTNight, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
const float range = (lumaVal - LumaLow)/(LumaHigh - LumaLow);
if (lumaVal > LumaHigh) {
color.xyz = color1.xyz;
}
else if (lumaVal < LumaLow) {
color.xyz = color2.xyz;
}
else {
color.xyz = lerp(color2.xyz, color1.xyz, range);
}
float3 lutcoord2 = float3((color.xy*fLUT_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_TileSizeXY-color.z);
const float lerpfact2 = frac(lutcoord2.z);
lutcoord2.x += (lutcoord2.z-lerpfact2)*texelsize.y;
const float3 highlightColor = lerp(tex2D(SamplerLUTDay, lutcoord2.xy).xyz, tex2D(SamplerLUTDay, float2(lutcoord2.x+texelsize.y,lutcoord2.y)).xyz,lerpfact2);
//apply highlights
if (EnableHighlightsInDarkScenes) {
if (lumaVal < AmbientHighlightThreshold && highlightLuma > HighlightThreshold) {
const float range = saturate((highlightLuma - HighlightThreshold)/(HighlightMaxThreshold - HighlightThreshold)) *
saturate((AmbientHighlightThreshold - lumaVal)/(0.1));
if (DebugHighlights) {
color.xyz = lerp(color.xyz, float3(1.0, 0.0, 1.0), range);
if (range >= 1.0) {
color.xyz = float3(1.0, 0.0, 0.0);
}
}
color.xyz = lerp(color.xyz, highlightColor.xyz, range);
}
}
return color;
}
float SampleLumaLF(float4 position : SV_Position, float2 texcoord: TexCoord) : SV_Target {
return tex2D(LumaSampler, float2(0.5, 0.5)).x;
}
technique AdaptiveColorGrading {
pass Input {
VertexShader = PostProcessVS;
PixelShader = LumaInput;
RenderTarget = LumaInputTex
;
}
pass StoreLuma {
VertexShader = PostProcessVS;
PixelShader = SampleLuma;
RenderTarget = LumaTex;
}
pass Apply_LUT {
VertexShader = PostProcessVS;
PixelShader = ApplyLUT;
}
pass StoreLumaLF {
VertexShader = PostProcessVS;
PixelShader = SampleLumaLF;
RenderTarget = LumaTexLF;
}
}
And I saw a LUT.fx with even a LUT selector.
Warning: Spoiler!
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ReShade effect file
// visit facebook.com/MartyMcModding for news/updates
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Marty's LUT shader 1.0 for ReShade 3.0
// Copyright © 2008-2016 Marty McFly
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// lut_ninjafadaGameplay.png was provided by ninjafada!
// You can see their ReShade-related work here: http://sfx.thelazy.net/users/u/ninjafada/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// lut_Sleepy.png was provided by Sleeps_Hungry!
// You can find them here: https://twitter.com/advent1013
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// lut_Feli.png was provided by Feli!
// You can find them here: https://twitter.com/ffxivfeli
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Lightly optimized by Marot Satil for the GShade project.
#ifndef fLUT_TextureName
#define fLUT_TextureName "lut_GShade.png" // Add your own LUT file to \reshade-shaders\Textures\ and provide the new file name in quotes to change the LUT used! This one uses 32 tiles at 32px.
#endif
#ifndef fLUT_TileSizeXY
#define fLUT_TileSizeXY 32
#endif
#ifndef fLUT_TileAmount
#define fLUT_TileAmount 32
#endif
#ifndef fLUT_W_TextureName
#define fLUT_W_TextureName "lut_warm.png" // Add your own LUT file to \reshade-shaders\Textures\ and provide the new file name in quotes to change the LUT used! This one uses 64 tiles at 64px.
#endif
#ifndef fLUT_W_TileSizeXY
#define fLUT_W_TileSizeXY 64
#endif
#ifndef fLUT_W_TileAmount
#define fLUT_W_TileAmount 64
#endif
#ifndef fLUT_A_TextureName
#define fLUT_A_TextureName "lut.png" // Add your own LUT file to \reshade-shaders\Textures\ and provide the new file name in quotes to change the LUT used! This one uses 32 tiles at 32px.
#endif
#ifndef fLUT_NFG_TextureName
#define fLUT_NFG_TextureName "lut_ninjafadaGameplay.png" // Add your own LUT file to \reshade-shaders\Textures\ and provide the new file name in quotes to change the LUT used! This one uses 32 tiles at 32px.
#endif
#ifndef fLUT_RS_TextureName
#define fLUT_RS_TextureName "lut_ReShade.png" // Add your own LUT file to \reshade-shaders\Textures\ and provide the new file name in quotes to change the LUT used! This one uses 32 tiles at 32px.
#endif
#ifndef fLUT_SL_TextureName
#define fLUT_SL_TextureName "lut_Sleepy.png" // Add your own LUT file to \reshade-shaders\Textures\ and provide the new file name in quotes to change the LUT used! This one uses 64 tiles at 64px.
#endif
#ifndef fLUT_FE_TextureName
#define fLUT_FE_TextureName "lut_Feli.png" // Add your own LUT file to \reshade-shaders\Textures\ and provide the new file name in quotes to change the LUT used! This one uses 32 tiles at 32px.
#endif
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
uniform int fLUT_Selector <
ui_type = "combo";
ui_items = "GShade/Angelite\0LUT - Warm.fx\0Autumn\0ninjafada Gameplay\0ReShade 3/4\0Sleeps_Hungry\0Feli\0";
ui_label = "The LUT file to use.";
ui_tooltip = "Set this to whichever your preset requires!";
> = 0;
uniform float fLUT_AmountChroma <
ui_type = "slider";
ui_min = 0.00; ui_max = 1.00;
ui_label = "LUT chroma amount";
ui_tooltip = "Intensity of color/chroma change of the LUT.";
> = 1.00;
uniform float fLUT_AmountLuma <
ui_type = "slider";
ui_min = 0.00; ui_max = 1.00;
ui_label = "LUT luma amount";
ui_tooltip = "Intensity of luma change of the LUT.";
> = 1.00;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "ReShade.fxh"
texture texLUT < source = fLUT_TextureName; > { Width = fLUT_TileSizeXY*fLUT_TileAmount; Height = fLUT_TileSizeXY; Format = RGBA8; };
sampler SamplerLUT { Texture = texLUT; };
texture texLUTwarm < source = fLUT_W_TextureName; > { Width = fLUT_W_TileSizeXY*fLUT_W_TileAmount; Height = fLUT_W_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTwarm { Texture = texLUTwarm; };
texture texLUTautumn < source = fLUT_A_TextureName; > { Width = fLUT_TileSizeXY*fLUT_TileAmount; Height = fLUT_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTautumn { Texture = texLUTautumn; };
texture texLUTNFG < source = fLUT_NFG_TextureName; > { Width = fLUT_TileSizeXY*fLUT_TileAmount; Height = fLUT_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTNFG { Texture = texLUTNFG; };
texture texLUTRS < source = fLUT_RS_TextureName; > { Width = fLUT_TileSizeXY*fLUT_TileAmount; Height = fLUT_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTRS { Texture = texLUTRS; };
texture texLUTSL < source = fLUT_SL_TextureName; > { Width = fLUT_W_TileSizeXY*fLUT_W_TileAmount; Height = fLUT_W_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTSL { Texture = texLUTSL; };
texture texLUTFE < source = fLUT_FE_TextureName; > { Width = fLUT_TileSizeXY*fLUT_TileAmount; Height = fLUT_TileSizeXY; Format = RGBA8; };
sampler SamplerLUTFE { Texture = texLUTFE; };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void PS_LUT_Apply(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 res : SV_Target0)
{
float4 color = tex2D(ReShade::BackBuffer, texcoord.xy);
//Default ReShade 3-4 LUT
if (fLUT_Selector == 0)
{
float2 texelsize = 1.0 / fLUT_TileSizeXY;
texelsize.x /= fLUT_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 lutcolor = lerp(tex2D(SamplerLUT, lutcoord.xy).xyz, tex2D(SamplerLUT, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
color.xyz = lerp(normalize(color.xyz), normalize(lutcolor.xyz), fLUT_AmountChroma) *
lerp(length(color.xyz), length(lutcolor.xyz), fLUT_AmountLuma);
res.xyz = color.xyz;
res.w = 1.0;
}
//LUT from LUT - Warm.fx
else if (fLUT_Selector == 1)
{
float2 texelsize = 1.0 / fLUT_W_TileSizeXY;
texelsize.x /= fLUT_W_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_W_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_W_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 lutcolor = lerp(tex2D(SamplerLUTwarm, lutcoord.xy).xyz, tex2D(SamplerLUTwarm, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
color.xyz = lerp(normalize(color.xyz), normalize(lutcolor.xyz), fLUT_AmountChroma) *
lerp(length(color.xyz), length(lutcolor.xyz), fLUT_AmountLuma);
res.xyz = color.xyz;
res.w = 1.0;
}
//MS Autumn LUT
else if (fLUT_Selector == 2)
{
float2 texelsize = 1.0 / fLUT_TileSizeXY;
texelsize.x /= fLUT_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 lutcolor = lerp(tex2D(SamplerLUTautumn, lutcoord.xy).xyz, tex2D(SamplerLUTautumn, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
color.xyz = lerp(normalize(color.xyz), normalize(lutcolor.xyz), fLUT_AmountChroma) *
lerp(length(color.xyz), length(lutcolor.xyz), fLUT_AmountLuma);
res.xyz = color.xyz;
res.w = 1.0;
}
//ninjafada Gameplay LUT
else if (fLUT_Selector == 3)
{
float2 texelsize = 1.0 / fLUT_TileSizeXY;
texelsize.x /= fLUT_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 lutcolor = lerp(tex2D(SamplerLUTNFG, lutcoord.xy).xyz, tex2D(SamplerLUTNFG, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
color.xyz = lerp(normalize(color.xyz), normalize(lutcolor.xyz), fLUT_AmountChroma) *
lerp(length(color.xyz), length(lutcolor.xyz), fLUT_AmountLuma);
res.xyz = color.xyz;
res.w = 1.0;
}
else if (fLUT_Selector == 4)
{
float2 texelsize = 1.0 / fLUT_TileSizeXY;
texelsize.x /= fLUT_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 lutcolor = lerp(tex2D(SamplerLUTRS, lutcoord.xy).xyz, tex2D(SamplerLUTRS, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
color.xyz = lerp(normalize(color.xyz), normalize(lutcolor.xyz), fLUT_AmountChroma) *
lerp(length(color.xyz), length(lutcolor.xyz), fLUT_AmountLuma);
res.xyz = color.xyz;
res.w = 1.0;
}
else if (fLUT_Selector == 5)
{
float2 texelsize = 1.0 / fLUT_W_TileSizeXY;
texelsize.x /= fLUT_W_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_W_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_W_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 lutcolor = lerp(tex2D(SamplerLUTSL, lutcoord.xy).xyz, tex2D(SamplerLUTSL, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
color.xyz = lerp(normalize(color.xyz), normalize(lutcolor.xyz), fLUT_AmountChroma) *
lerp(length(color.xyz), length(lutcolor.xyz), fLUT_AmountLuma);
res.xyz = color.xyz;
res.w = 1.0;
}
else
{
float2 texelsize = 1.0 / fLUT_TileSizeXY;
texelsize.x /= fLUT_TileAmount;
float3 lutcoord = float3((color.xy*fLUT_TileSizeXY-color.xy+0.5)*texelsize.xy,color.z*fLUT_TileSizeXY-color.z);
const float lerpfact = frac(lutcoord.z);
lutcoord.x += (lutcoord.z-lerpfact)*texelsize.y;
const float3 lutcolor = lerp(tex2D(SamplerLUTFE, lutcoord.xy).xyz, tex2D(SamplerLUTFE, float2(lutcoord.x+texelsize.y,lutcoord.y)).xyz,lerpfact);
color.xyz = lerp(normalize(color.xyz), normalize(lutcolor.xyz), fLUT_AmountChroma) *
lerp(length(color.xyz), length(lutcolor.xyz), fLUT_AmountLuma);
res.xyz = color.xyz;
res.w = 1.0;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
technique LUT
{
pass LUT_Apply
{
VertexShader = PostProcessVS;
PixelShader = PS_LUT_Apply;
}
}
Last edit: 4 years 3 months ago by Cul.
Please Log in or Create an account to join the conversation.
- originalnicodr
Less
More
4 years 2 months ago #2
by originalnicodr
Replied by originalnicodr on topic Emphasize LUT (background color grading)
You could try using the CanvasMasking shader i did to mask any lut you want using the emphasize-type fog
reshade.me/forum/shader-presentation/619...king-and-other-stuff
reshade.me/forum/shader-presentation/619...king-and-other-stuff
The following user(s) said Thank You: Cul
Please Log in or Create an account to join the conversation.