HDR equivalent for Reshade 3?

  • NerdDefender
  • Topic Author
More
7 years 6 months ago - 7 years 6 months ago #1 by NerdDefender HDR equivalent for Reshade 3? was created by NerdDefender
What title says. Downloaded and installed Reshade 3. I am loving it, but wondering how to use hdr shader? Been to github and seen the repository, not in there either.
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?
Last edit: 7 years 6 months ago by NerdDefender.

Please Log in or Create an account to join the conversation.

  • ibbanez
More
7 years 6 months ago #2 by ibbanez Replied by ibbanez on topic HDR equivalent for Reshade 3?
I second this question. Thanks. :)

Please Log in or Create an account to join the conversation.

  • Ioxa
More
7 years 6 months ago #3 by Ioxa Replied by Ioxa on topic HDR equivalent for Reshade 3?
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;
	}
}
The following user(s) said Thank You: Pondural, Golgotha, Moonkey, Razed, NerdDefender, Gar Stazi

Please Log in or Create an account to join the conversation.

  • Martigen
More
7 years 6 months ago #4 by Martigen Replied by Martigen on topic HDR equivalent for Reshade 3?

Ioxa 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;
	}
}

Love your work Ioxa :)

Can you port DPX too? *offers pizza and booze*

Please Log in or Create an account to join the conversation.

  • NerdDefender
  • Topic Author
More
7 years 6 months ago #5 by NerdDefender Replied by NerdDefender on topic HDR equivalent for Reshade 3?
Worked beautifully, Thanks! Out of curiosity, are there other shaders that function similarly to HDR?

Please Log in or Create an account to join the conversation.

  • moriz1
More
7 years 6 months ago - 7 years 6 months ago #6 by moriz1 Replied by moriz1 on topic HDR equivalent for Reshade 3?

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;
	}
}
Last edit: 7 years 6 months ago by moriz1.
The following user(s) said Thank You: Golgotha, Moonkey, NerdDefender, Gar Stazi

Please Log in or Create an account to join the conversation.

  • Martigen
More
7 years 6 months ago #7 by Martigen Replied by Martigen on topic HDR equivalent for Reshade 3?

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
More
7 years 6 months ago #8 by Martigen Replied by Martigen on topic HDR equivalent for Reshade 3?

moriz1 wrote: ask, and ye shall receive (copypaste this as DPX.fx in your shaders folder):

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?

@Crosire, in case you can see anything in the code.

Please Log in or Create an account to join the conversation.

  • moriz1
More
7 years 6 months ago #9 by moriz1 Replied by moriz1 on topic HDR equivalent for Reshade 3?
I'll look it over when i get home next week. i did notice that certain settings created some very psychedelic results.

Please Log in or Create an account to join the conversation.

  • CrazyCat
More
7 years 6 months ago #10 by CrazyCat Replied by CrazyCat on topic HDR equivalent for Reshade 3?
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.

  • Martigen
More
7 years 6 months ago #11 by Martigen Replied by Martigen on topic HDR equivalent for Reshade 3?

CrazyCat 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.

No that's not it, tried that :)

Please Log in or Create an account to join the conversation.

  • NerdDefender
  • Topic Author
More
7 years 6 months ago #12 by NerdDefender Replied by NerdDefender on topic HDR equivalent for Reshade 3?
I can confirm. With minimal settings, the screen looks bluish to me. You can manipulate that effect by messing with BlueC, but it still looks overall too bright. Plus, changing the settings ColorGamma, and DPXSaturation appears to have no effect when set from the above values to 1.0.

Please Log in or Create an account to join the conversation.

  • CrazyCat
More
7 years 6 months ago #13 by CrazyCat Replied by CrazyCat on topic HDR equivalent for Reshade 3?
B.rgb = lerp(B.rgb, c0, Blend);
I think B in this lerp function is supposed be in original value.
A quick fix would be to change that line to
B.rgb = lerp(Bn.rgb, c0, Blend);
and uncomment the line
//float3 Bn = B;

Please Log in or Create an account to join the conversation.

  • moriz1
More
7 years 6 months ago #14 by moriz1 Replied by moriz1 on topic HDR equivalent for Reshade 3?

CrazyCat wrote:

B.rgb = lerp(B.rgb, c0, Blend);
I think B in this lerp function is supposed be in original value.
A quick fix would be to change that line to
B.rgb = lerp(Bn.rgb, c0, Blend);
and uncomment the line
//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
More
7 years 6 months ago #15 by Ioxa Replied by Ioxa on topic HDR equivalent for Reshade 3?
Looks like you guys may have figured out the issue but you can try this out if not. I didn't touch the original code so if this still doesn't look right then the problem must be somewhere else.
/*
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;
	}
}
The following user(s) said Thank You: Razed, NerdDefender

Please Log in or Create an account to join the conversation.

  • Razed
More
7 years 6 months ago - 7 years 6 months ago #16 by Razed Replied by Razed on topic HDR equivalent for Reshade 3?
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:
/*------------------------------------------------------------------------------
						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;
	}
}
Last edit: 7 years 6 months ago by Razed.
The following user(s) said Thank You: Gar Stazi

Please Log in or Create an account to join the conversation.

  • Ioxa
More
7 years 6 months ago #17 by Ioxa Replied by Ioxa on topic HDR equivalent for Reshade 3?

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!


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.

Warning: Spoiler!
The following user(s) said Thank You: Razed

Please Log in or Create an account to join the conversation.

  • ibbanez
More
7 years 5 months ago #18 by ibbanez Replied by ibbanez on topic HDR equivalent for Reshade 3?
Just wanted to say thanks for the DPX guys. I was waiting for this and its running great for me now in my new preset Im making.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.