Ported ReShade 2.x effects
- Insomnia
- Topic Author
Hey everybody!
ReShade 3.x is great, no doubt! And even if it still comes with its own set of effects, I liked some of the effects in 2.x.
So I ported a few to ReShade 3.x, all with GUI annotations (however some shaders doesn't come with any available knobs).
Current list of ported effects:
- Chromatic Abberation (from SweetFX)
- Color Mod
- Color Mood
- Cross Process
- Custom Tone map
- HPD Tone mapping
- Reinhard (Marty McFly's version)
- Reinhard Linear
- Sin City
- Two versions of Fisheye CA lens distortion (horizontal version similar to Resident Evil 7 and P.T Demo, and vertical lens distortion)
- Emboss
- Spherical Tonemap
- Hue FX
- Watch Dogs Tonemapping
- Grain
- Gr8mmFilm (see screenshot)
Installation
Create an empty text file in reshade-shaders\Shaders, copy the code, and paste it in your text file, save it as something practical and end it with the .fx extension.
Example: Colormood.fx
Shaders
_________________________________________
Chromatic Abberation
/**
* Chromatic Aberration
* by Christian Cann Schuldt Jensen ~ CeeJay.dk
*
* Distorts the image by shifting each color component, which creates color artifacts similar to those in a very cheap lens or a cheap sensor.
*
* Ported to ReShade 3.x by Insomnia
*
*/
uniform float2 Shift <
ui_type = "drag";
ui_min = -10; ui_max = 10;
ui_tooltip = "Distance (X,Y) in pixels to shift the color components. For a slightly blurred look try fractional values (.5) between two pixels.";
> = float2(2.5, -0.5);
uniform float Strength <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
> = 0.5;
#include "ReShade.fxh"
float3 ChromaticAberrationPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color, colorInput = tex2D(ReShade::BackBuffer, texcoord).rgb;
// Sample the color components
color.r = tex2D(ReShade::BackBuffer, texcoord + (ReShade::PixelSize * Shift)).r;
color.g = colorInput.g;
color.b = tex2D(ReShade::BackBuffer, texcoord - (ReShade::PixelSize * Shift)).b;
// Adjust the strength of the effect
return lerp(colorInput, color, Strength);
}
technique CA
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ChromaticAberrationPass;
}
}
Color Mod
/*
Full credits to the ReShade team
Ported by Insomnia
*/
//-----------------------------
uniform float ColormodChroma <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Saturation";
ui_tooltip = "Amount of saturation";
> = 0.780;
//-----------------------------
uniform float ColormodGammaR <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Gamma for Red";
ui_tooltip = "Gamma for Red";
> = 1.0;
uniform float ColormodGammaG <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Gamma for Green";
ui_tooltip = "Gamma for Green";
> = 1.0;
uniform float ColormodGammaB <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Gamma for Blue";
ui_tooltip = "Gamma for Blue";
> = 1.0;
//-----------------------------
uniform float ColormodContrastR <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Contrast for Red";
ui_tooltip = "Contrast for Red";
> = 0.50;
uniform float ColormodContrastG <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Contrast for Green";
ui_tooltip = "Contrast for Green";
> = 0.50;
uniform float ColormodContrastB <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Contrast for Blue";
ui_tooltip = "Contrast for Blue";
> = 0.50;
//-----------------------------
uniform float ColormodBrightnessR <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Brightness for Red";
ui_tooltip = "Brightness for Red";
> = -0.08;
uniform float ColormodBrightnessG <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Brightness for Green";
ui_tooltip = "Brightness for Green";
> = -0.08;
uniform float ColormodBrightnessB <
ui_type = "drag";
ui_min = -1.0; ui_max = 2.0;
ui_label = "Brightness for Green";
ui_tooltip = "Brightness for Green";
> = -0.08;
//-----------------------------
//-----------------------------
//-----------------------------
#include "ReShade.fxh"
float3 ColorModPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
//float3 x = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
color.xyz = (color.xyz - dot(color.xyz, 0.333)) * ColormodChroma + dot(color.xyz, 0.333);
color.xyz = saturate(color.xyz);
color.x = (pow(color.x, ColormodGammaR) - 0.5) * ColormodContrastR + 0.5 + ColormodBrightnessR;
color.y = (pow(color.y, ColormodGammaG) - 0.5) * ColormodContrastG + 0.5 + ColormodBrightnessB;
color.z = (pow(color.z, ColormodGammaB) - 0.5) * ColormodContrastB + 0.5 + ColormodBrightnessB;
return color.rgb;
}
technique ColorMod
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ColorModPass;
}
}
Color mood
/*
Full credits to the ReShade team
*/
//Amateur port by Insomnia
uniform float fRatio <
ui_type = "drag";
ui_min = 0.0; ui_max = 3.0;
ui_label = "Strength";
ui_tooltip = "Amount of moody coloring you want";
> = 0.250;
uniform float moodR <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_label = "Red";
ui_tooltip = "How strong dark red colors shall be boosted";
> = 1.0;
uniform float moodG <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_label = "Green";
ui_tooltip = "How strong dark green colors shall be boosted";
> = 1.0;
uniform float moodB <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_label = "Blue";
ui_tooltip = "How strong dark blue colors shall be boosted";
> = 1.0;
#include "ReShade.fxh"
float3 ColorMoodPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
//float3 x = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 colInput = color.rgb;
float3 colMood = 1.0f;
colMood.r = moodR;
colMood.g = moodG;
colMood.b = moodB;
float fLum = ( colInput.r + colInput.g + colInput.b ) / 3;
colMood = lerp(0, colMood, saturate(fLum * 2.0));
colMood = lerp(colMood, 1, saturate(fLum - 0.5) * 2.0);
float3 colOutput = lerp(colInput, colMood, saturate(fLum * fRatio));
color.rgb=max(0, colOutput);
return color.rgb;
}
technique ColorMood
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ColorMoodPass;
}
}
Custom Tone Mapping
/*
Original code by Marty McFly
Amateur port by Insomnia
*/
#include "ReShade.fxh"
float3 CustomToneMapPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 x = tex2D(ReShade::BackBuffer, texcoord).rgb;
const float A = 0.665f;
const float B = 0.09f;
const float C = 0.004f;
const float D = 0.445f;
const float E = 0.26f;
const float F = 0.025f;
const float G = 0.16f;//0.145f;
const float H = 1.1844f;//1.15f;
// gamma space or not?
return (((x*(A*x+B)+C)/(x*(D*x+E)+F))-G) / H;
}
technique CustomToneMap
{
pass
{
VertexShader = PostProcessVS;
PixelShader = CustomToneMapPass;
}
}
Cross Process
/*
Credits to opezdl/AgainstAllAuthority and The ReShade team
Amateur port by Insomnia
*/
uniform float CrossContrast <
ui_type = "drag";
ui_min = 0.50; ui_max = 2.0;
ui_tooltip = "Contrast";
> = 1.0;
uniform float CrossSaturation <
ui_type = "drag";
ui_min = 0.50; ui_max = 2.00;
ui_tooltip = "Saturation";
> = 1.0;
uniform float CrossBrightness <
ui_type = "drag";
ui_min = -1.000; ui_max = 1.000;
ui_tooltip = "Brightness";
> = 0.0;
uniform float CrossAmount <
ui_type = "drag";
ui_min = 0.05; ui_max = 1.50;
ui_tooltip = "Cross Amount";
> = 0.50;
#include "ReShade.fxh"
float3 CrossPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float2 CrossMatrix [3] = {
float2 (1.03, 0.04),
float2 (1.09, 0.01),
float2 (0.78, 0.13),
};
float3 image1 = color.rgb;
float3 image2 = color.rgb;
float gray = dot(float3(0.5,0.5,0.5), image1);
image1 = lerp (gray, image1,CrossSaturation);
image1 = lerp (0.35, image1,CrossContrast);
image1 +=CrossBrightness;
image2.r = image1.r * CrossMatrix[0].x + CrossMatrix[0].y;
image2.g = image1.g * CrossMatrix[1].x + CrossMatrix[1].y;
image2.b = image1.b * CrossMatrix[2].x + CrossMatrix[2].y;
color.rgb = lerp(image1, image2, CrossAmount);
return color;
}
technique Cross
{
pass
{
VertexShader = PostProcessVS;
PixelShader = CrossPass;
}
}
Haarm Peter Duiker (HPD) Filmic Tone mapping
/*
Original code by Ubisoft
Full credits to the ReShade team
Ported by Insomnia
*/
// Tonemapping used in Watch Dogs, ripped from the Watch Dogs shaders themselves.
#include "ReShade.fxh"
float3 HPDPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 x = tex2D(ReShade::BackBuffer, texcoord).rgb;
x = max( (float3)0.0f, x - 0.004f );
return pow( abs( ( x * ( 6.2f * x + 0.5f ) ) / ( x * ( 6.2f * x + 1.7f ) + 0.06 ) ), 2.2f );
}
technique HaarmPeterDuikerFilmicToneMapping
{
pass
{
VertexShader = PostProcessVS;
PixelShader = HPDPass;
}
}
Reinhard
/*
Original code by Marty McFly
Amateur port by Insomnia
*/
uniform float ReinhardWhitepoint <
ui_type = "drag";
ui_min = 0.0; ui_max = 10.0;
ui_tooltip = "how steep the color curve is at linear point";
> = 1.250;
uniform float ReinhardScale <
ui_type = "drag";
ui_min = 0.0; ui_max = 3.0;
ui_tooltip = "how steep the color curve is at linear point";
> = 0.50;
#include "ReShade.fxh"
float3 ReinhardPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 x = tex2D(ReShade::BackBuffer, texcoord).rgb;
const float W = ReinhardWhitepoint; // Linear White Point Value
const float K = ReinhardScale; // Scale
// gamma space or not?
return (1 + K * x / (W * W)) * x / (x + K);
}
technique Reinhard
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ReinhardPass;
}
}
Reinhard Linear
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//LICENSE AGREEMENT AND DISTRIBUTION RULES:
//1 Copyrights of the Master Effect exclusively belongs to author - Gilcher Pascal aka Marty McFly.
//2 Master Effect (the SOFTWARE) is DonateWare application, which means you may or may not pay for this software to the author as donation.
//3 If included in ENB presets, credit the author (Gilcher Pascal aka Marty McFly).
//4 Software provided "AS IS", without warranty of any kind, use it on your own risk.
//5 You may use and distribute software in commercial or non-commercial uses. For commercial use it is required to warn about using this software (in credits, on the box or other places). Commercial distribution of software as part of the games without author permission prohibited.
//6 Author can change license agreement for new versions of the software.
//7 All the rights, not described in this license agreement belongs to author.
//8 Using the Master Effect means that user accept the terms of use, described by this license agreement.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//For more information about license agreement contact me:
//https://www.facebook.com/MartyMcModding
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Copyright (c) 2009-2015 Gilcher Pascal aka Marty McFly
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Credits :: Ubisoft
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Amateur port by Insomnia
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
uniform float ReinhardLinearSlope <
ui_type = "drag";
ui_min = 1.0; ui_max = 5.0;
ui_tooltip = "how steep the color curve is at linear point";
> = 1.250;
uniform float ReinhardLinearWhitepoint <
ui_type = "drag";
ui_min = 0.0; ui_max = 20.0;
ui_tooltip = "...";
> = 1.250;
uniform float ReinhardLinearPoint <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_tooltip = "...";
> = 0.150;
#include "ReShade.fxh"
float3 ReinhardLinearPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 x = color.rgb;
//float x = color;
const float W = ReinhardLinearWhitepoint; // Linear White Point Value
const float L = ReinhardLinearPoint; // Linear point
const float C = ReinhardLinearSlope; // Slope of the linear section
const float K = (1 - L * C) / C; // Scale (fixed so that the derivatives of the Reinhard and linear functions are the same at x = L)
float3 reinhard = L * C + (1 - L * C) * (1 + K * (x - L) / ((W - L) * (W - L))) * (x - L) / (x - L + K);
// gamma space or not?
color.rgb = (x > L) ? reinhard : C * x;
return color;
}
technique ReinhardLinear
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ReinhardLinearPass;
}
}
Sin city
/*
Full credits to the ReShade team
Ported by Insomnia
*/
#include "ReShade.fxh"
float3 SincityPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float sinlumi = dot(color.rgb, float3(0.30f,0.59f,0.11f));
if(color.r > (color.g + 0.2f) && color.r > (color.b + 0.025f))
{
color.rgb = float3(sinlumi, 0, 0)*1.5;
}
else
{
color.rgb = sinlumi;
}
return color.rgb;
}
technique Sincity
{
pass
{
VertexShader = PostProcessVS;
PixelShader = SincityPass;
}
}
Fisheye Horizontal
/*
Credits :: icelaglace, a.o => (ported from some blog, author unknown)
Credits :: Pascal aka Marty McFly
Amateur port by Insomnia
*/
uniform float fFisheyeZoom <
ui_type = "drag";
ui_min = 0.5; ui_max = 1.0;
ui_label = "Fish Eye Zoom";
ui_tooltip = "Lens zoom to hide bugged edges due to texcoord modification";
> = 0.55;
uniform float fFisheyeDistortion <
ui_type = "drag";
ui_min = -0.300; ui_max = 0.300;
ui_label = "Fisheye Distortion";
ui_tooltip = "Distortion of image";
> = 0.01;
uniform float fFisheyeDistortionCubic <
ui_type = "drag";
ui_min = -0.300; ui_max = 0.300;
ui_label = "Fisheye Distortion Cubic";
ui_tooltip = "Distortion of image, cube based";
> = 0.7;
uniform float fFisheyeColorshift <
ui_type = "drag";
ui_min = -0.10; ui_max = 0.10;
ui_label = "Colorshift";
ui_tooltip = "Amount of color shifting";
> = 0.002;
#include "ReShade.fxh"
float3 FISHEYE_CAPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float4 coord=0.0;
coord.xy=texcoord.xy;
coord.w=0.0;
color.rgb = 0.0;
float3 eta = float3(1.0+fFisheyeColorshift*0.9,1.0+fFisheyeColorshift*0.6,1.0+fFisheyeColorshift*0.3);
float2 center;
center.x = coord.x-0.5;
center.y = coord.y-0.5;
float LensZoom = 1.0/fFisheyeZoom;
float r2 = (texcoord.y-0.5) * (texcoord.y-0.5);// + (texcoord.y-0.5) * (texcoord.y-0.5);
float f = 0;
if( fFisheyeDistortionCubic == 0.0){
f = 1 + r2 * fFisheyeDistortion;
}else{
f = 1 + r2 * (fFisheyeDistortion + fFisheyeDistortionCubic * sqrt(r2));
};
float x = f*LensZoom*(coord.x-0.5)+0.5;
float y = f*LensZoom*(coord.y-0.5)+0.5;
float2 rCoords = (f*eta.r)*LensZoom*(center.xy*0.5)+0.5;
float2 gCoords = (f*eta.g)*LensZoom*(center.xy*0.5)+0.5;
float2 bCoords = (f*eta.b)*LensZoom*(center.xy*0.5)+0.5;
color.x = tex2D(ReShade::BackBuffer,rCoords).r;
color.y = tex2D(ReShade::BackBuffer,gCoords).g;
color.z = tex2D(ReShade::BackBuffer,bCoords).b;
return color.rgb;
}
technique FISHEYE_CA_HORIZONTAL
{
pass
{
VertexShader = PostProcessVS;
PixelShader = FISHEYE_CAPass;
}
}
Fisheye Vertical
/*
Credits :: icelaglace, a.o => (ported from some blog, author unknown)
Credits :: Pascal aka Marty McFly
Amateur port by Insomnia
*/
uniform float fFisheyeZoom <
ui_type = "drag";
ui_min = 0.5; ui_max = 1.0;
ui_label = "Fish Eye Zoom";
ui_tooltip = "Lens zoom to hide bugged edges due to texcoord modification";
> = 0.55;
uniform float fFisheyeDistortion <
ui_type = "drag";
ui_min = -0.300; ui_max = 0.300;
ui_label = "Fisheye Distortion";
ui_tooltip = "Distortion of image";
> = 0.01;
uniform float fFisheyeDistortionCubic <
ui_type = "drag";
ui_min = -0.300; ui_max = 0.300;
ui_label = "Fisheye Distortion Cubic";
ui_tooltip = "Distortion of image, cube based";
> = 0.7;
uniform float fFisheyeColorshift <
ui_type = "drag";
ui_min = -0.10; ui_max = 0.10;
ui_label = "Colorshift";
ui_tooltip = "Amount of color shifting";
> = 0.002;
#include "ReShade.fxh"
float3 FISHEYE_CAPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float4 coord=0.0;
coord.xy=texcoord.xy;
coord.w=0.0;
color.rgb = 0.0;
float3 eta = float3(1.0+fFisheyeColorshift*0.9,1.0+fFisheyeColorshift*0.6,1.0+fFisheyeColorshift*0.3);
float2 center;
center.x = coord.x-0.5;
center.y = coord.y-0.5;
float LensZoom = 1.0/fFisheyeZoom;
float r2 = (texcoord.x-0.5) * (texcoord.x-0.5);// + (texcoord.y-0.5) * (texcoord.y-0.5);
float f = 0;
if( fFisheyeDistortionCubic == 0.0){
f = 1 + r2 * fFisheyeDistortion;
}else{
f = 1 + r2 * (fFisheyeDistortion + fFisheyeDistortionCubic * sqrt(r2));
};
float x = f*LensZoom*(coord.x-0.5)+0.5;
float y = f*LensZoom*(coord.y-0.5)+0.5;
float2 rCoords = (f*eta.r)*LensZoom*(center.xy*0.5)+0.5;
float2 gCoords = (f*eta.g)*LensZoom*(center.xy*0.5)+0.5;
float2 bCoords = (f*eta.b)*LensZoom*(center.xy*0.5)+0.5;
color.x = tex2D(ReShade::BackBuffer,rCoords).r;
color.y = tex2D(ReShade::BackBuffer,gCoords).g;
color.z = tex2D(ReShade::BackBuffer,bCoords).b;
return color.rgb;
}
technique FISHEYE_CA_VERTICAL
{
pass
{
VertexShader = PostProcessVS;
PixelShader = FISHEYE_CAPass;
}
}
Emboss
/*
Full credits to the ReShade team
Ported by Insomnia
*/
uniform float fEmbossPower <
ui_type = "drag";
ui_min = 0.01; ui_max = 2.0;
ui_label = "Emboss Power";
> = 0.150;
uniform float fEmbossOffset <
ui_type = "drag";
ui_min = 0.1; ui_max = 5.0;
ui_label = "Emboss Offset";
> = 1.00;
uniform float iEmbossAngle <
ui_type = "drag";
ui_min = 0.0; ui_max = 360.0;
ui_label = "Emboss Angle";
> = 90.00;
#include "ReShade.fxh"
float3 EmbossPass(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
//float4 res = 0;
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float2 offset;
sincos(radians( iEmbossAngle), offset.y, offset.x);
float3 col1 = tex2D(ReShade::BackBuffer, texcoord - ReShade::PixelSize*fEmbossOffset*offset).rgb;
float3 col2 = color.rgb;
float3 col3 = tex2D(ReShade::BackBuffer, texcoord + ReShade::PixelSize*fEmbossOffset*offset).rgb;
float3 colEmboss = col1 * 2.0 - col2 - col3;
float colDot = max(0,dot(colEmboss, 0.333))*fEmbossPower;
float3 colFinal = col2 - colDot;
float luminance = dot( col2, float3( 0.6, 0.2, 0.2 ) );
color.xyz = lerp( colFinal, col2, luminance * luminance ).xyz;
return color;
}
technique Emboss_Tech
{
pass Emboss
{
VertexShader = PostProcessVS;
PixelShader = EmbossPass;
}
}
Spherical Tonemap
/*
Coded by Gilcher Pascal aka Marty McFly
Amateur port by Insomnia
*/
uniform float sphericalAmount <
ui_type = "drag";
ui_min = 0.00; ui_max = 2.00;
ui_label = "Spherical amount";
ui_tooltip = "Amount of spherical tonemapping applied...sort of";
> = 1.0;
#include "ReShade.fxh"
float3 SphericalPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 signedColor = color.rgb * 2.0 - 1.0;
float3 sphericalColor = sqrt(1.0 - signedColor.rgb * signedColor.rgb);
sphericalColor = sphericalColor * 0.5 + 0.5;
sphericalColor *= color.rgb;
color.rgb += sphericalColor.rgb * sphericalAmount;
color.rgb *= 0.95;
return color.rgb;
}
technique SphericalTonemap
{
pass
{
VertexShader = PostProcessVS;
PixelShader = SphericalPass;
}
}
Hue FX
/*
Coded by Prod80
Ported to ReShade 3.x by Insomnia
*/
#include "ReShade.fxh"
uniform float hueMid <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Hue Mid";
ui_tooltip = "Hue (rotation around the color wheel) of the color which you want to keep";
> = 0.6;
uniform float hueRange <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Hue Range";
ui_tooltip = "Range of different hue's around the hueMid that will also kept";
> = 0.1;
uniform float satLimit <
ui_type = "drag";
ui_min = 0.1; ui_max = 4.0;
ui_label = "Saturation Limit";
ui_tooltip = "Saturation control, better keep it higher than 0 for strong colors in contrast to the gray stuff around";
> = 2.9;
uniform float fxcolorMix <
ui_type = "drag";
ui_min = 0.0; ui_max = 1.0;
ui_label = "Color Mix";
ui_tooltip = "Interpolation between the original and the effect, 0 means full original image, 1 means full grey-color image";
> = 2.9;
#define Use_COLORSAT 0 //[0:1] //-This will use original color saturation as an added limiter to the strength of the effect
#define LumCoeff float3(0.212656, 0.715158, 0.072186)
float smootherstep(float edge0, float edge1, float x)
{
x = clamp((x - edge0)/(edge1 - edge0), 0.0, 1.0);
return x*x*x*(x*(x*6 - 15) + 10);
}
float3 Hue(in float3 RGB)
{
// Based on work by Sam Hocevar and Emil Persson
float Epsilon = 1e-10;
float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0/3.0) : float4(RGB.gb, 0.0, -1.0/3.0);
float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
float C = Q.x - min(Q.w, Q.y);
float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z);
return float3(H, C, Q.x);
}
float3 HUEFXPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float3 fxcolor = saturate( color.xyz );
float greyVal = dot( fxcolor.xyz, LumCoeff.xyz );
float3 HueSat = Hue( fxcolor.xyz );
float colorHue = HueSat.x;
float colorInt = HueSat.z - HueSat.y * 0.5;
float colorSat = HueSat.y / ( 1.0 - abs( colorInt * 2.0 - 1.0 ) * 1e-10 );
//When color intensity not based on original saturation level
if ( Use_COLORSAT == 0 ) colorSat = 1.0f;
float hueMin_1 = hueMid - hueRange;
float hueMax_1 = hueMid + hueRange;
float hueMin_2 = 0.0f;
float hueMax_2 = 0.0f;
if ( hueMin_1 < 0.0 )
{
hueMin_2 = 1.0f + hueMin_1;
hueMax_2 = 1.0f + hueMid;
if ( colorHue >= hueMin_1 && colorHue <= hueMid )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, smootherstep( hueMin_1, hueMid, colorHue ) * ( colorSat * satLimit ));
else if ( colorHue >= hueMid && colorHue <= hueMax_1 )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, ( 1.0f - smootherstep( hueMid, hueMax_1, colorHue )) * ( colorSat * satLimit ));
else if ( colorHue >= hueMin_2 && colorHue <= hueMax_2 )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, smootherstep( hueMin_2, hueMax_2, colorHue ) * ( colorSat * satLimit ));
else
fxcolor.xyz = greyVal.xxx;
}
else if ( hueMax_1 > 1.0 )
{
hueMin_2 = 0.0f - ( 1.0f - hueMid );
hueMax_2 = hueMax_1 - 1.0f;
if ( colorHue >= hueMin_1 && colorHue <= hueMid )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, smootherstep( hueMin_1, hueMid, colorHue ) * ( colorSat * satLimit ));
else if ( colorHue >= hueMid && colorHue <= hueMax_1 )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, ( 1.0f - smootherstep( hueMid, hueMax_1, colorHue )) * ( colorSat * satLimit ));
else if ( colorHue >= hueMin_2 && colorHue <= hueMax_2 )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, ( 1.0f - smootherstep( hueMin_2, hueMax_2, colorHue )) * ( colorSat * satLimit ));
else
fxcolor.xyz = greyVal.xxx;
}
else
{
if ( colorHue >= hueMin_1 && colorHue <= hueMid )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, smootherstep( hueMin_1, hueMid, colorHue ) * ( colorSat * satLimit ));
else if ( colorHue > hueMid && colorHue <= hueMax_1 )
fxcolor.xyz = lerp( greyVal.xxx, fxcolor.xyz, ( 1.0f - smootherstep( hueMid, hueMax_1, colorHue )) * ( colorSat * satLimit ));
else
fxcolor.xyz = greyVal.xxx;
}
color.xyz = lerp( color.xyz, fxcolor.xyz, fxcolorMix );
return color;
}
technique HueFX
{
pass
{
VertexShader = PostProcessVS;
PixelShader = HUEFXPass;
}
}
Watch Dogs Tonemapping
/*
Watch Dogs Tonemap:
Enables one of the numerous watch dogs tonemapping algorithms. No tweaking values.
Full credits to the ReShade team.
Ported by Insomnia
*/
#include "ReShade.fxh"
uniform float LinearWhite <
ui_label = "Tonemap - Curve";
ui_type = "drag";
ui_min = 0.5; ui_max = 2.0;
ui_step = 0.01;
> = 1.25;
uniform float LinearColor <
ui_label = "Tonemap - Whiteness";
ui_type = "drag";
ui_min = 0.5; ui_max = 2.0;
ui_step = 0.01;
> = 1.25;
float3 ColorFilmicToneMappingPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
float3 x = tex2D(ReShade::BackBuffer, texcoord);
// Filmic tone mapping
const float3 A = float3(0.55f, 0.50f, 0.45f); // Shoulder strength
const float3 B = float3(0.30f, 0.27f, 0.22f); // Linear strength
const float3 C = float3(0.10f, 0.10f, 0.10f); // Linear angle
const float3 D = float3(0.10f, 0.07f, 0.03f); // Toe strength
const float3 E = float3(0.01f, 0.01f, 0.01f); // Toe Numerator
const float3 F = float3(0.30f, 0.30f, 0.30f); // Toe Denominator
const float3 W = float3(2.80f, 2.90f, 3.10f); // Linear White Point Value
const float3 F_linearWhite = ((W*(A*W+C*B)+D*E)/(W*(A*W+B)+D*F))-(E/F);
float3 F_linearColor = ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-(E/F);
// gamma space or not?
//return pow(saturate(F_linearColor * 1.25 / F_linearWhite),1.25);
return pow(saturate(F_linearColor * LinearColor / F_linearWhite),LinearWhite);
}
technique WatchDogsTonemapping
{
pass
{
VertexShader = PostProcessVS;
PixelShader = ColorFilmicToneMappingPass;
}
}
Grain
/*
Film Grain post-process shader v1.1
Martins Upitis (martinsh) devlog-martinsh.blogspot.com
2013
--------------------------
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
So you are free to share, modify and adapt it for your needs, and even use it for commercial use.
I would also love to hear about a project you are using it.
Have fun,
Martins
--------------------------
Perlin noise shader by toneburst:
http://machinesdontcare.wordpress.com/2009/06/25/3d-perlin-noise-sphere-vertex-shader-sourcecode/
----------------------------------------------------------
Ported to Reshade by Angelo Gonzalez
----------------------------------------------------------
*/
//Preprocessor
#ifndef GrainColored
#define GrainColored 0 //[0:1] //-Whether grain should be colored or not. Colored grain is not as noticeable, so it helps to increase grain power.
#endif
//GUI available knobs
uniform float GrainPower <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_step = 0.01;
ui_tooltip = "Intensity of applied grain";
ui_label = "Strength";
> = 0.02;
uniform float GrainColorAmount <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_step = 0.01;
ui_tooltip = "Amount of colored grain: Enable GrainColored in preprocessor for this to have effect";
ui_label = "Color Amount";
> = 0.150;
uniform float GrainSize <
ui_type = "drag";
ui_min = 1.25; ui_max = 2.50;
ui_step = 0.05;
ui_tooltip = "Size of individual pieces of grain. Below 1.25 the pattern becomes noticeable";
ui_label = "Size";
> = 1.50;
uniform float GrainLuma <
ui_type = "drag";
ui_min = 0.0; ui_max = 2.0;
ui_step = 0.05;
ui_tooltip = "Grain brightness. 0 makes grain not visible";
ui_label = "Brightness";
> = 0.80;
/*
#define GrainPower 0.02 //[0.00:1.00] //-Intensity of applied grain
#define GrainColorAmount 1.00 //[0.00:1.00] //-Amount of color to add to grain
#define GrainSize 1.50 //[1.25:2.50] //-Size of individual pieces of grain. Below 1.25 the pattern becomes noticeable.
#define GrainLuma 0.80 //[0.00:1.00] //-Grain brightness. 0 makes grain not visible.
*/
#include "ReShade.fxh"
static const float width = BUFFER_WIDTH;
static const float height = BUFFER_HEIGHT;
uniform float timer < source = "timer"; >;
// a random texture generator, but you can also use a pre-computed perturbation texture
float4 rnm(in float2 tc)
{
float noise = sin(dot(float3(tc.x, tc.y, timer), float3(12.9898, 78.233, 0.0025216))) * 43758.5453;
float noiseR = frac(noise)*2.0-1.0;
float noiseG = frac(noise*1.2154)*2.0-1.0;
float noiseB = frac(noise*1.3453)*2.0-1.0;
float noiseA = frac(noise*1.3647)*2.0-1.0;
return float4(noiseR,noiseG,noiseB,noiseA);
}
float fade(in float t) {
return t*t*t*(t*(t*6.0-15.0)+10.0);
}
float pnoise3D(in float3 p)
{
static const float permTexUnit = 1.0/256.0; // Perm texture texel-size
static const float permTexUnitHalf = 0.5/256.0; // Half perm texture texel-size
float3 pi = permTexUnit*floor(p)+permTexUnitHalf; // Integer part, scaled so +1 moves permTexUnit texel
// and offset 1/2 texel to sample texel centers
float3 pf = frac(p); // Fractional part for interpolation
// Noise contributions from (x=0, y=0), z=0 and z=1
float perm00 = rnm(pi.xy).a ;
float3 grad000 = rnm(float2(perm00, pi.z)).rgb * 4.0 - 1.0;
float n000 = dot(grad000, pf);
float3 grad001 = rnm(float2(perm00, pi.z + permTexUnit)).rgb * 4.0 - 1.0;
float n001 = dot(grad001, pf - float3(0.0, 0.0, 1.0));
// Noise contributions from (x=0, y=1), z=0 and z=1
float perm01 = rnm(pi.xy + float2(0.0, permTexUnit)).a ;
float3 grad010 = rnm(float2(perm01, pi.z)).rgb * 4.0 - 1.0;
float n010 = dot(grad010, pf - float3(0.0, 1.0, 0.0));
float3 grad011 = rnm(float2(perm01, pi.z + permTexUnit)).rgb * 4.0 - 1.0;
float n011 = dot(grad011, pf - float3(0.0, 1.0, 1.0));
// Noise contributions from (x=1, y=0), z=0 and z=1
float perm10 = rnm(pi.xy + float2(permTexUnit, 0.0)).a ;
float3 grad100 = rnm(float2(perm10, pi.z)).rgb * 4.0 - 1.0;
float n100 = dot(grad100, pf - float3(1.0, 0.0, 0.0));
float3 grad101 = rnm(float2(perm10, pi.z + permTexUnit)).rgb * 4.0 - 1.0;
float n101 = dot(grad101, pf - float3(1.0, 0.0, 1.0));
// Noise contributions from (x=1, y=1), z=0 and z=1
float perm11 = rnm(pi.xy + float2(permTexUnit, permTexUnit)).a ;
float3 grad110 = rnm(float2(perm11, pi.z)).rgb * 4.0 - 1.0;
float n110 = dot(grad110, pf - float3(1.0, 1.0, 0.0));
float3 grad111 = rnm(float2(perm11, pi.z + permTexUnit)).rgb * 4.0 - 1.0;
float n111 = dot(grad111, pf - float3(1.0, 1.0, 1.0));
// Blend contributions along x
float4 n_x = lerp(float4(n000, n001, n010, n011), float4(n100, n101, n110, n111), fade(pf.x));
// Blend contributions along y
float2 n_xy = lerp(n_x.xy, n_x.zw, fade(pf.y));
// Blend contributions along z
float n_xyz = lerp(n_xy.x, n_xy.y, fade(pf.z));
// We're done, return the final noise value.
return n_xyz;
}
//2d coordinate orientation thing
float2 coordRot(in float2 tc, in float angle)
{
float aspectr = width/height;
float rotX = ((tc.x*2.0-1.0)*aspectr*cos(angle)) - ((tc.y*2.0-1.0)*sin(angle));
float rotY = ((tc.y*2.0-1.0)*cos(angle)) + ((tc.x*2.0-1.0)*aspectr*sin(angle));
rotX = ((rotX/aspectr)*0.5+0.5);
rotY = rotY*0.5+0.5;
return float2(rotX,rotY);
}
float4 GrainPass(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
float grainamount = GrainPower;
int colored = GrainColored;
float coloramount = GrainColorAmount;
float grainsize = GrainSize;
float lumamount = GrainLuma;
float width = BUFFER_WIDTH;
float height = BUFFER_HEIGHT;
float3 rotOffset = float3(1.425,3.892,5.835); //rotation offset values
float2 rotCoordsR = coordRot(texcoord, timer + rotOffset.x);
float2 rot = rotCoordsR*float2(width/grainsize,height/grainsize);
float pNoise = pnoise3D(float3(rot.x,rot.y,0.0));
float3 noise = float3(pNoise, pNoise, pNoise);
if (colored == 1)
{
float2 rotCoordsG = coordRot(texcoord, timer + rotOffset.y);
float2 rotCoordsB = coordRot(texcoord, timer + rotOffset.z);
noise.g = lerp(noise.r,pnoise3D(float3(rotCoordsG*float2(width/grainsize,height/grainsize),1.0)),coloramount);
noise.b = lerp(noise.r,pnoise3D(float3(rotCoordsB*float2(width/grainsize,height/grainsize),2.0)),coloramount);
}
float3 col = tex2D(ReShade::BackBuffer, texcoord).rgb;
//noisiness response curve based on scene luminance
float3 lumcoeff = float3(0.299,0.587,0.114);
float luminance = lerp(0.0,dot(col, lumcoeff),lumamount);
float lum = smoothstep(0.2,0.0,luminance);
lum += luminance;
float2 thepow = pow(lum, 4.0);
noise = lerp(noise,float3(0.0, 0.0, 0.0),pow(lum,4.0));
col += noise*grainamount;
return float4(col,1.0);
}
technique Grain_Tech
{
pass
{
VertexShader = PostProcessVS;
PixelShader = GrainPass;
}
}
Gr8mmFilm
Download this file as it contains a texture:
Gr8mmFilm shader
Screenshot with Gr8mmFilm and a Sepia filter
_________________________________________
Disclaimer
I haven't written these effects, I've only converted them to fit ReShade 3.x. Some effects will probably not look exactly like before, and certain features like depth checks are disabled due to incompetence. I won't take requests.
Please Log in or Create an account to join the conversation.
- Insomnia
- Topic Author
Added Spherical Tonemap.
Added Hue FX.
Please Log in or Create an account to join the conversation.
- Iddqd
Updated HueFX shader (Modded hueMid parameter range now it 0 to 360, added ability to disable HSL filter): pastebin.com/fT3327wE
Please Log in or Create an account to join the conversation.
- Marty McFly
Please Log in or Create an account to join the conversation.
- Insomnia
- Topic Author
Marty McFly wrote: I don't think that Cross Process was from me...I got it from some enbeffect.fx for GTA IV back in the days. I listed opezdl / AgainstAllAuthority as author in ME.
Thanks. Updated the info.
Please Log in or Create an account to join the conversation.
- XIIICaesar
Please Log in or Create an account to join the conversation.
- Insomnia
- Topic Author
Please Log in or Create an account to join the conversation.
- SmushrCZ
- Sh1nRa358
mega.nz/#!Gh13gTYb!tDyElZ3bzYJv7vqy458Ds5V3JXbxGI0X6UUtXgM-Jk8
Please Log in or Create an account to join the conversation.
- XIIICaesar
***Nevermind
Got it working . You need to change the preprocessor part of the shader to:
//Preprocessor
#ifndef GrainColored
#define GrainColored 0 //[0:1] //-Whether grain should be colored or not. Colored grain is not as noticeable, so it helps to increase grain power.
#endif
Please Log in or Create an account to join the conversation.
- Insomnia
- Topic Author
XIIICaesar wrote: I'm getting errors when using the preprocessor definition for Grain Color being enabled.
***Nevermind
Got it working . You need to change the preprocessor part of the shader to:It was missing #ifndef & #endif//Preprocessor #ifndef GrainColored #define GrainColored 0 //[0:1] //-Whether grain should be colored or not. Colored grain is not as noticeable, so it helps to increase grain power. #endif
Will do, thanks!
Please Log in or Create an account to join the conversation.
- crubino
SmushrCZ wrote: Could you do splitscreen.fx?
I'm trying to porting Ganossa's splitscreen.fx but somehow it end-up with blank screen like this:
something wrong with my texture (Buffer_Witdh; Buffer_Height, RGBA8, or COLOR) and sampler for grab the original images
I wise there is a Reshade::OriginalColor like what we have in Reshade 2.x
Please Log in or Create an account to join the conversation.
- mbah.primbon
Splitscreen
/**
* Splitscreen
* by Christian Cann Schuldt Jensen - Ceejay.dk
* Ported to ReShade 3.0+ by mbah.primbon
*
* Enables the before-and-after splitscreen comparison mode.
*
*
*
* NOTE : BackupBuffer technique should be on the first order.
* Splitscreen technique should be on the last.
*
* This is the correct technique order with Splitscreen
*
* BackupBuffer technique
* .... effect technique
* .... effect technique
* .... effect technique
* Splitscreen technique
*
*/
uniform int splitscreen_mode <
ui_type = "combo";
ui_items = "Vertical 50/50 split\0Vertical 25/50/25 split\0Vertical 50/50 angled split\0Horizontal 50/50 split\0Horizontal 25/50/25 split\0Vertical 50/50 curvy split\0";
> = 2;
//------------------------------------------------------------------------
#include "ReShade.fxh"
// Textures and samplers
texture OriginalColorTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
sampler OColorBuffer { Texture = OriginalColorTex; };
// Pixel shaders
void PS_BackupBuffer(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target)
{
color = tex2D(ReShade::BackBuffer, texcoord.xy);
}
float4 PS_Splitscreen(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
// -- Vertical 50/50 split --
if (splitscreen_mode == 0) {return (texcoord.x < 0.5) ? tex2D(ReShade::BackBuffer, texcoord) : tex2D(OColorBuffer, texcoord);}
// -- Vertical 25/50/25 split --
if (splitscreen_mode == 1) {float distance = abs(texcoord.x - 0.5); distance = saturate(distance - 0.25); return distance ? tex2D(ReShade::BackBuffer, texcoord) : tex2D(OColorBuffer, texcoord);}
// -- Vertical 50/50 angled split --
if (splitscreen_mode == 2) {float distance = ((texcoord.x - 3.0/8.0) + (texcoord.y * 0.25)); distance = saturate(distance - 0.25); return distance ? tex2D(OColorBuffer, texcoord) : tex2D(ReShade::BackBuffer, texcoord);}
// -- Horizontal 50/50 split --
if (splitscreen_mode == 3) {return (texcoord.y < 0.5) ? tex2D(ReShade::BackBuffer, texcoord) : tex2D(OColorBuffer, texcoord);}
// -- Horizontal 25/50/25 split --
if (splitscreen_mode == 4) {float distance = abs(texcoord.y - 0.5); distance = saturate(distance - 0.25); return distance ? tex2D(ReShade::BackBuffer, texcoord) : tex2D(OColorBuffer, texcoord);}
// -- Vertical 50/50 curvy split --
if (splitscreen_mode == 5) {float distance = (texcoord.x - 0.25) + (sin(texcoord.y * 10)*0.10); distance = saturate(distance - 0.25); return distance ? tex2D(OColorBuffer, texcoord) : tex2D(ReShade::BackBuffer, texcoord);}
return float4(0,0,0,0);
}
// Rendering passes
technique BackupBuffer
{
pass ColorBackup
{
VertexShader = PostProcessVS;
PixelShader = PS_BackupBuffer;
RenderTarget = OriginalColorTex;
}
}
technique Splitscreen
{
pass SplitscreenBegin
{
VertexShader = PostProcessVS;
PixelShader = PS_Splitscreen;
}
}
Please Log in or Create an account to join the conversation.
I need them for archival reasons.
Please Log in or Create an account to join the conversation.
- mbah.primbon
Please Log in or Create an account to join the conversation.
However, doing the AO only would still be easier and better for both parties.
Please Log in or Create an account to join the conversation.
- mbah.primbon
It should work fine on ReShade 3.0.8, i dont test it yet on other ReShade 3.0 version. Let me know if you got some trouble when use those shaders.
For SSAO, you'll need 'noise' texture, you can download it here .
Screen Space Ambient Occlusion
/**
* Screen Space Ambient Occlusion
* by Ethatron and Marty McFly
*
* Ported from ReShade Framework
* to ReShade 3.0+ by mbah.primbon
*
*/
//------------------- Non GUI Settings -------------------
#define AO_BLUR_STEPS 11 //Offset count for AO smoothening. Higher means more smooth AO but also blurrier AO.
#define AO_SHARPNESS 0.8 //AO sharpness, higher means more sharp geometry edges but noisier AO, less means smoother AO but blurry in the distance.
//-------------------- GUI Settings ----------------------
uniform bool bSSAODebug <
ui_label = "SSAO Debug View";
ui_tooltip = "Enables raw AO/IL output for debugging and tuning purposes.";
> = false;
uniform float fSSAOScale <
ui_type = "drag";
ui_min = 0.25; ui_max = 1.00;
ui_label = "SSAO Scale";
ui_tooltip = "Scale of AO resolution. Lower resolution means less pixels to process and more performance but also less quality.";
> = 1.00;
uniform float fSSAOFadeStart <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00; ui_step = 0.01;
ui_label = "SSAO Fade Start";
ui_tooltip = "Distance from camera where AO starts to fade out. 0.0 means camera itself, 1.0 means infinite distance.";
> = 0.40;
uniform float fSSAOFadeEnd <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00; ui_step = 0.01;
ui_label = "SSAO Fade End";
ui_tooltip = "Distance from camera where AO fades out completely. 0.0 means camera itself, 1.0 means infinite distance.";
> = 0.90;
uniform int iSSAOSamples <
ui_type = "drag";
ui_min = 16; ui_max = 128;
ui_label = "SSAO Samples";
ui_tooltip = "Amount of samples. Don't set too high or shader compilation time goes through the roof.";
> = 16;
uniform float fSSAOSamplingRange <
ui_type = "drag";
ui_min = 5.00; ui_max = 50.00; ui_step = 0.01;
ui_label = "SSAO Sampling Range";
ui_tooltip = "SSAO sampling range. High range values might need more samples so raise both.";
> = 25;
uniform float fSSAODarkeningAmount <
ui_type = "drag";
ui_min = 0.00; ui_max = 5.00; ui_step = 0.01;
ui_label = "SSAO Darkening Amount";
ui_tooltip = "Amount of SSAO corner darkening";
> = 1.50;
uniform float fSSAOBrighteningAmount <
ui_type = "drag";
ui_min = 0.00; ui_max = 5.00; ui_step = 0.01;
ui_label = "SSAO Darkening Amount";
ui_tooltip = "Amount of SSAO edge brightening";
> = 1.00;
//------------------------------------------------------------------------
#include "ReShade.fxh"
// Textures and samplers
texture texNoise <source = "noise.png";> {Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;};
texture texSSAO1 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA16F;};
texture texSSAO2 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA16F;};
sampler SamplerSSAO1 {Texture = texSSAO1;};
sampler SamplerSSAO2 {Texture = texSSAO2;};
sampler SamplerNoise {Texture = texNoise; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = Wrap; AddressV = Wrap;};
// Pixel shaders
void PS_AO_SSAO(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 Occlusion1R : SV_Target)
{
texcoord.xy /= fSSAOScale;
if(texcoord.x > 1.0 || texcoord.y > 1.0) discard;
//global variables
float fSceneDepthP = ReShade::GetLinearizedDepth(texcoord.xy).x;
float blurkey = fSceneDepthP;
if(fSceneDepthP > min(0.9999,fSSAOFadeEnd)) Occlusion1R = float4(0.5,0.5,0.5,blurkey);
else {
float offsetScale = fSSAOSamplingRange/10000;
float fSSAODepthClip = 10000000.0;
float3 vRotation = tex2Dlod(SamplerNoise, float4(texcoord.xy, 0, 0)).rgb - 0.5f;
float3x3 matRotate;
float hao = 1.0f / (1.0f + vRotation.z);
matRotate._m00 = hao * vRotation.y * vRotation.y + vRotation.z;
matRotate._m01 = -hao * vRotation.y * vRotation.x;
matRotate._m02 = -vRotation.x;
matRotate._m10 = -hao * vRotation.y * vRotation.x;
matRotate._m11 = hao * vRotation.x * vRotation.x + vRotation.z;
matRotate._m12 = -vRotation.y;
matRotate._m20 = vRotation.x;
matRotate._m21 = vRotation.y;
matRotate._m22 = vRotation.z;
float fOffsetScaleStep = 1.0f + 2.4f / iSSAOSamples;
float fAccessibility = 0;
int Sample_Scaled = iSSAOSamples;
#if(SSAO_SmartSampling==1)
if(fSceneDepthP > 0.5) Sample_Scaled=max(8,round(Sample_Scaled*0.5));
if(fSceneDepthP > 0.8) Sample_Scaled=max(8,round(Sample_Scaled*0.5));
#endif
float fAtten = 5000.0/fSSAOSamplingRange/(1.0+fSceneDepthP*10.0);
[loop]
for (int i = 0 ; i < (Sample_Scaled / 8) ; i++)
for (int x = -1 ; x <= 1 ; x += 2)
for (int y = -1 ; y <= 1 ; y += 2)
for (int z = -1 ; z <= 1 ; z += 2) {
//Create offset vector
float3 vOffset = normalize(float3(x, y, z)) * (offsetScale *= fOffsetScaleStep);
//Rotate the offset vector
float3 vRotatedOffset = mul(vOffset, matRotate);
//Center pixel's coordinates in screen space
float3 vSamplePos = float3(texcoord.xy, fSceneDepthP);
//Offset sample point
vSamplePos += float3(vRotatedOffset.xy, vRotatedOffset.z * fSceneDepthP);
//Read sample point depth
float fSceneDepthS = ReShade::GetLinearizedDepth(vSamplePos.xy).x;
//Discard if depth equals max
if (fSceneDepthS >= fSSAODepthClip)
fAccessibility += 1.0f;
else {
//Compute accessibility factor
float fDepthDist = abs(fSceneDepthP - fSceneDepthS);
float fRangeIsInvalid = saturate(fDepthDist*fAtten);
fAccessibility += lerp(fSceneDepthS > vSamplePos.z, 0.5f, fRangeIsInvalid);
}
}
//Compute average accessibility
fAccessibility = fAccessibility / Sample_Scaled;
Occlusion1R = float4(fAccessibility.xxx,blurkey);
}
}
void PS_AO_AOBlurV(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 Occlusion2R : SV_Target)
{
//It's better to do this here, upscaling must produce artifacts and upscale-> blur is better than blur -> upscale
//besides: code is easier an I'm very lazy :P
texcoord.xy *= fSSAOScale;
float sum,totalweight=0;
float4 base = tex2D(SamplerSSAO1, texcoord.xy), temp=0;
[loop]
for (int r = -AO_BLUR_STEPS; r <= AO_BLUR_STEPS; ++r)
{
float2 axis = float2(0.0, 1.0);
temp = tex2D(SamplerSSAO1, texcoord.xy + axis * ReShade::PixelSize * r);
float weight = AO_BLUR_STEPS-abs(r);
weight *= max(0.0, 1.0 - (1000.0 * AO_SHARPNESS) * abs(temp.w - base.w));
sum += temp.x * weight;
totalweight += weight;
}
Occlusion2R = float4(sum / (totalweight+0.0001),0,0,base.w);
}
void PS_AO_AOBlurH(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 Occlusion1R : SV_Target)
{
float sum,totalweight=0;
float4 base = tex2D(SamplerSSAO2, texcoord.xy), temp=0;
[loop]
for (int r = -AO_BLUR_STEPS; r <= AO_BLUR_STEPS; ++r)
{
float2 axis = float2(1.0, 0.0);
temp = tex2D(SamplerSSAO2, texcoord.xy + axis * ReShade::PixelSize * r);
float weight = AO_BLUR_STEPS-abs(r);
weight *= max(0.0, 1.0 - (1000.0 * AO_SHARPNESS) * abs(temp.w - base.w));
sum += temp.x * weight;
totalweight += weight;
}
Occlusion1R = float4(sum / (totalweight+0.0001),0,0,base.w);
}
float4 PS_AO_AOCombine(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 color = tex2D(ReShade::BackBuffer, texcoord.xy);
float ao = tex2D(SamplerSSAO1, texcoord.xy).x;
ao -= 0.5;
if(ao < 0) ao *= fSSAODarkeningAmount;
if(ao > 0) ao *= fSSAOBrighteningAmount;
ao = 2 * saturate(ao+0.5);
if(bSSAODebug)
{
ao *= 0.75;
float depth = ReShade::GetLinearizedDepth(texcoord.xy).x;
ao = lerp(ao,1.0,smoothstep(fSSAOFadeStart,fSSAOFadeEnd,depth));
return ao;
}
else
{
float depth = ReShade::GetLinearizedDepth(texcoord.xy).x;
ao = lerp(ao,1.0,smoothstep(fSSAOFadeStart,fSSAOFadeEnd,depth));
color.xyz *= ao;
return color;
}
}
// Rendering passes
technique SSAO
{
pass SSAmbientOcclusion
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_SSAO;
RenderTarget = texSSAO1;
}
pass BlurV
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_AOBlurV;
RenderTarget = texSSAO2;
}
pass BlurH
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_AOBlurH;
RenderTarget = texSSAO1;
}
pass Combine
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_AOCombine;
}
}
Horizon Based Ambient Occlusion
/**
* Horizon Based Ambient Occlusion
* by Ethatron, tomerk and Marty McFly
*
*
* Ported from ReShade Framework
* to ReShade 3.0+ by mbah.primbon
*
*/
//------------------- Non GUI Settings -------------------
#define AO_BLUR_STEPS 11 //Offset count for AO smoothening. Higher means more smooth AO but also blurrier AO.
#define AO_SHARPNESS 0.8 //AO sharpness, higher means more sharp geometry edges but noisier AO, less means smoother AO but blurry in the distance.
//-------------------- GUI Settings ----------------------
uniform bool bHBAODebug <
ui_label = "HBAO Debug View";
ui_tooltip = "Enables raw AO/IL output for debugging and tuning purposes.";
> = false;
uniform float fHBAOScale <
ui_type = "drag";
ui_min = 0.25; ui_max = 1.00;
ui_label = "HBAO Scale";
ui_tooltip = "Scale of AO resolution. Lower resolution means less pixels to process and more performance but also less quality.";
> = 1.00;
uniform float fHBAOFadeStart <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00; ui_step = 0.01;
ui_label = "HBAO Fade Start";
ui_tooltip = "Distance from camera where AO starts to fade out. 0.0 means camera itself, 1.0 means infinite distance.";
> = 0.40;
uniform float fHBAOFadeEnd <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00; ui_step = 0.01;
ui_label = "HBAO Fade End";
ui_tooltip = "Distance from camera where AO fades out completely. 0.0 means camera itself, 1.0 means infinite distance.";
> = 0.90;
uniform int iHBAOSamples <
ui_type = "drag";
ui_min = 2; ui_max = 64;
ui_label = "HBAO Samples";
ui_tooltip = "Amount of samples. Higher means more accurate AO but also less performance.";
> = 7;
uniform float fHBAOSamplingRange <
ui_type = "drag";
ui_min = 0.50; ui_max = 5.00;
ui_label = "HBAO Sampling Range";
ui_tooltip = "Range of HBAO sampling. Higher values ignore small geometry details and shadow more globally.";
> = 1.3;
uniform float fHBAOAmount <
ui_type = "drag";
ui_min = 1.00; ui_max = 10.00;
ui_label = "HBAO Amount";
ui_tooltip = "Amount of HBAO shadowing.";
> = 2.50;
uniform float fHBAOClamp <
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_label = "HBAO Clamp";
ui_tooltip = "Clamps HBAO power. 0.0 means full power, 1.0 means no HBAO.";
> = 0.20;
uniform float fHBAOAttenuation <
ui_type = "drag";
ui_min = 0.001; ui_max = 0.20;
ui_label = "HBAO Attenuation";
ui_tooltip = "Affects the HBAO range, prevents shadowing of very far objects which are close in screen space.";
> = 0.32;
//------------------------------------------------------------------------
#include "ReShade.fxh"
// Textures and samplers
texture texHBAO1 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA16F;};
texture texHBAO2 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA16F;};
sampler SamplerHBAO1 {Texture = texHBAO1;};
sampler SamplerHBAO2 {Texture = texHBAO2;};
// Functions
#define InvFocalLen float2(tan(0.5f*radians(75.0)) / (float)BUFFER_RCP_HEIGHT * (float)BUFFER_RCP_WIDTH, tan(0.5f*radians(75.0)))
float3 GetEyePosition(in float2 uv, in float eye_z) {
uv = (uv * float2(2.0, -2.0) - float2(1.0, -1.0));
float3 pos = float3(uv * InvFocalLen * eye_z, eye_z);
return pos;
}
float2 GetRandom2_10(in float2 uv) {
float noiseX = (frac(sin(dot(uv, float2(12.9898,78.233) * 2.0)) * 43758.5453));
float noiseY = sqrt(1 - noiseX * noiseX);
return float2(noiseX, noiseY);
}
// Pixel shaders
void PS_AO_HBAO(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 Occlusion1R : SV_Target)
{
texcoord.xy /= fHBAOScale;
if(texcoord.x > 1.0 || texcoord.y > 1.0) discard;
float depth = ReShade::GetLinearizedDepth(texcoord.xy).x;
float blurkey = depth;
if(depth > min(0.9999,fHBAOFadeEnd)) Occlusion1R = float4(1.0,1.0,1.0,blurkey);
else {
float2 sample_offset[8] =
{
float2(1, 0),
float2(0.7071f, 0.7071f),
float2(0, 1),
float2(-0.7071f, 0.7071f),
float2(-1, 0),
float2(-0.7071f, -0.7071f),
float2(0, -1),
float2(0.7071f, -0.7071f)
};
float3 pos = GetEyePosition(texcoord.xy, depth);
float3 dx = ddx(pos);
float3 dy = ddy(pos);
float3 norm = normalize(cross(dx,dy));
float sample_depth=0;
float3 sample_pos=0;
float ao=0;
float s=0.0;
float2 rand_vec = GetRandom2_10(texcoord.xy);
float2 sample_vec_divisor = InvFocalLen*depth/(fHBAOSamplingRange*float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
float2 sample_center = texcoord.xy;
for (int i = 0; i < 8; i++)
{
float theta,temp_theta,temp_ao,curr_ao = 0;
float3 occlusion_vector = 0.0;
float2 sample_vec = reflect(sample_offset[i], rand_vec);
sample_vec /= sample_vec_divisor;
float2 sample_coords = (sample_vec*float2(1,(float)BUFFER_WIDTH/(float)BUFFER_HEIGHT))/iHBAOSamples;
for (int k = 1; k <= iHBAOSamples; k++)
{
sample_depth = ReShade::GetLinearizedDepth(sample_center + sample_coords*(k-0.5*(i%2))).x;
sample_pos = GetEyePosition(sample_center + sample_coords*(k-0.5*(i%2)), sample_depth);
occlusion_vector = sample_pos - pos;
temp_theta = dot( norm, normalize(occlusion_vector) );
if (temp_theta > theta)
{
theta = temp_theta;
temp_ao = 1-sqrt(1 - theta*theta );
ao += (1/ (1 + fHBAOAttenuation * pow(length(occlusion_vector)/fHBAOSamplingRange*5000,2)) )*(temp_ao-curr_ao);
curr_ao = temp_ao;
}
}
s += 1;
}
ao /= max(0.00001,s);
ao = 1.0-ao*fHBAOAmount;
ao = clamp(ao,fHBAOClamp,1);
Occlusion1R = float4(ao.xxx, blurkey);
}
}
void PS_AO_AOBlurV(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 Occlusion2R : SV_Target)
{
//It's better to do this here, upscaling must produce artifacts and upscale-> blur is better than blur -> upscale
//besides: code is easier an I'm very lazy :P
texcoord.xy *= fHBAOScale;
float sum,totalweight=0;
float4 base = tex2D(SamplerHBAO1, texcoord.xy), temp=0;
[loop]
for (int r = -AO_BLUR_STEPS; r <= AO_BLUR_STEPS; ++r)
{
float2 axis = float2(0.0, 1.0);
temp = tex2D(SamplerHBAO1, texcoord.xy + axis * ReShade::PixelSize * r);
float weight = AO_BLUR_STEPS-abs(r);
weight *= max(0.0, 1.0 - (1000.0 * AO_SHARPNESS) * abs(temp.w - base.w));
sum += temp.x * weight;
totalweight += weight;
}
Occlusion2R = float4(sum / (totalweight+0.0001),0,0,base.w);
}
void PS_AO_AOBlurH(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 Occlusion1R : SV_Target)
{
float sum,totalweight=0;
float4 base = tex2D(SamplerHBAO2, texcoord.xy), temp=0;
[loop]
for (int r = -AO_BLUR_STEPS; r <= AO_BLUR_STEPS; ++r)
{
float2 axis = float2(1.0, 0.0);
temp = tex2D(SamplerHBAO2, texcoord.xy + axis * ReShade::PixelSize * r);
float weight = AO_BLUR_STEPS-abs(r);
weight *= max(0.0, 1.0 - (1000.0 * AO_SHARPNESS) * abs(temp.w - base.w));
sum += temp.x * weight;
totalweight += weight;
}
Occlusion1R = float4(sum / (totalweight+0.0001),0,0,base.w);
}
float4 PS_AO_AOCombine(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 color = tex2D(ReShade::BackBuffer, texcoord.xy);
float ao = tex2D(SamplerHBAO1, texcoord.xy).x;
if(bHBAODebug)
{
float depth = ReShade::GetLinearizedDepth(texcoord.xy).x;
ao = lerp(ao,1.0,smoothstep(fHBAOFadeStart,fHBAOFadeEnd,depth));
return ao;
}
else
{
float depth = ReShade::GetLinearizedDepth(texcoord.xy).x;
ao = lerp(ao,1.0,smoothstep(fHBAOFadeStart,fHBAOFadeEnd,depth));
color.xyz *= ao;
return color;
}
}
// Rendering passes
technique HBAO
{
pass HBAmbientOcclusion
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_HBAO;
RenderTarget = texHBAO1;
}
pass BlurV
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_AOBlurV;
RenderTarget = texHBAO2;
}
pass BlurH
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_AOBlurH;
RenderTarget = texHBAO1;
}
pass Combine
{
VertexShader = PostProcessVS;
PixelShader = PS_AO_AOCombine;
}
}
Please Log in or Create an account to join the conversation.
I have no idea on what causes it tho.
Please Log in or Create an account to join the conversation.
- mbah.primbon
Please Log in or Create an account to join the conversation.
- mbah.primbon
Heat Haze
/**
* Heat Haze
* by Marty McFly
*
* Ported from ReShade Framework
* to ReShade 3.0+ by mbah.primbon
*
*/
//-------------------- GUI Settings ----------------------
uniform bool bHeatHazeDebug <
ui_label = "Heat Haze Debug View";
ui_tooltip = "Enables raw texture output for debugging purposes. Useful for texture experiments.";
> = false;
uniform float fHeatHazeSpeed <
ui_type = "drag";
ui_min = 0.00; ui_max = 10.00;
ui_label = "Heat Haze Speed";
ui_tooltip = "Speed of heathaze waves";
> = 1.80;
uniform float fHeatHazeOffset <
ui_type = "drag";
ui_min = 0.50; ui_max = 20.00; ui_step = 0.1;
ui_label = "Heat Haze Offset";
ui_tooltip = "Amount of image distortion caused by heathaze effect";
> = 4.40;
uniform float fHeatHazeTextureScale <
ui_type = "drag";
ui_min = 0.50; ui_max = 8.00; ui_step = 0.1;
ui_label = "Heat Haze Texture Scale";
ui_tooltip = "Scale of source texture, affecting the tile size. Use Heathaze debug effect for better visible effect.";
> = 1.00;
uniform float fHeatHazeChromaAmount <
ui_type = "drag";
ui_min = 0.00; ui_max = 2.00; ui_step = 0.01;
ui_label = "Heat Haze Chroma Amount";
ui_tooltip = "Amount of color shift caused by heat haze. Linearly scales with fHeatHazeOffset.";
> = 0.3;
//------------------------------------------------------------------------
#include "ReShade.fxh"
uniform float Timer < source = "timer"; >;
// Textures and samplers
texture texBump <source = "haze.png";> {Width = 512; Height = 512; Format = RGBA8;};
sampler samplerBump {Texture = texBump; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = Repeat; AddressV = Repeat;};
// Pixel shaders
void PS_HeatHaze(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float3 color : SV_Target)
{
float3 heatnormal = tex2Dlod(samplerBump, float4(texcoord.xy*fHeatHazeTextureScale+float2(0.0,Timer.x*0.0001*fHeatHazeSpeed),0,0)).rgb - 0.5;
float2 heatoffset = normalize(heatnormal.xy) * pow(length(heatnormal.xy), 0.5);
float3 heathazecolor = 0;
heathazecolor.y = tex2D(ReShade::BackBuffer, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset).y;
heathazecolor.x = tex2D(ReShade::BackBuffer, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0+fHeatHazeChromaAmount)).x;
heathazecolor.z = tex2D(ReShade::BackBuffer, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0-fHeatHazeChromaAmount)).z;
color.xyz = heathazecolor;
if(bHeatHazeDebug) color.xyz = heatnormal.xyz+0.5;
}
// Rendering passes
technique HeatHaze
{
pass HeatHazeBEGINNN
{
VertexShader = PostProcessVS;
PixelShader = PS_HeatHaze;
}
}
Please Log in or Create an account to join the conversation.