Can someone port details.yfx from freestyle to reshade
- 2mg
Less
More
6 months 4 weeks ago - 6 months 4 weeks ago #21
by 2mg
Replied by 2mg on topic Can someone port details.yfx from freestyle to reshade
So this .fxh with your above posted .fx files are ports?
Seems all work except Details.fx:
details.fx(139, 64): error X3004: undeclared identifier 'BUFFER_FORMAT'
details.fx(182, 58): error X3018: invalid subscript on array
YF's port does work though.
Seems all work except Details.fx:
details.fx(139, 64): error X3004: undeclared identifier 'BUFFER_FORMAT'
details.fx(182, 58): error X3018: invalid subscript on array
YF's port does work though.
Last edit: 6 months 4 weeks ago by 2mg.
Please Log in or Create an account to join the conversation.
- odikzz2
- Topic Author
Less
More
6 months 3 weeks ago - 6 months 3 weeks ago #22
by odikzz2
Replied by odikzz2 on topic Can someone port details.yfx from freestyle to reshade
Here.
Warning: Spoiler!
/**
Details filter from GeForce Experience. Provided by NVIDIA Corporation.
Copyright 2019 Suketu J. Shah. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ReShadeUI.fxh"
uniform float g_sldSharpen < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Sharpen";
ui_step = 0.001;
> = 0.5;
uniform float g_sldClarity < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "Clarity";
ui_step = 0.001;
> = 0.7;
uniform float g_sldHDR < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "HDR Toning";
ui_step = 0.001;
> = 0.6;
uniform float g_sldBloom < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Bloom";
ui_step = 0.001;
> = 0.15;
#include "NvCommon.fxh"
texture LargeBlurTex { Width = BUFFER_WIDTH*0.5; Height = BUFFER_HEIGHT*0.5; Format = RGBA16F; }; //requires recent changes to support this
sampler sLargeBlurTex { Texture = LargeBlurTex;};
float4 gaussian(sampler sinput, float2 uv, int nSteps, float2 axis)
{
float norm = -1.35914091423 / (nSteps * nSteps);
float4 accum = tex2D(sinput, uv) * 0.5;
float2 offsetinc = axis * BUFFER_PIXEL_SIZE;
float divisor = 0.5; //exp(0) * 0.5
[loop]
for(float iStep = 1; iStep <= nSteps; iStep++)
{
//linear sample, gathers 2 texels at once
//only texel not being sampled that way is center, hence it needs 1/2 the weight
float tapOffset = iStep * 2.0 - 0.5;
float tapWeight = exp(iStep * iStep * norm);
accum += tex2Dlod(sinput, float4(uv + offsetinc * tapOffset, 0, 0)) * tapWeight;
accum += tex2Dlod(sinput, float4(uv - offsetinc * tapOffset, 0, 0)) * tapWeight;
divisor += tapWeight;
}
accum /= 2.0 * divisor;
return accum;
}
float4 box(sampler sinput, float2 uv)
{
const float3 blurData[8] =
{
float3( 0.5, 1.5,1.50),
float3( 1.5,-0.5,1.50),
float3(-0.5,-1.5,1.50),
float3(-1.5, 0.5,1.50),
float3( 2.5, 1.5,1.00),
float3( 1.5,-2.5,1.00),
float3(-2.5,-1.5,1.00),
float3(-1.5, 2.5,1.00),
};
float4 blur = 0.0;
for(int i=0; i<8; i++)
blur += tex2Dlod(sinput, float4(uv + blurData.xy * BUFFER_PIXEL_SIZE, 0, 0)) * blurData.z;
blur /= (4 * 1.5) + (4 * 1.0);
return blur;
}
float getluma(float3 color)
{
return dot(color,float3(0.299,0.587,0.114));
}
void PSGaussian1(in VSOut i, out float4 color : SV_Target)
{
color = gaussian(NV::ColorInput, i.uv, 15, float2(1, 0));
}
void PSGaussian2AndBlend(in VSOut i, out float4 color : SV_Target)
{
float4 largeblur = gaussian(sLargeBlurTex, i.uv, 15, float2(0, 1));
float4 smallblur = box(NV::ColorInput, i.uv);
color = tex2D(NV::ColorInput, i.uv);
float a = getluma(color.rgb);
float b = getluma(largeblur.rgb);
float c = getluma(smallblur.rgb);
//sharpen
float Sharpen = getluma(color.rgb - smallblur.rgb); //need to recompute, as luma of color changed by hdr toning
float sharplimit = lerp(0.25,0.6,g_sldSharpen);
Sharpen = clamp(Sharpen,-sharplimit, sharplimit);
color.rgb = color.rgb / a * lerp(a,a+Sharpen,g_sldSharpen);
//clarity
float Clarity = (0.5 + a - b);
Clarity = lerp(2*Clarity + a*(1-2*Clarity), 2*(1-Clarity)+(2*Clarity-1)*rsqrt(a), a > b); //modified soft light v2
color.rgb *= lerp(1.0,Clarity,g_sldClarity);
//HDR Toning
float sqrta = sqrt(a);
float HDRToning = sqrta * lerp(sqrta*(2*a*b-a-2*b+2.0), (2*sqrta*b-2*b+1), b > 0.5); //modified soft light v1
color = color / (a+1e-6) * lerp(a,HDRToning,g_sldHDR);
//bloom
color.rgb = 1-(1-color.rgb)*(1-largeblur.rgb * g_sldBloom);
}
technique Details
{
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian1;
RenderTarget = LargeBlurTex;
}
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian2AndBlend;
}
}
Details filter from GeForce Experience. Provided by NVIDIA Corporation.
Copyright 2019 Suketu J. Shah. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ReShadeUI.fxh"
uniform float g_sldSharpen < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Sharpen";
ui_step = 0.001;
> = 0.5;
uniform float g_sldClarity < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "Clarity";
ui_step = 0.001;
> = 0.7;
uniform float g_sldHDR < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "HDR Toning";
ui_step = 0.001;
> = 0.6;
uniform float g_sldBloom < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Bloom";
ui_step = 0.001;
> = 0.15;
#include "NvCommon.fxh"
texture LargeBlurTex { Width = BUFFER_WIDTH*0.5; Height = BUFFER_HEIGHT*0.5; Format = RGBA16F; }; //requires recent changes to support this
sampler sLargeBlurTex { Texture = LargeBlurTex;};
float4 gaussian(sampler sinput, float2 uv, int nSteps, float2 axis)
{
float norm = -1.35914091423 / (nSteps * nSteps);
float4 accum = tex2D(sinput, uv) * 0.5;
float2 offsetinc = axis * BUFFER_PIXEL_SIZE;
float divisor = 0.5; //exp(0) * 0.5
[loop]
for(float iStep = 1; iStep <= nSteps; iStep++)
{
//linear sample, gathers 2 texels at once
//only texel not being sampled that way is center, hence it needs 1/2 the weight
float tapOffset = iStep * 2.0 - 0.5;
float tapWeight = exp(iStep * iStep * norm);
accum += tex2Dlod(sinput, float4(uv + offsetinc * tapOffset, 0, 0)) * tapWeight;
accum += tex2Dlod(sinput, float4(uv - offsetinc * tapOffset, 0, 0)) * tapWeight;
divisor += tapWeight;
}
accum /= 2.0 * divisor;
return accum;
}
float4 box(sampler sinput, float2 uv)
{
const float3 blurData[8] =
{
float3( 0.5, 1.5,1.50),
float3( 1.5,-0.5,1.50),
float3(-0.5,-1.5,1.50),
float3(-1.5, 0.5,1.50),
float3( 2.5, 1.5,1.00),
float3( 1.5,-2.5,1.00),
float3(-2.5,-1.5,1.00),
float3(-1.5, 2.5,1.00),
};
float4 blur = 0.0;
for(int i=0; i<8; i++)
blur += tex2Dlod(sinput, float4(uv + blurData.xy * BUFFER_PIXEL_SIZE, 0, 0)) * blurData.z;
blur /= (4 * 1.5) + (4 * 1.0);
return blur;
}
float getluma(float3 color)
{
return dot(color,float3(0.299,0.587,0.114));
}
void PSGaussian1(in VSOut i, out float4 color : SV_Target)
{
color = gaussian(NV::ColorInput, i.uv, 15, float2(1, 0));
}
void PSGaussian2AndBlend(in VSOut i, out float4 color : SV_Target)
{
float4 largeblur = gaussian(sLargeBlurTex, i.uv, 15, float2(0, 1));
float4 smallblur = box(NV::ColorInput, i.uv);
color = tex2D(NV::ColorInput, i.uv);
float a = getluma(color.rgb);
float b = getluma(largeblur.rgb);
float c = getluma(smallblur.rgb);
//sharpen
float Sharpen = getluma(color.rgb - smallblur.rgb); //need to recompute, as luma of color changed by hdr toning
float sharplimit = lerp(0.25,0.6,g_sldSharpen);
Sharpen = clamp(Sharpen,-sharplimit, sharplimit);
color.rgb = color.rgb / a * lerp(a,a+Sharpen,g_sldSharpen);
//clarity
float Clarity = (0.5 + a - b);
Clarity = lerp(2*Clarity + a*(1-2*Clarity), 2*(1-Clarity)+(2*Clarity-1)*rsqrt(a), a > b); //modified soft light v2
color.rgb *= lerp(1.0,Clarity,g_sldClarity);
//HDR Toning
float sqrta = sqrt(a);
float HDRToning = sqrta * lerp(sqrta*(2*a*b-a-2*b+2.0), (2*sqrta*b-2*b+1), b > 0.5); //modified soft light v1
color = color / (a+1e-6) * lerp(a,HDRToning,g_sldHDR);
//bloom
color.rgb = 1-(1-color.rgb)*(1-largeblur.rgb * g_sldBloom);
}
technique Details
{
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian1;
RenderTarget = LargeBlurTex;
}
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian2AndBlend;
}
}
Last edit: 6 months 3 weeks ago by odikzz2.
Please Log in or Create an account to join the conversation.
- 2mg
Less
More
6 months 6 days ago - 6 months 6 days ago #23
by 2mg
Replied by 2mg on topic Can someone port details.yfx from freestyle to reshade
delete this msg (and see below)
Last edit: 6 months 6 days ago by 2mg.
Please Log in or Create an account to join the conversation.
- 2mg
Less
More
6 months 6 days ago #24
by 2mg
Replied by 2mg on topic Can someone port details.yfx from freestyle to reshade
Now I'm getting "Details.fx(97, 58): error x3018: invalid subscript on array"
Here.
Warning: Spoiler!/**
Details filter from GeForce Experience. Provided by NVIDIA Corporation.
Copyright 2019 Suketu J. Shah. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ReShadeUI.fxh"
uniform float g_sldSharpen < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Sharpen";
ui_step = 0.001;
> = 0.5;
uniform float g_sldClarity < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "Clarity";
ui_step = 0.001;
> = 0.7;
uniform float g_sldHDR < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "HDR Toning";
ui_step = 0.001;
> = 0.6;
uniform float g_sldBloom < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Bloom";
ui_step = 0.001;
> = 0.15;
#include "NvCommon.fxh"
texture LargeBlurTex { Width = BUFFER_WIDTH*0.5; Height = BUFFER_HEIGHT*0.5; Format = RGBA16F; }; //requires recent changes to support this
sampler sLargeBlurTex { Texture = LargeBlurTex;};
float4 gaussian(sampler sinput, float2 uv, int nSteps, float2 axis)
{
float norm = -1.35914091423 / (nSteps * nSteps);
float4 accum = tex2D(sinput, uv) * 0.5;
float2 offsetinc = axis * BUFFER_PIXEL_SIZE;
float divisor = 0.5; //exp(0) * 0.5
[loop]
for(float iStep = 1; iStep <= nSteps; iStep++)
{
//linear sample, gathers 2 texels at once
//only texel not being sampled that way is center, hence it needs 1/2 the weight
float tapOffset = iStep * 2.0 - 0.5;
float tapWeight = exp(iStep * iStep * norm);
accum += tex2Dlod(sinput, float4(uv + offsetinc * tapOffset, 0, 0)) * tapWeight;
accum += tex2Dlod(sinput, float4(uv - offsetinc * tapOffset, 0, 0)) * tapWeight;
divisor += tapWeight;
}
accum /= 2.0 * divisor;
return accum;
}
float4 box(sampler sinput, float2 uv)
{
const float3 blurData[8] =
{
float3( 0.5, 1.5,1.50),
float3( 1.5,-0.5,1.50),
float3(-0.5,-1.5,1.50),
float3(-1.5, 0.5,1.50),
float3( 2.5, 1.5,1.00),
float3( 1.5,-2.5,1.00),
float3(-2.5,-1.5,1.00),
float3(-1.5, 2.5,1.00),
};
float4 blur = 0.0;
for(int i=0; i<8; i++)
blur += tex2Dlod(sinput, float4(uv + blurData.xy * BUFFER_PIXEL_SIZE, 0, 0)) * blurData.z;
blur /= (4 * 1.5) + (4 * 1.0);
return blur;
}
float getluma(float3 color)
{
return dot(color,float3(0.299,0.587,0.114));
}
void PSGaussian1(in VSOut i, out float4 color : SV_Target)
{
color = gaussian(NV::ColorInput, i.uv, 15, float2(1, 0));
}
void PSGaussian2AndBlend(in VSOut i, out float4 color : SV_Target)
{
float4 largeblur = gaussian(sLargeBlurTex, i.uv, 15, float2(0, 1));
float4 smallblur = box(NV::ColorInput, i.uv);
color = tex2D(NV::ColorInput, i.uv);
float a = getluma(color.rgb);
float b = getluma(largeblur.rgb);
float c = getluma(smallblur.rgb);
//sharpen
float Sharpen = getluma(color.rgb - smallblur.rgb); //need to recompute, as luma of color changed by hdr toning
float sharplimit = lerp(0.25,0.6,g_sldSharpen);
Sharpen = clamp(Sharpen,-sharplimit, sharplimit);
color.rgb = color.rgb / a * lerp(a,a+Sharpen,g_sldSharpen);
//clarity
float Clarity = (0.5 + a - b);
Clarity = lerp(2*Clarity + a*(1-2*Clarity), 2*(1-Clarity)+(2*Clarity-1)*rsqrt(a), a > b); //modified soft light v2
color.rgb *= lerp(1.0,Clarity,g_sldClarity);
//HDR Toning
float sqrta = sqrt(a);
float HDRToning = sqrta * lerp(sqrta*(2*a*b-a-2*b+2.0), (2*sqrta*b-2*b+1), b > 0.5); //modified soft light v1
color = color / (a+1e-6) * lerp(a,HDRToning,g_sldHDR);
//bloom
color.rgb = 1-(1-color.rgb)*(1-largeblur.rgb * g_sldBloom);
}
technique Details
{
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian1;
RenderTarget = LargeBlurTex;
}
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian2AndBlend;
}
}
Please Log in or Create an account to join the conversation.
- odikzz2
- Topic Author
Less
More
6 months 5 days ago - 6 months 5 days ago #25
by odikzz2
Replied by odikzz2 on topic Can someone port details.yfx from freestyle to reshade
For real this time make sure you have "NvCommon.fxh".
[code/**
Details filter from GeForce Experience. Provided by NVIDIA Corporation.
Copyright 2019 Suketu J. Shah. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ReShadeUI.fxh"
uniform float g_sldSharpen < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Sharpen";
ui_step = 0.001;
> = 0.5;
uniform float g_sldClarity < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "Clarity";
ui_step = 0.001;
> = 0.7;
uniform float g_sldHDR < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "HDR Toning";
ui_step = 0.001;
> = 0.6;
uniform float g_sldBloom < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Bloom";
ui_step = 0.001;
> = 0.15;
#include "NvCommon.fxh"
texture LargeBlurTex { Width = BUFFER_WIDTH*0.5; Height = BUFFER_HEIGHT*0.5; Format = RGBA16F; }; //requires recent changes to support this
sampler sLargeBlurTex { Texture = LargeBlurTex;};
float4 gaussian(sampler sinput, float2 uv, int nSteps, float2 axis)
{
float norm = -1.35914091423 / (nSteps * nSteps);
float4 accum = tex2D(sinput, uv) * 0.5;
float2 offsetinc = axis * BUFFER_PIXEL_SIZE;
float divisor = 0.5; //exp(0) * 0.5
[loop]
for(float iStep = 1; iStep <= nSteps; iStep++)
{
//linear sample, gathers 2 texels at once
//only texel not being sampled that way is center, hence it needs 1/2 the weight
float tapOffset = iStep * 2.0 - 0.5;
float tapWeight = exp(iStep * iStep * norm);
accum += tex2Dlod(sinput, float4(uv + offsetinc * tapOffset, 0, 0)) * tapWeight;
accum += tex2Dlod(sinput, float4(uv - offsetinc * tapOffset, 0, 0)) * tapWeight;
divisor += tapWeight;
}
accum /= 2.0 * divisor;
return accum;
}
float4 box(sampler sinput, float2 uv)
{
const float3 blurData[8] =
{
float3( 0.5, 1.5,1.50),
float3( 1.5,-0.5,1.50),
float3(-0.5,-1.5,1.50),
float3(-1.5, 0.5,1.50),
float3( 2.5, 1.5,1.00),
float3( 1.5,-2.5,1.00),
float3(-2.5,-1.5,1.00),
float3(-1.5, 2.5,1.00),
};
float4 blur = 0.0;
for(int i=0; i<8; i++)
blur += tex2Dlod(sinput, float4(uv + blurData.xy * BUFFER_PIXEL_SIZE, 0, 0)) * blurData.z;
blur /= (4 * 1.5) + (4 * 1.0);
return blur;
}
float getluma(float3 color)
{
return dot(color,float3(0.299,0.587,0.114));
}
void PSGaussian1(in VSOut i, out float4 color : SV_Target)
{
color = gaussian(NV::ColorInput, i.uv, 15, float2(1, 0));
}
void PSGaussian2AndBlend(in VSOut i, out float4 color : SV_Target)
{
float4 largeblur = gaussian(sLargeBlurTex, i.uv, 15, float2(0, 1));
float4 smallblur = box(NV::ColorInput, i.uv);
color = tex2D(NV::ColorInput, i.uv);
float a = getluma(color.rgb);
float b = getluma(largeblur.rgb);
float c = getluma(smallblur.rgb);
//sharpen
float Sharpen = getluma(color.rgb - smallblur.rgb); //need to recompute, as luma of color changed by hdr toning
float sharplimit = lerp(0.25,0.6,g_sldSharpen);
Sharpen = clamp(Sharpen,-sharplimit, sharplimit);
color.rgb = color.rgb / a * lerp(a,a+Sharpen,g_sldSharpen);
//clarity
float Clarity = (0.5 + a - b);
Clarity = lerp(2*Clarity + a*(1-2*Clarity), 2*(1-Clarity)+(2*Clarity-1)*rsqrt(a), a > b); //modified soft light v2
color.rgb *= lerp(1.0,Clarity,g_sldClarity);
//HDR Toning
float sqrta = sqrt(a);
float HDRToning = sqrta * lerp(sqrta*(2*a*b-a-2*b+2.0), (2*sqrta*b-2*b+1), b > 0.5); //modified soft light v1
color = color / (a+1e-6) * lerp(a,HDRToning,g_sldHDR);
//bloom
color.rgb = 1-(1-color.rgb)*(1-largeblur.rgb * g_sldBloom);
}
technique Details
{
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian1;
RenderTarget = LargeBlurTex;
}
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian2AndBlend;
}
}
][/code]
[code/**
Details filter from GeForce Experience. Provided by NVIDIA Corporation.
Copyright 2019 Suketu J. Shah. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ReShadeUI.fxh"
uniform float g_sldSharpen < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Sharpen";
ui_step = 0.001;
> = 0.5;
uniform float g_sldClarity < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "Clarity";
ui_step = 0.001;
> = 0.7;
uniform float g_sldHDR < __UNIFORM_SLIDER_FLOAT1
ui_min = -1.000; ui_max=1.000;
ui_label = "HDR Toning";
ui_step = 0.001;
> = 0.6;
uniform float g_sldBloom < __UNIFORM_SLIDER_FLOAT1
ui_min = 0.000; ui_max=1.000;
ui_label = "Bloom";
ui_step = 0.001;
> = 0.15;
#include "NvCommon.fxh"
texture LargeBlurTex { Width = BUFFER_WIDTH*0.5; Height = BUFFER_HEIGHT*0.5; Format = RGBA16F; }; //requires recent changes to support this
sampler sLargeBlurTex { Texture = LargeBlurTex;};
float4 gaussian(sampler sinput, float2 uv, int nSteps, float2 axis)
{
float norm = -1.35914091423 / (nSteps * nSteps);
float4 accum = tex2D(sinput, uv) * 0.5;
float2 offsetinc = axis * BUFFER_PIXEL_SIZE;
float divisor = 0.5; //exp(0) * 0.5
[loop]
for(float iStep = 1; iStep <= nSteps; iStep++)
{
//linear sample, gathers 2 texels at once
//only texel not being sampled that way is center, hence it needs 1/2 the weight
float tapOffset = iStep * 2.0 - 0.5;
float tapWeight = exp(iStep * iStep * norm);
accum += tex2Dlod(sinput, float4(uv + offsetinc * tapOffset, 0, 0)) * tapWeight;
accum += tex2Dlod(sinput, float4(uv - offsetinc * tapOffset, 0, 0)) * tapWeight;
divisor += tapWeight;
}
accum /= 2.0 * divisor;
return accum;
}
float4 box(sampler sinput, float2 uv)
{
const float3 blurData[8] =
{
float3( 0.5, 1.5,1.50),
float3( 1.5,-0.5,1.50),
float3(-0.5,-1.5,1.50),
float3(-1.5, 0.5,1.50),
float3( 2.5, 1.5,1.00),
float3( 1.5,-2.5,1.00),
float3(-2.5,-1.5,1.00),
float3(-1.5, 2.5,1.00),
};
float4 blur = 0.0;
for(int i=0; i<8; i++)
blur += tex2Dlod(sinput, float4(uv + blurData.xy * BUFFER_PIXEL_SIZE, 0, 0)) * blurData.z;
blur /= (4 * 1.5) + (4 * 1.0);
return blur;
}
float getluma(float3 color)
{
return dot(color,float3(0.299,0.587,0.114));
}
void PSGaussian1(in VSOut i, out float4 color : SV_Target)
{
color = gaussian(NV::ColorInput, i.uv, 15, float2(1, 0));
}
void PSGaussian2AndBlend(in VSOut i, out float4 color : SV_Target)
{
float4 largeblur = gaussian(sLargeBlurTex, i.uv, 15, float2(0, 1));
float4 smallblur = box(NV::ColorInput, i.uv);
color = tex2D(NV::ColorInput, i.uv);
float a = getluma(color.rgb);
float b = getluma(largeblur.rgb);
float c = getluma(smallblur.rgb);
//sharpen
float Sharpen = getluma(color.rgb - smallblur.rgb); //need to recompute, as luma of color changed by hdr toning
float sharplimit = lerp(0.25,0.6,g_sldSharpen);
Sharpen = clamp(Sharpen,-sharplimit, sharplimit);
color.rgb = color.rgb / a * lerp(a,a+Sharpen,g_sldSharpen);
//clarity
float Clarity = (0.5 + a - b);
Clarity = lerp(2*Clarity + a*(1-2*Clarity), 2*(1-Clarity)+(2*Clarity-1)*rsqrt(a), a > b); //modified soft light v2
color.rgb *= lerp(1.0,Clarity,g_sldClarity);
//HDR Toning
float sqrta = sqrt(a);
float HDRToning = sqrta * lerp(sqrta*(2*a*b-a-2*b+2.0), (2*sqrta*b-2*b+1), b > 0.5); //modified soft light v1
color = color / (a+1e-6) * lerp(a,HDRToning,g_sldHDR);
//bloom
color.rgb = 1-(1-color.rgb)*(1-largeblur.rgb * g_sldBloom);
}
technique Details
{
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian1;
RenderTarget = LargeBlurTex;
}
pass
{
VertexShader = VSMain;
PixelShader = PSGaussian2AndBlend;
}
}
][/code]
Last edit: 6 months 5 days ago by odikzz2.
Please Log in or Create an account to join the conversation.
- odikzz2
- Topic Author
Less
More
6 months 5 days ago - 6 months 5 days ago #26
by odikzz2
Replied by odikzz2 on topic Can someone port details.yfx from freestyle to reshade
look's like ReShade forums won't post exactly what i change in the code so just download it for less headache "IGNORE THE TOP POST"
Last edit: 6 months 5 days ago by odikzz2. Reason: just want to change something
Please Log in or Create an account to join the conversation.
- 2mg
Less
More
5 months 1 week ago #27
by 2mg
Replied by 2mg on topic Can someone port details.yfx from freestyle to reshade
Sorry for popping so late, but the file is expired.
Please Log in or Create an account to join the conversation.
- odikzz2
- Topic Author
Less
More
4 months 1 week ago - 4 months 1 week ago #28
by odikzz2
Replied by odikzz2 on topic Can someone port details.yfx from freestyle to reshade
NvCommon.fxh - Needed for V2
Details.fx V1 - Ported by YF
Details.fx V2
Details.fx V1 - Ported by YF
Details.fx V2
Last edit: 4 months 1 week ago by odikzz2.
Please Log in or Create an account to join the conversation.
- 2mg
Less
More
4 months 1 week ago #29
by 2mg
Replied by 2mg on topic Can someone port details.yfx from freestyle to reshade
Thanks!NvCommon.fxh - Needed for V2
Details.fx V1 - Ported by YF
Details.fx V2
Do you mind if I put these in pastebin and repost here?
And what's the difference between your port and YF's?
Does YF's correctly work with nvcommon v2?
Please Log in or Create an account to join the conversation.
- 2mg
Less
More
4 months 1 week ago #30
by 2mg
Replied by 2mg on topic Can someone port details.yfx from freestyle to reshade
Here are pastebins for these so files don't expire:
pastebin.com/39LMk1em
pastebin.com/UFzed1Fj
pastebin.com/YJUQNakh
Would appreciate if odikzz2 can answer questions above!
pastebin.com/39LMk1em
pastebin.com/UFzed1Fj
pastebin.com/YJUQNakh
Would appreciate if odikzz2 can answer questions above!
Please Log in or Create an account to join the conversation.
- odikzz2
- Topic Author
Less
More
4 months 3 days ago #31
by odikzz2
Replied by odikzz2 on topic Can someone port details.yfx from freestyle to reshade
I didn't port the V2 it came from the Nvidia driver leak "470.05" and made some few adjustments in order to work with ReShade.
The differences between V1 and V2 is blur radius similar to clarity.fx by loxa V2 has bigger radius then V1
The differences between V1 and V2 is blur radius similar to clarity.fx by loxa V2 has bigger radius then V1
The following user(s) said Thank You: 2mg
Please Log in or Create an account to join the conversation.