HDR equivalent for Reshade 3?
- NerdDefender
- Topic Author
I've seen the hdr.h file in Sweetfx, but the shader files in Reshade are .fx so I am assuming I just can't drop them in. I am not sure the differences so don't want to mess with it.
Any advice?
Please Log in or Create an account to join the conversation.
- ibbanez
- Ioxa
/*------------------------------------------------------------------------------
HDR
------------------------------------------------------------------------------*/
uniform float HDRPower
<
ui_type = "drag";
ui_min = 0.00; ui_max = 8.00;
ui_tooltip = "Strangely lowering this makes the image brighter";
> = 1.30;
uniform float radius2
<
ui_type = "drag";
ui_min = 0.00; ui_max = 8.00;
ui_tooltip = "Raising this seems to make the effect stronger and also brighter";
> = 0.87;
#include "ReShade.fxh"
float4 HDRPass( float4 colorInput, float2 Tex )
{
float3 c_center = tex2D(ReShade::BackBuffer, Tex).rgb; //reuse SMAA center sample or lumasharpen center sample?
//float3 c_center = colorInput.rgb; //or just the input?
//float3 bloom_sum1 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that
//float3 bloom_sum2 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that
//Tex += float2(0, 0); // +0 ? .. oh riiiight - that will surely do something useful
float radius1 = 0.793;
float3 bloom_sum1 = tex2D(ReShade::BackBuffer, Tex + float2(1.5, -1.5) * radius1).rgb;
bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, -1.5) * radius1).rgb; //rearrange sample order to minimize ALU and maximize cache usage
bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(1.5, 1.5) * radius1).rgb;
bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, 1.5) * radius1).rgb;
bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(0, -2.5) * radius1).rgb;
bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(0, 2.5) * radius1).rgb;
bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(-2.5, 0) * radius1).rgb;
bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(2.5, 0) * radius1).rgb;
bloom_sum1 *= 0.005;
float3 bloom_sum2 = tex2D(ReShade::BackBuffer, Tex + float2(1.5, -1.5) * radius2).rgb;
bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, -1.5) * radius2).rgb;
bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(1.5, 1.5) * radius2).rgb;
bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, 1.5) * radius2).rgb;
bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(0, -2.5) * radius2).rgb;
bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(0, 2.5) * radius2).rgb;
bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(-2.5, 0) * radius2).rgb;
bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(2.5, 0) * radius2).rgb;
bloom_sum2 *= 0.010;
float dist = radius2 - radius1;
float3 HDR = (c_center + (bloom_sum2 - bloom_sum1)) * dist;
float3 blend = HDR + colorInput.rgb;
colorInput.rgb = pow(abs(blend), abs(HDRPower)) + HDR; // pow - don't use fractions for HDRpower
return saturate(colorInput);
}
float3 HDRWrap(float4 position : SV_Position, float2 texcoord : TEXCOORD0) : SV_Target
{
float4 color = tex2D(ReShade::BackBuffer, texcoord);
color = HDRPass(color,texcoord);
return color.rgb;
}
technique HDR_Tech
{
pass
{
VertexShader = PostProcessVS;
PixelShader = HDRWrap;
}
}
Please Log in or Create an account to join the conversation.
- Martigen
Love your work IoxaIoxa wrote: Heres a quick port of HDR. Just copy the text and paste it into a .fx file
/*------------------------------------------------------------------------------ HDR ------------------------------------------------------------------------------*/ uniform float HDRPower < ui_type = "drag"; ui_min = 0.00; ui_max = 8.00; ui_tooltip = "Strangely lowering this makes the image brighter"; > = 1.30; uniform float radius2 < ui_type = "drag"; ui_min = 0.00; ui_max = 8.00; ui_tooltip = "Raising this seems to make the effect stronger and also brighter"; > = 0.87; #include "ReShade.fxh" float4 HDRPass( float4 colorInput, float2 Tex ) { float3 c_center = tex2D(ReShade::BackBuffer, Tex).rgb; //reuse SMAA center sample or lumasharpen center sample? //float3 c_center = colorInput.rgb; //or just the input? //float3 bloom_sum1 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that //float3 bloom_sum2 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that //Tex += float2(0, 0); // +0 ? .. oh riiiight - that will surely do something useful float radius1 = 0.793; float3 bloom_sum1 = tex2D(ReShade::BackBuffer, Tex + float2(1.5, -1.5) * radius1).rgb; bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, -1.5) * radius1).rgb; //rearrange sample order to minimize ALU and maximize cache usage bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(1.5, 1.5) * radius1).rgb; bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, 1.5) * radius1).rgb; bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(0, -2.5) * radius1).rgb; bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(0, 2.5) * radius1).rgb; bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(-2.5, 0) * radius1).rgb; bloom_sum1 += tex2D(ReShade::BackBuffer, Tex + float2(2.5, 0) * radius1).rgb; bloom_sum1 *= 0.005; float3 bloom_sum2 = tex2D(ReShade::BackBuffer, Tex + float2(1.5, -1.5) * radius2).rgb; bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, -1.5) * radius2).rgb; bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(1.5, 1.5) * radius2).rgb; bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(-1.5, 1.5) * radius2).rgb; bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(0, -2.5) * radius2).rgb; bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(0, 2.5) * radius2).rgb; bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(-2.5, 0) * radius2).rgb; bloom_sum2 += tex2D(ReShade::BackBuffer, Tex + float2(2.5, 0) * radius2).rgb; bloom_sum2 *= 0.010; float dist = radius2 - radius1; float3 HDR = (c_center + (bloom_sum2 - bloom_sum1)) * dist; float3 blend = HDR + colorInput.rgb; colorInput.rgb = pow(abs(blend), abs(HDRPower)) + HDR; // pow - don't use fractions for HDRpower return saturate(colorInput); } float3 HDRWrap(float4 position : SV_Position, float2 texcoord : TEXCOORD0) : SV_Target { float4 color = tex2D(ReShade::BackBuffer, texcoord); color = HDRPass(color,texcoord); return color.rgb; } technique HDR_Tech { pass { VertexShader = PostProcessVS; PixelShader = HDRWrap; } }
Can you port DPX too? *offers pizza and booze*
Please Log in or Create an account to join the conversation.
- NerdDefender
- Topic Author
Please Log in or Create an account to join the conversation.
- moriz1
Martigen wrote: Can you port DPX too? *offers pizza and booze*
ask, and ye shall receive (copypaste this as DPX.fx in your shaders folder):
/*
DPX/Cineon shader by Loadus ( http://www.loadusfx.net/virtualdub/DPX.fx )
Version 1.0
Ported to SweetFX by CeeJay.dk
Version 1.1
Improved performance
Quick+Dirty port to ReShade 3.0 by moriz1
*/
uniform float Red <
ui_type = "drag";
ui_min = 1.0; ui_max = 15.0;
ui_tooltip = "Red";
> = 12.0;
uniform float Green <
ui_type = "drag";
ui_min = 1.0; ui_max = 15.0;
ui_tooltip = "Green";
> = 12.0;
uniform float Blue <
ui_type = "drag";
ui_min = 1.0; ui_max = 15.0;
ui_tooltip = "Blue";
> = 12.0;
uniform float ColorGamma <
ui_type = "drag";
ui_min = 0.1; ui_max = 2.5;
ui_tooltip = "Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral";
> = 1.08;
uniform float DPXSaturation <
ui_type = "drag";
ui_min = 0.0; ui_max = 8.0;
ui_tooltip = "Adjust saturation of the effect. 1.0 is neutral";
> = 1.35;
uniform float RedC <
ui_type = "drag";
ui_min = 0.2; ui_max = 0.6;
ui_tooltip = "RedC";
> = 0.33;
uniform float GreenC <
ui_type = "drag";
ui_min = 0.2; ui_max = 0.6;
ui_tooltip = "RedC";
> = 0.36;
uniform float BlueC <
ui_type = "drag";
ui_min = 0.2; ui_max = 0.6;
ui_tooltip = "RedC";
> = 0.36;
uniform float Blend <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_tooltip = "How strong the effect should be";
> = 0.22;
#include "ReShade.fxh"
static const float3x3 RGB = float3x3
(
2.67147117265996,-1.26723605786241,-0.410995602172227,
-1.02510702934664,1.98409116241089,0.0439502493584124,
0.0610009456429445,-0.223670750812863,1.15902104167061
);
static const float3x3 XYZ = float3x3
(
0.500303383543316,0.338097573222739,0.164589779545857,
0.257968894274758,0.676195259144706,0.0658358459823868,
0.0234517888692628,0.1126992737203,0.866839673124201
);
float3 DPXPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float DPXContrast = 0.1;
float DPXGamma = 1.0;
float RedCurve = Red;
float GreenCurve = Green;
float BlueCurve = Blue;
float3 RGB_Curve = float3(Red,Green,Blue);
float3 RGB_C = float3(RedC,GreenC,BlueC);
float3 B = tex2D(ReShade::BackBuffer, texcoord).rgb;
//float3 Bn = B; // I used InputColor.rgb instead.
B = pow(abs(B), 1.0/DPXGamma);
B = B * (1.0 - DPXContrast) + (0.5 * DPXContrast);
//B = (1.0 /(1.0 + exp(- RGB_Curve * (B - RGB_C))) - (1.0 / (1.0 + exp(RGB_Curve / 2.0))))/(1.0 - 2.0 * (1.0 / (1.0 + exp(RGB_Curve / 2.0))));
float3 Btemp = (1.0 / (1.0 + exp(RGB_Curve / 2.0)));
B = ((1.0 / (1.0 + exp(-RGB_Curve * (B - RGB_C)))) / (-2.0 * Btemp + 1.0)) + (-Btemp / (-2.0 * Btemp + 1.0));
//TODO use faster code for conversion between RGB/HSV - see http://www.chilliant.com/rgb2hsv.html
float value = max(max(B.r, B.g), B.b);
float3 color = B / value;
color = pow(abs(color), 1.0/ColorGamma);
float3 c0 = color * value;
c0 = mul(XYZ, c0);
float luma = dot(c0, float3(0.30, 0.59, 0.11)); //Use BT 709 instead?
//float3 chroma = c0 - luma;
//c0 = chroma * DPXSaturation + luma;
c0 = (1.0 - DPXSaturation) * luma + DPXSaturation * c0;
c0 = mul(RGB, c0);
//InputColor.rgb = lerp(InputColor.rgb, c0, Blend);
//return InputColor.rgb;
B.rgb = lerp(B.rgb, c0, Blend);
return B;
}
technique DPX
{
pass
{
VertexShader = PostProcessVS;
PixelShader = DPXPass;
}
}
Please Log in or Create an account to join the conversation.
- Martigen
moriz1 wrote:
Martigen wrote: Can you port DPX too? *offers pizza and booze*
ask, and ye shall receive (copypaste this as DPX.fx in your shaders folder):
/* DPX/Cineon shader by Loadus ( http://www.loadusfx.net/virtualdub/DPX.fx ) Version 1.0 Ported to SweetFX by CeeJay.dk Version 1.1 Improved performance Quick+Dirty port to ReShade 3.0 by moriz1 */ uniform float Red < ui_type = "drag"; ui_min = 1.0; ui_max = 15.0; ui_tooltip = "Red"; > = 12.0; uniform float Green < ui_type = "drag"; ui_min = 1.0; ui_max = 15.0; ui_tooltip = "Green"; > = 12.0; uniform float Blue < ui_type = "drag"; ui_min = 1.0; ui_max = 15.0; ui_tooltip = "Blue"; > = 12.0; uniform float ColorGamma < ui_type = "drag"; ui_min = 0.1; ui_max = 2.5; ui_tooltip = "Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral"; > = 1.08; uniform float DPXSaturation < ui_type = "drag"; ui_min = 0.0; ui_max = 8.0; ui_tooltip = "Adjust saturation of the effect. 1.0 is neutral"; > = 1.35; uniform float RedC < ui_type = "drag"; ui_min = 0.2; ui_max = 0.6; ui_tooltip = "RedC"; > = 0.33; uniform float GreenC < ui_type = "drag"; ui_min = 0.2; ui_max = 0.6; ui_tooltip = "RedC"; > = 0.36; uniform float BlueC < ui_type = "drag"; ui_min = 0.2; ui_max = 0.6; ui_tooltip = "RedC"; > = 0.36; uniform float Blend < ui_type = "drag"; ui_min = 0.00; ui_max = 1.00; ui_tooltip = "How strong the effect should be"; > = 0.22; #include "ReShade.fxh" static const float3x3 RGB = float3x3 ( 2.67147117265996,-1.26723605786241,-0.410995602172227, -1.02510702934664,1.98409116241089,0.0439502493584124, 0.0610009456429445,-0.223670750812863,1.15902104167061 ); static const float3x3 XYZ = float3x3 ( 0.500303383543316,0.338097573222739,0.164589779545857, 0.257968894274758,0.676195259144706,0.0658358459823868, 0.0234517888692628,0.1126992737203,0.866839673124201 ); float3 DPXPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target { float DPXContrast = 0.1; float DPXGamma = 1.0; float RedCurve = Red; float GreenCurve = Green; float BlueCurve = Blue; float3 RGB_Curve = float3(Red,Green,Blue); float3 RGB_C = float3(RedC,GreenC,BlueC); float3 B = tex2D(ReShade::BackBuffer, texcoord).rgb; //float3 Bn = B; // I used InputColor.rgb instead. B = pow(abs(B), 1.0/DPXGamma); B = B * (1.0 - DPXContrast) + (0.5 * DPXContrast); //B = (1.0 /(1.0 + exp(- RGB_Curve * (B - RGB_C))) - (1.0 / (1.0 + exp(RGB_Curve / 2.0))))/(1.0 - 2.0 * (1.0 / (1.0 + exp(RGB_Curve / 2.0)))); float3 Btemp = (1.0 / (1.0 + exp(RGB_Curve / 2.0))); B = ((1.0 / (1.0 + exp(-RGB_Curve * (B - RGB_C)))) / (-2.0 * Btemp + 1.0)) + (-Btemp / (-2.0 * Btemp + 1.0)); //TODO use faster code for conversion between RGB/HSV - see http://www.chilliant.com/rgb2hsv.html float value = max(max(B.r, B.g), B.b); float3 color = B / value; color = pow(abs(color), 1.0/ColorGamma); float3 c0 = color * value; c0 = mul(XYZ, c0); float luma = dot(c0, float3(0.30, 0.59, 0.11)); //Use BT 709 instead? //float3 chroma = c0 - luma; //c0 = chroma * DPXSaturation + luma; c0 = (1.0 - DPXSaturation) * luma + DPXSaturation * c0; c0 = mul(RGB, c0); //InputColor.rgb = lerp(InputColor.rgb, c0, Blend); //return InputColor.rgb; B.rgb = lerp(B.rgb, c0, Blend); return B; } technique DPX { pass { VertexShader = PostProcessVS; PixelShader = DPXPass; } }
Fantastic!!! Thankyou
*hands you virtual pizza and booze, apologies it's not the real thing. Throws in some virtual hookers, coz why not*
Please Log in or Create an account to join the conversation.
- Martigen
Hey Moriz, thanks again for porting DPX though there is something not quite right about it -- everything is overly bright, could be a contrast or gamma issue. All the toggleables work, the result just isn't the same as DPX in SweetFX, again it seems like brightness is ramped 200%. Maybe something changed in Reshade 3.0 in relation to this?moriz1 wrote: ask, and ye shall receive (copypaste this as DPX.fx in your shaders folder):
@Crosire, in case you can see anything in the code.
Please Log in or Create an account to join the conversation.
- moriz1
Please Log in or Create an account to join the conversation.
- CrazyCat
#define Red 8.0 //[1.0:15.0] //-
#define Green 8.0 //[1.0:15.0] //-
#define Blue 8.0 //[1.0:15.0] //-
#define ColorGamma 2.5 //[0.1:2.5] //-Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral.
#define DPXSaturation 3.0 //[0.0:8.0] //-Adjust saturation of the effect. 1.0 is neutral.
#define RedC 0.36 //[0.20:0.60] //-
#define GreenC 0.36 //[0.20:0.60] //-
#define BlueC 0.34 //[0.20:0.60] //-
#define Blend 0.20 //[0.00:1.00] //-How strong the effect should be.
Please Log in or Create an account to join the conversation.
- Martigen
No that's not it, tried thatCrazyCat wrote: Maybe because the default values for Red, Green, Blue are set too high. Try default values by CeeJay:
#define Red 8.0 //[1.0:15.0] //- #define Green 8.0 //[1.0:15.0] //- #define Blue 8.0 //[1.0:15.0] //- #define ColorGamma 2.5 //[0.1:2.5] //-Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral. #define DPXSaturation 3.0 //[0.0:8.0] //-Adjust saturation of the effect. 1.0 is neutral. #define RedC 0.36 //[0.20:0.60] //- #define GreenC 0.36 //[0.20:0.60] //- #define BlueC 0.34 //[0.20:0.60] //- #define Blend 0.20 //[0.00:1.00] //-How strong the effect should be.
Please Log in or Create an account to join the conversation.
- NerdDefender
- Topic Author
Please Log in or Create an account to join the conversation.
- CrazyCat
B.rgb = lerp(B.rgb, c0, Blend);
A quick fix would be to change that line to
B.rgb = lerp(Bn.rgb, c0, Blend);
//float3 Bn = B;
Please Log in or Create an account to join the conversation.
- moriz1
CrazyCat wrote:
I think B in this lerp function is supposed be in original value.B.rgb = lerp(B.rgb, c0, Blend);
A quick fix would be to change that line toand uncomment the lineB.rgb = lerp(Bn.rgb, c0, Blend);//float3 Bn = B;
i believe you are correct. i'll double check once i get home.
Please Log in or Create an account to join the conversation.
- Ioxa
/*
DPX/Cineon shader by Loadus ( http://www.loadusfx.net/virtualdub/DPX.fx )
Version 1.0
Ported to SweetFX by CeeJay.dk
Version 1.1
Improved performance
*/
//>Cineon DPX settings<\\
uniform float Red
<
ui_type = "drag";
ui_min = 1.00; ui_max = 15.00;
> = 8.0;
uniform float Green
<
ui_type = "drag";
ui_min = 1.00; ui_max = 15.00;
> = 8.0;
uniform float Blue
<
ui_type = "drag";
ui_min = 1.00; ui_max = 15.00;
> = 8.0;
uniform float ColorGamma<
ui_type = "drag";
ui_min = 1.00; ui_max = 2.50;
ui_tooltip = "Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral.";
> = 2.5;
uniform float DPXSaturation
<
ui_type = "drag";
ui_min = 0.00; ui_max = 8.00;
ui_tooltip = "Adjust saturation of the effect. 1.0 is neutral.";
> = 3.0;
uniform float RedC
<
ui_type = "drag";
ui_min = 0.20; ui_max = 0.60;
> = 0.36;
uniform float GreenC
<
ui_type = "drag";
ui_min = 0.20; ui_max = 0.60;
> = 0.36;
uniform float BlueC
<
ui_type = "drag";
ui_min = 0.20; ui_max = 0.60;
> = 0.34;
uniform float Blend<
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_tooltip = "How strong the effect should be.";
> = 0.20;
#include "ReShade.fxh"
static const float3x3 RGB = float3x3
(
2.67147117265996,-1.26723605786241,-0.410995602172227,
-1.02510702934664,1.98409116241089,0.0439502493584124,
0.0610009456429445,-0.223670750812863,1.15902104167061
);
static const float3x3 XYZ = float3x3
(
0.500303383543316,0.338097573222739,0.164589779545857,
0.257968894274758,0.676195259144706,0.0658358459823868,
0.0234517888692628,0.1126992737203,0.866839673124201
);
float4 DPXPass(float4 InputColor){
float DPXContrast = 0.1;
float DPXGamma = 1.0;
float RedCurve = Red;
float GreenCurve = Green;
float BlueCurve = Blue;
float3 RGB_Curve = float3(Red,Green,Blue);
float3 RGB_C = float3(RedC,GreenC,BlueC);
float3 B = InputColor.rgb;
//float3 Bn = B; // I used InputColor.rgb instead.
B = pow(abs(B), 1.0/DPXGamma);
B = B * (1.0 - DPXContrast) + (0.5 * DPXContrast);
//B = (1.0 /(1.0 + exp(- RGB_Curve * (B - RGB_C))) - (1.0 / (1.0 + exp(RGB_Curve / 2.0))))/(1.0 - 2.0 * (1.0 / (1.0 + exp(RGB_Curve / 2.0))));
float3 Btemp = (1.0 / (1.0 + exp(RGB_Curve / 2.0)));
B = ((1.0 / (1.0 + exp(-RGB_Curve * (B - RGB_C)))) / (-2.0 * Btemp + 1.0)) + (-Btemp / (-2.0 * Btemp + 1.0));
//TODO use faster code for conversion between RGB/HSV - see http://www.chilliant.com/rgb2hsv.html
float value = max(max(B.r, B.g), B.b);
float3 color = B / value;
color = pow(abs(color), 1.0/ColorGamma);
float3 c0 = color * value;
c0 = mul(XYZ, c0);
float luma = dot(c0, float3(0.30, 0.59, 0.11)); //Use BT 709 instead?
//float3 chroma = c0 - luma;
//c0 = chroma * DPXSaturation + luma;
c0 = (1.0 - DPXSaturation) * luma + DPXSaturation * c0;
c0 = mul(RGB, c0);
InputColor.rgb = lerp(InputColor.rgb, c0, Blend);
return InputColor;
}
float3 DPXWrap(float4 position : SV_Position, float2 texcoord : TEXCOORD0) : SV_Target
{
float4 color = tex2D(ReShade::BackBuffer, texcoord);
color = DPXPass(color);
return color.rgb;
}
technique DPX
{
pass
{
VertexShader = PostProcessVS;
PixelShader = DPXWrap;
}
}
Please Log in or Create an account to join the conversation.
- Razed
I'm very interested in a port of your Gauss/Unsharp Mask shader for 3.0, any chance you would be able to do it when you have time? Thank you for your hard work.
Btw, I ported the Sepia shader if anyone wants it:
/*------------------------------------------------------------------------------
SEPIA
------------------------------------------------------------------------------*/
uniform float GreyPower <
ui_type = "drag";
ui_min = -1.0; ui_max = 1.0;
ui_tooltip = "How much desaturate the image before tinting it.";
> = 0.00;
uniform float SepiaPower <
ui_type = "drag";
ui_min = -1.0; ui_max = 1.0;
ui_tooltip = "How much to tint the image.";
> = 0.00;
uniform float3 ColorTone
<
ui_type = "drag";
ui_min = -10; ui_max = 10;
ui_label = "RGB Balance";
ui_tooltip = "What color to tint the image.";
> = float3(1.0, 1.0, 1.0);
#include "ReShade.fxh"
float4 SepiaPass( float4 colorInput, float2 Tex )
{
float3 sepia = colorInput.rgb;
// calculating amounts of input, grey and sepia colors to blend and combine
float grey = dot(sepia, float3(0.2126, 0.7152, 0.0722));
sepia *= ColorTone;
float3 blend2 = (grey * GreyPower) + (colorInput.rgb / (GreyPower + 1));
colorInput.rgb = lerp(blend2, sepia, SepiaPower);
// returning the final color
return colorInput;
}
float3 SepiaWrap(float4 position : SV_Position, float2 texcoord : TEXCOORD0) : SV_Target
{
float4 color = tex2D(ReShade::BackBuffer, texcoord);
color = SepiaPass(color,texcoord);
return color.rgb;
}
technique Sepia_Tech
{
pass
{
VertexShader = PostProcessVS;
PixelShader = SepiaWrap;
}
}
Please Log in or Create an account to join the conversation.
- Ioxa
Razed wrote: Nice work Ioxa!
I'm very interested in a port of your Gauss/Unsharp Mask shader for 3.0, any chance you would be able to do it when you have time? Thank you for your hard work.
Btw, I ported the Sepia shader if anyone wants it:
Warning: Spoiler!/*------------------------------------------------------------------------------ SEPIA ------------------------------------------------------------------------------*/ uniform float GreyPower < ui_type = "drag"; ui_min = -1.0; ui_max = 1.0; ui_tooltip = "How much desaturate the image before tinting it."; > = 0.00; uniform float SepiaPower < ui_type = "drag"; ui_min = -1.0; ui_max = 1.0; ui_tooltip = "How much to tint the image."; > = 0.00; uniform float3 ColorTone < ui_type = "drag"; ui_min = -10; ui_max = 10; ui_label = "RGB Balance"; ui_tooltip = "What color to tint the image."; > = float3(1.0, 1.0, 1.0); #include "ReShade.fxh" float4 SepiaPass( float4 colorInput, float2 Tex ) { float3 sepia = colorInput.rgb; // calculating amounts of input, grey and sepia colors to blend and combine float grey = dot(sepia, float3(0.2126, 0.7152, 0.0722)); sepia *= ColorTone; float3 blend2 = (grey * GreyPower) + (colorInput.rgb / (GreyPower + 1)); colorInput.rgb = lerp(blend2, sepia, SepiaPower); // returning the final color return colorInput; } float3 SepiaWrap(float4 position : SV_Position, float2 texcoord : TEXCOORD0) : SV_Target { float4 color = tex2D(ReShade::BackBuffer, texcoord); color = SepiaPass(color,texcoord); return color.rgb; } technique Sepia_Tech { pass { VertexShader = PostProcessVS; PixelShader = SepiaWrap; } }
I made an unsharp mask shader but I didn't post it to Github because there are already a few sharpening shaders on there, but I'll post it here if you want to try it.
It's not the same as the old one, I had to make some changes so the settings could be adjusted in the GUI, but the results should be the same.
//UnsharpMask by Ioxa
//Version 1.0 for ReShade 3.0
//Settings
uniform int BlurRadius <
ui_type = "drag";
ui_min = 0; ui_max = 4;
ui_tooltip = "[0|1|2|3|4] Adjusts the blur radius. Higher values increase the radius";
> = 1;
uniform float BlurOffset <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_tooltip = "Additional adjustment for the blur radius. Values less than 1.00 will reduce the radius.";
ui_step = 0.20;
> = 1.00;
uniform float BrightClamp <
ui_type = "drag";
ui_min = 0.00; ui_max = 0.50;
ui_tooltip = "Clamps the amount of sharpening done to bright pixels.";
> = 0.040;
uniform float DarkClamp <
ui_type = "drag";
ui_min = 0.00; ui_max = 0.50;
ui_tooltip = "Clamps the amount of sharpening done to dark pixels.";
> = 0.040;
uniform float Strength <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_tooltip = "Adjusts the strength of the effect.";
> = 0.30;
#include "ReShade.fxh"
texture UnsharpMaskTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = R8; };
sampler UnsharpMaskSampler { Texture = UnsharpMaskTex;};
float3 UnsharpMaskFinal(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD) : COLOR
{
float blur = tex2D(UnsharpMaskSampler, texcoord).rgb;
if(BlurRadius == 0)
{
float offset[4] = { 0.0, 1.1824255238, 3.0293122308, 5.0040701377 };
float weight[4] = { 0.39894, 0.2959599993, 0.0045656525, 0.00000149278686458842 };
blur *= weight[0];
[loop]
for(int i = 1; i < 4; ++i)
{
blur += tex2D(UnsharpMaskSampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
blur += tex2D(UnsharpMaskSampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
}
}
if(BlurRadius == 1)
{
float offset[6] = { 0.0, 1.4584295168, 3.40398480678, 5.3518057801, 7.302940716, 9.2581597095 };
float weight[6] = { 0.13298, 0.23227575, 0.1353261595, 0.0511557427, 0.01253922, 0.0019913644 };
blur *= weight[0];
[loop]
for(int i = 1; i < 6; ++i)
{
blur += tex2D(UnsharpMaskSampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
blur += tex2D(UnsharpMaskSampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
}
}
if(BlurRadius == 2)
{
float offset[11] = { 0.0, 1.4895848401, 3.4757135714, 5.4618796741, 7.4481042327, 9.4344079746, 11.420811147, 13.4073334, 15.3939936778, 17.3808101174, 19.3677999584 };
float weight[11] = { 0.06649, 0.1284697563, 0.111918249, 0.0873132676, 0.0610011113, 0.0381655709, 0.0213835661, 0.0107290241, 0.0048206869, 0.0019396469, 0.0006988718 };
blur *= weight[0];
[loop]
for(int i = 1; i < 11; ++i)
{
blur += tex2D(UnsharpMaskSampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
blur += tex2D(UnsharpMaskSampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
}
}
if(BlurRadius == 3)
{
float offset[15] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4401038149, 21.43402885, 23.4279736431, 25.4219399344, 27.4159294386 };
float weight[15] = { 0.0443266667, 0.0872994708, 0.0820892038, 0.0734818355, 0.0626171681, 0.0507956191, 0.0392263968, 0.0288369812, 0.0201808877, 0.0134446557, 0.0085266392, 0.0051478359, 0.0029586248, 0.0016187257, 0.0008430913 };
blur *= weight[0];
[loop]
for(int i = 1; i < 15; ++i)
{
blur += tex2D(UnsharpMaskSampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
blur += tex2D(UnsharpMaskSampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
}
}
if(BlurRadius == 4)
{
float offset[18] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4661974725, 21.4627427973, 23.4592916956, 25.455844494, 27.4524015179, 29.4489630909, 31.445529535, 33.4421011704 };
float weight[18] = { 0.033245, 0.0659162217, 0.0636705814, 0.0598194658, 0.0546642566, 0.0485871646, 0.0420045997, 0.0353207015, 0.0288880982, 0.0229808311, 0.0177815511, 0.013382297, 0.0097960001, 0.0069746748, 0.0048301008, 0.0032534598, 0.0021315311, 0.0013582974 };
blur *= weight[0];
[loop]
for(int i = 1; i < 18; ++i)
{
blur += tex2D(UnsharpMaskSampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
blur += tex2D(UnsharpMaskSampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * BlurOffset).r * weight[i];
}
}
float3 orig = tex2D(ReShade::BackBuffer, texcoord).rgb;
float luma = dot(orig,float3(0.2126, 0.7152, 0.0722));
float sharp = (luma - blur) * Strength;
sharp = clamp(sharp, -DarkClamp, BrightClamp);
orig += sharp;
return saturate(orig);
}
float UnsharpMask1(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD) : COLOR
{
float3 blur = tex2D(ReShade::BackBuffer, texcoord).rgb;
if(BlurRadius == 0)
{
float offset[4] = { 0.0, 1.1824255238, 3.0293122308, 5.0040701377 };
float weight[4] = { 0.39894, 0.2959599993, 0.0045656525, 0.00000149278686458842 };
blur *= weight[0];
[loop]
for(int i = 1; i < 4; ++i)
{
blur += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
blur += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
}
}
if(BlurRadius == 1)
{
float offset[6] = { 0.0, 1.4584295168, 3.40398480678, 5.3518057801, 7.302940716, 9.2581597095 };
float weight[6] = { 0.13298, 0.23227575, 0.1353261595, 0.0511557427, 0.01253922, 0.0019913644 };
blur *= weight[0];
[loop]
for(int i = 1; i < 6; ++i)
{
blur += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
blur += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
}
}
if(BlurRadius == 2)
{
float offset[11] = { 0.0, 1.4895848401, 3.4757135714, 5.4618796741, 7.4481042327, 9.4344079746, 11.420811147, 13.4073334, 15.3939936778, 17.3808101174, 19.3677999584 };
float weight[11] = { 0.06649, 0.1284697563, 0.111918249, 0.0873132676, 0.0610011113, 0.0381655709, 0.0213835661, 0.0107290241, 0.0048206869, 0.0019396469, 0.0006988718 };
blur *= weight[0];
[loop]
for(int i = 1; i < 11; ++i)
{
blur += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
blur += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
}
}
if(BlurRadius == 3)
{
float offset[15] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4401038149, 21.43402885, 23.4279736431, 25.4219399344, 27.4159294386 };
float weight[15] = { 0.0443266667, 0.0872994708, 0.0820892038, 0.0734818355, 0.0626171681, 0.0507956191, 0.0392263968, 0.0288369812, 0.0201808877, 0.0134446557, 0.0085266392, 0.0051478359, 0.0029586248, 0.0016187257, 0.0008430913 };
blur *= weight[0];
[loop]
for(int i = 1; i < 15; ++i)
{
blur += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
blur += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
}
}
if(BlurRadius == 4)
{
float offset[18] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4661974725, 21.4627427973, 23.4592916956, 25.455844494, 27.4524015179, 29.4489630909, 31.445529535, 33.4421011704 };
float weight[18] = { 0.033245, 0.0659162217, 0.0636705814, 0.0598194658, 0.0546642566, 0.0485871646, 0.0420045997, 0.0353207015, 0.0288880982, 0.0229808311, 0.0177815511, 0.013382297, 0.0097960001, 0.0069746748, 0.0048301008, 0.0032534598, 0.0021315311, 0.0013582974 };
blur *= weight[0];
[loop]
for(int i = 1; i < 18; ++i)
{
blur += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
blur += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * BlurOffset).rgb * weight[i];
}
}
return dot(blur,float3(0.2126, 0.7152, 0.0722));
}
technique UnsharpMask
{
pass Blur1
{
VertexShader = PostProcessVS;
PixelShader = UnsharpMask1;
RenderTarget = UnsharpMaskTex;
}
pass BlurFinal
{
VertexShader = PostProcessVS;
PixelShader = UnsharpMaskFinal;
}
}
Please Log in or Create an account to join the conversation.
- ibbanez
Please Log in or Create an account to join the conversation.