Welcome, Guest.
Username: Password: Remember me

TOPIC: Hue/brightness/contrast/saturation shift

Hue/brightness/contrast/satura​tion shift 11 months 3 weeks ago #1

  • 63OR63
  • 63OR63's Avatar
  • Offline
  • Posts: 3
  • Thank you received: 11
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: 11 months 2 weeks ago by 63OR63.
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick, v00d00m4n, andrew, Ryukou36, Rudy102, Dazaster, hunt1hunt

Hue/brightness/contrast/satura​tion shift 7 months 5 hours ago #2

  • Dazaster
  • Dazaster's Avatar
  • Offline
  • Posts: 5
  • Thank you received: 2
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 administrator has disabled public write access.
The following user(s) said Thank You: jas01

Hue/brightness/contrast/satura​tion shift 6 months 3 weeks ago #3

  • v00d00m4n
  • v00d00m4n's Avatar
  • Offline
  • Posts: 72
  • Thank you received: 18
Huewy? I hope you are not russian and don't mean "Хуевый".
The administrator has disabled public write access.
The following user(s) said Thank You: @rnkrnt