Hue/brightness/contrast/saturation shift

More
4 years 3 weeks ago - 4 years 3 weeks ago #1 by 63OR63
A small shader for ReShade 3 to change hue, brightness, contrast and saturation. Use it as you wish.
uniform float Hue <
	ui_type = "drag";
	ui_min = -180.0; ui_max = 180.0;
	ui_tooltip = "Hue";
> = 0.0;
uniform float Brightness <
	ui_type = "drag";
	ui_min = -1.0; ui_max = 1.0;
	ui_tooltip = "Brightness";
> = 0.0;
uniform float Contrast <
	ui_type = "drag";
	ui_min = 0.0; ui_max = 1.0;
	ui_tooltip = "Contrast";
> = 0.0;
uniform float Saturation <
	ui_type = "drag";
	ui_min = 0.0; ui_max = 2.0;
	ui_tooltip = "Saturation";
> = 1.0;

#include "Reshade.fxh"

float3x3 QuaternionToMatrix(float4 quat)
{
	float3 cross = quat.yzx * quat.zxy;
	float3 square= quat.xyz * quat.xyz;
	float3 wimag = quat.w * quat.xyz;

	square = square.xyz + square.yzx;

	float3 diag = 0.5 - square;
	float3 a = (cross + wimag);
	float3 b = (cross - wimag);

	return float3x3(
	2.0 * float3(diag.x, b.z, a.y),
	2.0 * float3(a.z, diag.y, b.x),
	2.0 * float3(b.y, a.x, diag.z));
}

float4 PS_ColorShift(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
	float4 outputColor = tex2D(ReShade::BackBuffer, texcoord);
	float3 intensity;           
	float3 root3 = float3(0.57735, 0.57735, 0.57735);
	float half_angle = 0.5 * radians(Hue);
	float4 rot_quat = float4( (root3 * sin(half_angle)), cos(half_angle));
	float3x3 rot_Matrix = QuaternionToMatrix(rot_quat);     
	outputColor.rgb = mul(rot_Matrix, outputColor.rgb);
	outputColor.rgb = (outputColor.rgb - 0.5) *(Contrast + 1.0) + 0.5;  
	outputColor.rgb = outputColor.rgb + Brightness;         
	float3 lumCoeff = float3(0.2125, 0.7154, 0.0721);
	intensity = float(dot(outputColor.rgb, lumCoeff));
	outputColor.rgb = lerp(intensity, outputColor.rgb, Saturation);            

	return outputColor;
}

technique ColorShift
{
	pass HudPass
	{
		VertexShader = PostProcessVS;
		PixelShader = PS_ColorShift;
	}
}
Last edit: 4 years 3 weeks ago by 63OR63.
The following user(s) said Thank You: Wicked Sick, v00d00m4n, andrew, Ryukou36, Rudy102, Dazaster, hunt1hunt, Puxirepublic, pyewacket

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

More
3 years 8 months ago #2 by Dazaster
Replied by Dazaster on topic Hue/brightness/contrast/saturation shift
I'd been playing all afternoon with my Witcher 3 preset, balancing Curves and Levels etc, and the final was a little too dark, so came here to see if there was something with just a brightness control when I saw this. Don't know why I've missed it before. This is great fun to play with, changing overall hues and such, plus I replaced Levels and Curves with the contrast setting. I've named him Huewy, and he's my new favorite pet :lol:
The following user(s) said Thank You: jas01

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

More
3 years 7 months ago #3 by v00d00m4n
Replied by v00d00m4n on topic Hue/brightness/contrast/saturation shift
Huewy? I hope you are not russian and don't mean "Хуевый".
The following user(s) said Thank You: @rnkrnt

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

More
2 years 4 months ago #4 by Jerwin
Replied by Jerwin on topic Hue/brightness/contrast/saturation shift
Thank you for this shader!
I wish it were included in the selection of shaders downloaded by the Reshade installer.

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

More
1 year 2 weeks ago #5 by Inquisitor.77
Replied by Inquisitor.77 on topic Hue/brightness/contrast/saturation shift
Hey, there. Came across this shader and would like to try it out. Is it included in the latest version of ReShade? If not what type of file should I save it as, .ini, .cfg, .fx or .fxh? Thanks in advance.

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

More
1 year 1 week ago #6 by crosire
Replied by crosire on topic Hue/brightness/contrast/saturation shift
It's not. Create a new text file, copy contents into it, save it as ".fx" in game directory. ReShade will pick it up next launch.
The following user(s) said Thank You: Inquisitor.77

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

More
1 year 1 week ago #7 by Inquisitor.77
Replied by Inquisitor.77 on topic Hue/brightness/contrast/saturation shift
Thanks for the reply. Love playing games with ReShade. It's mind-blowing with it and disappointing without. I don't know how you work your magic, but I'm glad you do. On a side note, now that the sfx.lazy site is down, would you happen to know where I could turn to download presets? I search the nexus often but don't always find what I'm looking for. Take care, Crosire.

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