McFX /GemFX with Reshade 3.0?
- xxshuyaxx
- Topic Author
Less
More
Is it possible to use shaders from these in Reshade 2.0?
I am specifically looking to use AL controlled HeatHaze.
I am specifically looking to use AL controlled HeatHaze.
Please Log in or Create an account to join the conversation.
- FierySwordswoman
Less
More
6 years 10 months ago #2
by FierySwordswoman
Replied by FierySwordswoman on topic McFX /GemFX with Reshade 3.0?
Most of those shaders (or newer versions) are already in Reshade 3.
github.com/crosire/reshade-shaders/tree/master/Shaders
Ambient Light and Depth Haze are already here.
github.com/crosire/reshade-shaders/tree/master/Shaders
Ambient Light and Depth Haze are already here.
Please Log in or Create an account to join the conversation.
- xxshuyaxx
- Topic Author
Less
More
Depth Haze and Heat Haze are not the same thing
Please Log in or Create an account to join the conversation.
- Exilium
Less
More
xxshuyaxx wrote: Depth Haze and Heat Haze are not the same thing
True.
Please Log in or Create an account to join the conversation.
- xxshuyaxx
- Topic Author
Less
More
It seems like it's simple to port... but I have no idea where to start;;
This is the HeatHaze code.
This is the HeatHaze control code that works with Ambient Light from GemFX.
This is the GemFX ambient light shader code.
I did a quick comparison with the old GemFX ambient light to the 3.0 shader and the code looks very similar with only small changes. So the wishful thinking in me thinks that it's very possible to port the same heat haze shader.
Could anyone kind help me?
This is the HeatHaze code.
Warning: Spoiler!
NAMESPACE_ENTER(MFX)
#include MFX_SETTINGS_DEF
#if USE_HEATHAZE
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//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
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
texture texHeat < string source = "ReShade/McFX/Textures/mcheat.png"; > {Width = 512;Height = 512;Format = RGBA8;};
sampler2D SamplerHeat
{
Texture = texHeat;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Repeat;
AddressV = Repeat;
};
float4 PS_HeatHaze(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target0
{
float4 color = 0.0.xxxx;
float3 heatnormal = tex2Dlod(SamplerHeat, 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;
#include GFX_SETTINGS_DEF
#if AL_HeatHazeControle && AMBIENT_LIGHT
#include MFX_SETTINGS_UNDEF
#include "ReShade/GemFX/HeatHazeControle.h"
#else
#include GFX_SETTINGS_UNDEF
heathazecolor.y = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset).y;
heathazecolor.x = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0+fHeatHazeChromaAmount)).x;
heathazecolor.z = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0-fHeatHazeChromaAmount)).z;
#endif
color.xyz = heathazecolor;
#if(bHeatHazeDebug == 1)
color.xyz = heatnormal.xyz+0.5;
#endif
return color;
}
technique HeatHaze_Tech <bool enabled = RFX_Start_Enabled; int toggle = HeatHaze_ToggleKey; >
{
pass HeatHaze
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_HeatHaze;
}
}
#endif
#include MFX_SETTINGS_UNDEF
NAMESPACE_LEAVE()
#include MFX_SETTINGS_DEF
#if USE_HEATHAZE
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//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
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
texture texHeat < string source = "ReShade/McFX/Textures/mcheat.png"; > {Width = 512;Height = 512;Format = RGBA8;};
sampler2D SamplerHeat
{
Texture = texHeat;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Repeat;
AddressV = Repeat;
};
float4 PS_HeatHaze(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target0
{
float4 color = 0.0.xxxx;
float3 heatnormal = tex2Dlod(SamplerHeat, 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;
#include GFX_SETTINGS_DEF
#if AL_HeatHazeControle && AMBIENT_LIGHT
#include MFX_SETTINGS_UNDEF
#include "ReShade/GemFX/HeatHazeControle.h"
#else
#include GFX_SETTINGS_UNDEF
heathazecolor.y = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset).y;
heathazecolor.x = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0+fHeatHazeChromaAmount)).x;
heathazecolor.z = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0-fHeatHazeChromaAmount)).z;
#endif
color.xyz = heathazecolor;
#if(bHeatHazeDebug == 1)
color.xyz = heatnormal.xyz+0.5;
#endif
return color;
}
technique HeatHaze_Tech <bool enabled = RFX_Start_Enabled; int toggle = HeatHaze_ToggleKey; >
{
pass HeatHaze
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_HeatHaze;
}
}
#endif
#include MFX_SETTINGS_UNDEF
NAMESPACE_LEAVE()
This is the HeatHaze control code that works with Ambient Light from GemFX.
Warning: Spoiler!
/**
* Copyright (C) 2015 Lucifer Hawk (mediehawk@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software with restriction, including without limitation the rights to
* use and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and the permission notices (this and below) shall
* be included in all copies or substantial portions of the Software.
*
* Permission needs to be specifically granted by the author of the software to any
* person obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to copy, modify, merge, publish, distribute, and/or
* sublicense the Software, and subject to the following conditions:
*
* The above copyright notice and the permission notices (this and above) shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#if Depth_HeatHazeControle
float depth = tex2D(RFX_depthColor, float2(texcoord.x,min(1.0f,texcoord.y+0.15f))).r;
depth = 2.0 / (-99.0 * depth + 101.0);
#else
float depth = 0.0f;
#endif
float4 high = tex2D(alInColor, float2(texcoord.x,min(1.0f,texcoord.y+0.15f)))*(25.0f-(max(0.0f,texcoord.y+0.15f-1.0f)*10.0f));
#if AL_Adaptation && AMBIENT_LIGHT
//DetectLow
#if AL_HQAdapt
float4 detectLow = tex2D(detectLowHQColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#else
float4 detectLow = tex2D(detectLowColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#endif
float low = sqrt(0.641*detectLow.r*detectLow.r+0.291*detectLow.g*detectLow.g+0.068*detectLow.b*detectLow.b);
low *= min(1.0f,1.641*detectLow.r/(1.719*detectLow.g+1.932*detectLow.b));
//.DetectLow
float adapt = low*(low+1.0f)*alAdapt*alInt*5.0f;
high.xyz *= max(0.0f,(1.0f - adapt*0.1f*alAdaptHeatMult));
#endif
float highMul = sqrt(0.641*high.r*high.r+0.291*high.g*high.g+0.068*high.b*high.b);
highMul *= min(1.0f,1.641*high.r/(1.719*high.g+1.932*high.b))*min(1.0f,1.75f-depth)*(1.5f-texcoord.y);
#include GFX_SETTINGS_UNDEF
#include MFX_SETTINGS_DEF
heathazecolor.y = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset *min(1.0f,max(0.0f,(highMul-0.2f))*10f)).y;
heathazecolor.x = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0+fHeatHazeChromaAmount) *min(1.0f,max(0.0f,(highMul-0.2f))*10f)).x;
heathazecolor.z = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0-fHeatHazeChromaAmount) *min(1.0f,max(0.0f,(highMul-0.2f))*10f)).z;
* Copyright (C) 2015 Lucifer Hawk (mediehawk@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software with restriction, including without limitation the rights to
* use and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and the permission notices (this and below) shall
* be included in all copies or substantial portions of the Software.
*
* Permission needs to be specifically granted by the author of the software to any
* person obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to copy, modify, merge, publish, distribute, and/or
* sublicense the Software, and subject to the following conditions:
*
* The above copyright notice and the permission notices (this and above) shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#if Depth_HeatHazeControle
float depth = tex2D(RFX_depthColor, float2(texcoord.x,min(1.0f,texcoord.y+0.15f))).r;
depth = 2.0 / (-99.0 * depth + 101.0);
#else
float depth = 0.0f;
#endif
float4 high = tex2D(alInColor, float2(texcoord.x,min(1.0f,texcoord.y+0.15f)))*(25.0f-(max(0.0f,texcoord.y+0.15f-1.0f)*10.0f));
#if AL_Adaptation && AMBIENT_LIGHT
//DetectLow
#if AL_HQAdapt
float4 detectLow = tex2D(detectLowHQColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#else
float4 detectLow = tex2D(detectLowColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#endif
float low = sqrt(0.641*detectLow.r*detectLow.r+0.291*detectLow.g*detectLow.g+0.068*detectLow.b*detectLow.b);
low *= min(1.0f,1.641*detectLow.r/(1.719*detectLow.g+1.932*detectLow.b));
//.DetectLow
float adapt = low*(low+1.0f)*alAdapt*alInt*5.0f;
high.xyz *= max(0.0f,(1.0f - adapt*0.1f*alAdaptHeatMult));
#endif
float highMul = sqrt(0.641*high.r*high.r+0.291*high.g*high.g+0.068*high.b*high.b);
highMul *= min(1.0f,1.641*high.r/(1.719*high.g+1.932*high.b))*min(1.0f,1.75f-depth)*(1.5f-texcoord.y);
#include GFX_SETTINGS_UNDEF
#include MFX_SETTINGS_DEF
heathazecolor.y = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset *min(1.0f,max(0.0f,(highMul-0.2f))*10f)).y;
heathazecolor.x = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0+fHeatHazeChromaAmount) *min(1.0f,max(0.0f,(highMul-0.2f))*10f)).x;
heathazecolor.z = tex2D(RFX_backbufferColor, texcoord.xy + heatoffset.xy * 0.001 * fHeatHazeOffset * (1.0-fHeatHazeChromaAmount) *min(1.0f,max(0.0f,(highMul-0.2f))*10f)).z;
This is the GemFX ambient light shader code.
Warning: Spoiler!
NAMESPACE_ENTER(GFX)
#include GFX_SETTINGS_DEF
#if AMBIENT_LIGHT
/**
* Copyright (C) 2015 Lucifer Hawk (mediehawk@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software with restriction, including without limitation the rights to
* use and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and the permission notices (this and below) shall
* be included in all copies or substantial portions of the Software.
*
* Permission needs to be specifically granted by the author of the software to any
* person obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to copy, modify, merge, publish, distribute, and/or
* sublicense the Software, and subject to the following conditions:
*
* The above copyright notice and the permission notices (this and above) shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
uniform float2 t < source = "pingpong"; min = 0.0f; max = 6.28f; step = float2(0.1f, 0.2f); >;
#define GEMFX_PIXEL_SIZE float2(1.0f/(BUFFER_WIDTH/16.0f),1.0f/(BUFFER_HEIGHT/16.0f))
texture2D alInTex { Width = BUFFER_WIDTH/16; Height = BUFFER_HEIGHT/16; Format = RGBA32F; };
texture2D alOutTex { Width = BUFFER_WIDTH/16; Height = BUFFER_HEIGHT/16; Format = RGBA32F; };
texture dirtTex < source = "ReShade/GemFX/Textures/dirt.png"; > { Width = 1982; Height = 1115; MipLevels = 1; Format = RGBA8; };
texture dirtOVRTex < source = "ReShade/GemFX/Textures/dirtOVR.png"; > { Width = 2400; Height = 1350; MipLevels = 1; Format = RGBA8; };
texture dirtOVBTex < source = "ReShade/GemFX/Textures/dirtOVB.png"; > { Width = 2400; Height = 1348; MipLevels = 1; Format = RGBA8; };
texture lensDBTex < source = "ReShade/GemFX/Textures/lensDB.png"; > { Width = 1920; Height = 1080; MipLevels = 1; Format = RGBA8; };
texture lensDB2Tex < source = "ReShade/GemFX/Textures/lensDB2.png"; > { Width = 1024; Height = 576; MipLevels = 1; Format = RGBA8; };
texture lensDOVTex < source = "ReShade/GemFX/Textures/lensDOV.png"; > { Width = 1920; Height = 1080; MipLevels = 1; Format = RGBA8; };
texture lensDUVTex < source = "ReShade/GemFX/Textures/lensDUV.png"; > { Width = 1920; Height = 1080; MipLevels = 1; Format = RGBA8; };
sampler2D alInColor { Texture = alInTex; };
sampler2D alOutColor { Texture = alOutTex; };
sampler dirtSampler { Texture = dirtTex; };
sampler dirtOVRSampler { Texture = dirtOVRTex; };
sampler dirtOVBSampler { Texture = dirtOVBTex; };
sampler lensDBSampler { Texture = lensDBTex; };
sampler lensDB2Sampler { Texture = lensDB2Tex; };
sampler lensDOVSampler { Texture = lensDOVTex; };
sampler lensDUVSampler { Texture = lensDUVTex; };
void PS_AL_DetectHigh(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 highR : SV_Target0)
{
float4 x = tex2D(RFX_originalColor, texcoord);
x = float4 (x.rgb * pow (abs (max (x.r, max (x.g, x.b))), 2.0), 1.0f);
float base = (x.r + x.g + x.b); base /= 3;
float nR = (x.r * 2) - base;
float nG = (x.g * 2) - base;
float nB = (x.b * 2) - base;
[flatten]if (nR < 0) { nG += nR/2; nB += nR/2; nR = 0; }
[flatten]if (nG < 0) { nB += nG/2; [flatten]if (nR > -nG/2) nR += nG/2; else nR = 0; nG = 0; }
[flatten]if (nB < 0) { [flatten]if (nR > -nB/2) nR += nB/2; else nR = 0; [flatten]if (nG > -nB/2) nG += nB/2; else nG = 0; nB = 0; }
[flatten]if (nR > 1) { nG += (nR-1)/2; nB += (nR-1)/2; nR = 1; }
[flatten]if (nG > 1) { nB += (nG-1)/2; [flatten]if (nR+(nG-1) < 1) nR += (nG-1)/2; else nR = 1; nG = 1; }
[flatten]if (nB > 1) { [flatten]if (nR+(nB-1) < 1) nR += (nB-1)/2; else nR = 1; [flatten]if (nG+(nB-1) < 1) nG += (nB-1)/2; else nG = 1; nB = 1; }
x.r = nR; x.g = nG; x.b = nB;
highR = x;
}
void PS_AL_HGB(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 hgbR : SV_Target0)
{
static const float sampleOffsets[5] = { 0.0, 2.4347826, 4.3478260, 6.2608695, 8.1739130 };
static const float sampleWeights[5] = { 0.16818994, 0.27276957, 0.111690125, 0.024067905, 0.0021112196 };
float4 hgb = tex2D(alInColor, texcoord) * sampleWeights[0];
hgb = float4(max(hgb.rgb - alThreshold, 0.0), hgb.a);
float step = 1.08 + (t.x / 100)* 0.02;
[flatten]if ((texcoord.x + sampleOffsets[1] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[1] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[1] * step;
[flatten]if ((texcoord.x - sampleOffsets[1] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[1] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[1] * step;
[flatten]if ((texcoord.x + sampleOffsets[2] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[2] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[2] * step;
[flatten]if ((texcoord.x - sampleOffsets[2] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[2] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[2] * step;
[flatten]if ((texcoord.x + sampleOffsets[3] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[3] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[3] * step;
[flatten]if ((texcoord.x - sampleOffsets[3] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[3] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[3] * step;
[flatten]if ((texcoord.x + sampleOffsets[4] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[4] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[4] * step;
[flatten]if ((texcoord.x - sampleOffsets[4] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[4] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[4] * step;
hgbR = hgb;
}
void PS_AL_VGB(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 vgbR : SV_Target0)
{
static const float sampleOffsets[5] = { 0.0, 2.4347826, 4.3478260, 6.2608695, 8.1739130 };
static const float sampleWeights[5] = { 0.16818994, 0.27276957, 0.111690125, 0.024067905, 0.0021112196 };
float4 vgb = tex2D(alOutColor, texcoord) * sampleWeights[0];
vgb = float4(max(vgb.rgb - alThreshold, 0.0), vgb.a);
float step = 1.08 + (t.x / 100)* 0.02;
[flatten]if ((texcoord.y + sampleOffsets[1] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[1] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[1] * step;
[flatten]if ((texcoord.y - sampleOffsets[1] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[1] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[1] * step;
[flatten]if ((texcoord.y + sampleOffsets[2] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[2] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[2] * step;
[flatten]if ((texcoord.y - sampleOffsets[2] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[2] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[2] * step;
[flatten]if ((texcoord.y + sampleOffsets[3] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[3] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[3] * step;
[flatten]if ((texcoord.y - sampleOffsets[3] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[3] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[3] * step;
[flatten]if ((texcoord.y + sampleOffsets[4] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[4] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[4] * step;
[flatten]if ((texcoord.y - sampleOffsets[4] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[4] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[4] * step;
vgbR = vgb;
}
float4 PS_AL_Magic(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 base = tex2D(RFX_backbufferColor, texcoord);
float4 high = tex2D(alInColor, texcoord);
#if AL_Adaptation
//DetectLow
#if AL_HQAdapt
float4 detectLow = tex2D(detectLowHQColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#else
float4 detectLow = tex2D(detectLowColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#endif
float low = sqrt(0.241*detectLow.r*detectLow.r+0.691*detectLow.g*detectLow.g+0.068*detectLow.b*detectLow.b);
//.DetectLow
low = pow(low*1.25f,2);
float adapt = low*(low+1.0f)*alAdapt*alInt*5.0f;
#if alDebug
float mod = (texcoord.x*1000.0f)%1.001f;
//mod = abs(mod - texcoord.x/4.0f);
if (texcoord.y < 0.01f)
if (texcoord.x < low*10f && mod < 0.3f) return float4(1f,0.5f,0.3f,0f);
if (texcoord.y > 0.01f && texcoord.y < 0.02f)
if (texcoord.x < adapt/(alInt*1.5) && mod < 0.3f) return float4(0.2f,1f,0.5f,0f);
#endif
#endif
high = min(0.0325f,high)*max(0.0f,(1.15f - 0));
float4 highOrig = high;
float xFlip = 1.0f - texcoord.x;
float yFlip = 1.0f - texcoord.y;
float4 highFlipOrig = tex2D(alInColor, float2(xFlip,yFlip));
highFlipOrig = min(0.03f,highFlipOrig)*max(0.0f,(1.15f - 0));
float4 highFlip = highFlipOrig;
float4 highLensSrc = high;
#if AL_Dirt
float4 dirt = tex2D(dirtSampler, texcoord);
float4 dirtOVR = tex2D(dirtOVRSampler, texcoord);
float4 dirtOVB = tex2D(dirtOVBSampler, texcoord);
float maxhigh = max(high.r, max(high.g, high.b));
float threshDiff = maxhigh - 3.2f;
[flatten]if (threshDiff > 0) {
high.r = (high.r / maxhigh)*3.2f;
high.g = (high.g / maxhigh)*3.2f;
high.b = (high.b / maxhigh)*3.2f;
}
float4 highDirt = highOrig*high*alDirtInt;
#if AL_Vibrance
highDirt *= 1.0f+0.5f*sin(t.x);
#endif
float highMix = highOrig.r + highOrig.g + highOrig.b;
float red = highOrig.r/highMix;
float green = highOrig.g/highMix;
float blue = highOrig.b/highMix;
highOrig = highOrig + highDirt;
#if AL_Adaptive == 2
high = high + high*dirtOVR*alDirtOVInt*green;
high = high + highDirt;
high = high + highOrig*dirtOVB*alDirtOVInt*blue;
high = high + highOrig*dirtOVR*alDirtOVInt*red;
#elif AL_Adaptive == 1
high = high + highDirt;
high = high + highOrig*dirtOVB*alDirtOVInt;
#else
high = high + highDirt;
high = high + highOrig*dirtOVR*alDirtOVInt;
#endif
highLensSrc = high*85f*pow(1.25f-(abs(texcoord.x-0.5f)+abs(texcoord.y-0.5f)),2);
#endif
#define GEMFX_lensb1 (1.8f * alLensThresh)
float origBright = max(highLensSrc.r,max(highLensSrc.g,highLensSrc.b));//sqrt(0.241*base.r*base.r+0.691*base.g*base.g+0.068*base.b*base.b);
float maxOrig = max(GEMFX_lensb1 - pow(origBright*(0.5f-abs(texcoord.x-0.5f)),4),0.0f);
float smartWeight = maxOrig*max(abs(xFlip-0.5f), 0.3f*abs(yFlip-0.5f))*(2.2-1.2*(abs(xFlip-0.5f)))*alLensInt;
smartWeight = min(0.85f,max(0,smartWeight
#if AL_Adaptation
-adapt
#endif
));
float4 lensDB = tex2D(lensDBSampler, texcoord);
float4 lensDB2 = tex2D(lensDB2Sampler, texcoord);
float4 lensDOV = tex2D(lensDOVSampler, texcoord);
float4 lensDUV = tex2D(lensDUVSampler, texcoord);
float4 highLens = highFlip*lensDB*0.7f*smartWeight;
#if AL_Lens
high = high + highLens;
highLens = highFlipOrig*lensDUV*1.15f*smartWeight;
highFlipOrig = highFlipOrig + highLens;
high = high + highLens;
highLens = highFlipOrig*lensDB2*0.7f*smartWeight;
highFlipOrig = highFlipOrig + highLens;
high = high + highLens;
highLens = highFlipOrig*lensDOV*1.15f*smartWeight;
highFlipOrig = highFlipOrig + highLens;
high = high + highLens;
#endif
#if AL_Adaptation
base.xyz *= max(0.0f,(1.0f - adapt*0.75f*alAdaptBaseMult*pow((1.0f-(base.x+base.y+base.z)/3),alAdaptBaseBlackLvL)));
#define GEMFX_alb1 max(0.0f,(alInt-adapt)*0.85f)
float4 highSampleMix = (1.0 - ((1.0 - base) * (1.0 - high *1.0)));
float4 baseSample = lerp(base, highSampleMix, max(0.0f,alInt-adapt));
#else
#define GEMFX_alb1 max(0.0f,alInt*0.85f)
float4 highSampleMix = (1.0 - ((1.0 - base) * (1.0 - high *1.0)));
float4 baseSample = lerp(base, highSampleMix, alInt);
#endif
float baseSampleMix = baseSample.r + baseSample.g + baseSample.b;
[flatten]if (baseSampleMix>0.008)
return baseSample;
else return lerp(base, highSampleMix, GEMFX_alb1*baseSampleMix);
}
technique AmbientLight_Tech <bool enabled = RFX_Start_Enabled; int toggle = AmbientLight_ToggleKey; >
{
pass AL_DetectHigh
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_DetectHigh;
RenderTarget = alInTex;
}
pass AL_H1
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V1
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H2
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V2
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H3
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V3
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H4
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V4
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H5
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V5
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H6
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V6
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H7
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V7
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H8
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V8
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H9
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V9
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H10
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V10
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H11
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V11
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H12
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V12
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_Magic
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_Magic;
}
}
#endif
#include GFX_SETTINGS_UNDEF
NAMESPACE_LEAVE()
#include GFX_SETTINGS_DEF
#if AMBIENT_LIGHT
/**
* Copyright (C) 2015 Lucifer Hawk (mediehawk@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software with restriction, including without limitation the rights to
* use and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and the permission notices (this and below) shall
* be included in all copies or substantial portions of the Software.
*
* Permission needs to be specifically granted by the author of the software to any
* person obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to copy, modify, merge, publish, distribute, and/or
* sublicense the Software, and subject to the following conditions:
*
* The above copyright notice and the permission notices (this and above) shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
uniform float2 t < source = "pingpong"; min = 0.0f; max = 6.28f; step = float2(0.1f, 0.2f); >;
#define GEMFX_PIXEL_SIZE float2(1.0f/(BUFFER_WIDTH/16.0f),1.0f/(BUFFER_HEIGHT/16.0f))
texture2D alInTex { Width = BUFFER_WIDTH/16; Height = BUFFER_HEIGHT/16; Format = RGBA32F; };
texture2D alOutTex { Width = BUFFER_WIDTH/16; Height = BUFFER_HEIGHT/16; Format = RGBA32F; };
texture dirtTex < source = "ReShade/GemFX/Textures/dirt.png"; > { Width = 1982; Height = 1115; MipLevels = 1; Format = RGBA8; };
texture dirtOVRTex < source = "ReShade/GemFX/Textures/dirtOVR.png"; > { Width = 2400; Height = 1350; MipLevels = 1; Format = RGBA8; };
texture dirtOVBTex < source = "ReShade/GemFX/Textures/dirtOVB.png"; > { Width = 2400; Height = 1348; MipLevels = 1; Format = RGBA8; };
texture lensDBTex < source = "ReShade/GemFX/Textures/lensDB.png"; > { Width = 1920; Height = 1080; MipLevels = 1; Format = RGBA8; };
texture lensDB2Tex < source = "ReShade/GemFX/Textures/lensDB2.png"; > { Width = 1024; Height = 576; MipLevels = 1; Format = RGBA8; };
texture lensDOVTex < source = "ReShade/GemFX/Textures/lensDOV.png"; > { Width = 1920; Height = 1080; MipLevels = 1; Format = RGBA8; };
texture lensDUVTex < source = "ReShade/GemFX/Textures/lensDUV.png"; > { Width = 1920; Height = 1080; MipLevels = 1; Format = RGBA8; };
sampler2D alInColor { Texture = alInTex; };
sampler2D alOutColor { Texture = alOutTex; };
sampler dirtSampler { Texture = dirtTex; };
sampler dirtOVRSampler { Texture = dirtOVRTex; };
sampler dirtOVBSampler { Texture = dirtOVBTex; };
sampler lensDBSampler { Texture = lensDBTex; };
sampler lensDB2Sampler { Texture = lensDB2Tex; };
sampler lensDOVSampler { Texture = lensDOVTex; };
sampler lensDUVSampler { Texture = lensDUVTex; };
void PS_AL_DetectHigh(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 highR : SV_Target0)
{
float4 x = tex2D(RFX_originalColor, texcoord);
x = float4 (x.rgb * pow (abs (max (x.r, max (x.g, x.b))), 2.0), 1.0f);
float base = (x.r + x.g + x.b); base /= 3;
float nR = (x.r * 2) - base;
float nG = (x.g * 2) - base;
float nB = (x.b * 2) - base;
[flatten]if (nR < 0) { nG += nR/2; nB += nR/2; nR = 0; }
[flatten]if (nG < 0) { nB += nG/2; [flatten]if (nR > -nG/2) nR += nG/2; else nR = 0; nG = 0; }
[flatten]if (nB < 0) { [flatten]if (nR > -nB/2) nR += nB/2; else nR = 0; [flatten]if (nG > -nB/2) nG += nB/2; else nG = 0; nB = 0; }
[flatten]if (nR > 1) { nG += (nR-1)/2; nB += (nR-1)/2; nR = 1; }
[flatten]if (nG > 1) { nB += (nG-1)/2; [flatten]if (nR+(nG-1) < 1) nR += (nG-1)/2; else nR = 1; nG = 1; }
[flatten]if (nB > 1) { [flatten]if (nR+(nB-1) < 1) nR += (nB-1)/2; else nR = 1; [flatten]if (nG+(nB-1) < 1) nG += (nB-1)/2; else nG = 1; nB = 1; }
x.r = nR; x.g = nG; x.b = nB;
highR = x;
}
void PS_AL_HGB(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 hgbR : SV_Target0)
{
static const float sampleOffsets[5] = { 0.0, 2.4347826, 4.3478260, 6.2608695, 8.1739130 };
static const float sampleWeights[5] = { 0.16818994, 0.27276957, 0.111690125, 0.024067905, 0.0021112196 };
float4 hgb = tex2D(alInColor, texcoord) * sampleWeights[0];
hgb = float4(max(hgb.rgb - alThreshold, 0.0), hgb.a);
float step = 1.08 + (t.x / 100)* 0.02;
[flatten]if ((texcoord.x + sampleOffsets[1] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[1] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[1] * step;
[flatten]if ((texcoord.x - sampleOffsets[1] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[1] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[1] * step;
[flatten]if ((texcoord.x + sampleOffsets[2] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[2] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[2] * step;
[flatten]if ((texcoord.x - sampleOffsets[2] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[2] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[2] * step;
[flatten]if ((texcoord.x + sampleOffsets[3] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[3] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[3] * step;
[flatten]if ((texcoord.x - sampleOffsets[3] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[3] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[3] * step;
[flatten]if ((texcoord.x + sampleOffsets[4] * GEMFX_PIXEL_SIZE.x) < 1.05) hgb += tex2D(alInColor, texcoord + float2(sampleOffsets[4] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[4] * step;
[flatten]if ((texcoord.x - sampleOffsets[4] * GEMFX_PIXEL_SIZE.x) > -0.05) hgb += tex2D(alInColor, texcoord - float2(sampleOffsets[4] * GEMFX_PIXEL_SIZE.x, 0.0)) * sampleWeights[4] * step;
hgbR = hgb;
}
void PS_AL_VGB(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 vgbR : SV_Target0)
{
static const float sampleOffsets[5] = { 0.0, 2.4347826, 4.3478260, 6.2608695, 8.1739130 };
static const float sampleWeights[5] = { 0.16818994, 0.27276957, 0.111690125, 0.024067905, 0.0021112196 };
float4 vgb = tex2D(alOutColor, texcoord) * sampleWeights[0];
vgb = float4(max(vgb.rgb - alThreshold, 0.0), vgb.a);
float step = 1.08 + (t.x / 100)* 0.02;
[flatten]if ((texcoord.y + sampleOffsets[1] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[1] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[1] * step;
[flatten]if ((texcoord.y - sampleOffsets[1] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[1] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[1] * step;
[flatten]if ((texcoord.y + sampleOffsets[2] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[2] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[2] * step;
[flatten]if ((texcoord.y - sampleOffsets[2] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[2] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[2] * step;
[flatten]if ((texcoord.y + sampleOffsets[3] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[3] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[3] * step;
[flatten]if ((texcoord.y - sampleOffsets[3] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[3] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[3] * step;
[flatten]if ((texcoord.y + sampleOffsets[4] * GEMFX_PIXEL_SIZE.y) < 1.05) vgb += tex2D(alOutColor, texcoord + float2(0.0, sampleOffsets[4] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[4] * step;
[flatten]if ((texcoord.y - sampleOffsets[4] * GEMFX_PIXEL_SIZE.y) > -0.05) vgb += tex2D(alOutColor, texcoord - float2(0.0, sampleOffsets[4] * GEMFX_PIXEL_SIZE.y)) * sampleWeights[4] * step;
vgbR = vgb;
}
float4 PS_AL_Magic(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 base = tex2D(RFX_backbufferColor, texcoord);
float4 high = tex2D(alInColor, texcoord);
#if AL_Adaptation
//DetectLow
#if AL_HQAdapt
float4 detectLow = tex2D(detectLowHQColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#else
float4 detectLow = tex2D(detectLowColor, float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT));
#endif
float low = sqrt(0.241*detectLow.r*detectLow.r+0.691*detectLow.g*detectLow.g+0.068*detectLow.b*detectLow.b);
//.DetectLow
low = pow(low*1.25f,2);
float adapt = low*(low+1.0f)*alAdapt*alInt*5.0f;
#if alDebug
float mod = (texcoord.x*1000.0f)%1.001f;
//mod = abs(mod - texcoord.x/4.0f);
if (texcoord.y < 0.01f)
if (texcoord.x < low*10f && mod < 0.3f) return float4(1f,0.5f,0.3f,0f);
if (texcoord.y > 0.01f && texcoord.y < 0.02f)
if (texcoord.x < adapt/(alInt*1.5) && mod < 0.3f) return float4(0.2f,1f,0.5f,0f);
#endif
#endif
high = min(0.0325f,high)*max(0.0f,(1.15f - 0));
float4 highOrig = high;
float xFlip = 1.0f - texcoord.x;
float yFlip = 1.0f - texcoord.y;
float4 highFlipOrig = tex2D(alInColor, float2(xFlip,yFlip));
highFlipOrig = min(0.03f,highFlipOrig)*max(0.0f,(1.15f - 0));
float4 highFlip = highFlipOrig;
float4 highLensSrc = high;
#if AL_Dirt
float4 dirt = tex2D(dirtSampler, texcoord);
float4 dirtOVR = tex2D(dirtOVRSampler, texcoord);
float4 dirtOVB = tex2D(dirtOVBSampler, texcoord);
float maxhigh = max(high.r, max(high.g, high.b));
float threshDiff = maxhigh - 3.2f;
[flatten]if (threshDiff > 0) {
high.r = (high.r / maxhigh)*3.2f;
high.g = (high.g / maxhigh)*3.2f;
high.b = (high.b / maxhigh)*3.2f;
}
float4 highDirt = highOrig*high*alDirtInt;
#if AL_Vibrance
highDirt *= 1.0f+0.5f*sin(t.x);
#endif
float highMix = highOrig.r + highOrig.g + highOrig.b;
float red = highOrig.r/highMix;
float green = highOrig.g/highMix;
float blue = highOrig.b/highMix;
highOrig = highOrig + highDirt;
#if AL_Adaptive == 2
high = high + high*dirtOVR*alDirtOVInt*green;
high = high + highDirt;
high = high + highOrig*dirtOVB*alDirtOVInt*blue;
high = high + highOrig*dirtOVR*alDirtOVInt*red;
#elif AL_Adaptive == 1
high = high + highDirt;
high = high + highOrig*dirtOVB*alDirtOVInt;
#else
high = high + highDirt;
high = high + highOrig*dirtOVR*alDirtOVInt;
#endif
highLensSrc = high*85f*pow(1.25f-(abs(texcoord.x-0.5f)+abs(texcoord.y-0.5f)),2);
#endif
#define GEMFX_lensb1 (1.8f * alLensThresh)
float origBright = max(highLensSrc.r,max(highLensSrc.g,highLensSrc.b));//sqrt(0.241*base.r*base.r+0.691*base.g*base.g+0.068*base.b*base.b);
float maxOrig = max(GEMFX_lensb1 - pow(origBright*(0.5f-abs(texcoord.x-0.5f)),4),0.0f);
float smartWeight = maxOrig*max(abs(xFlip-0.5f), 0.3f*abs(yFlip-0.5f))*(2.2-1.2*(abs(xFlip-0.5f)))*alLensInt;
smartWeight = min(0.85f,max(0,smartWeight
#if AL_Adaptation
-adapt
#endif
));
float4 lensDB = tex2D(lensDBSampler, texcoord);
float4 lensDB2 = tex2D(lensDB2Sampler, texcoord);
float4 lensDOV = tex2D(lensDOVSampler, texcoord);
float4 lensDUV = tex2D(lensDUVSampler, texcoord);
float4 highLens = highFlip*lensDB*0.7f*smartWeight;
#if AL_Lens
high = high + highLens;
highLens = highFlipOrig*lensDUV*1.15f*smartWeight;
highFlipOrig = highFlipOrig + highLens;
high = high + highLens;
highLens = highFlipOrig*lensDB2*0.7f*smartWeight;
highFlipOrig = highFlipOrig + highLens;
high = high + highLens;
highLens = highFlipOrig*lensDOV*1.15f*smartWeight;
highFlipOrig = highFlipOrig + highLens;
high = high + highLens;
#endif
#if AL_Adaptation
base.xyz *= max(0.0f,(1.0f - adapt*0.75f*alAdaptBaseMult*pow((1.0f-(base.x+base.y+base.z)/3),alAdaptBaseBlackLvL)));
#define GEMFX_alb1 max(0.0f,(alInt-adapt)*0.85f)
float4 highSampleMix = (1.0 - ((1.0 - base) * (1.0 - high *1.0)));
float4 baseSample = lerp(base, highSampleMix, max(0.0f,alInt-adapt));
#else
#define GEMFX_alb1 max(0.0f,alInt*0.85f)
float4 highSampleMix = (1.0 - ((1.0 - base) * (1.0 - high *1.0)));
float4 baseSample = lerp(base, highSampleMix, alInt);
#endif
float baseSampleMix = baseSample.r + baseSample.g + baseSample.b;
[flatten]if (baseSampleMix>0.008)
return baseSample;
else return lerp(base, highSampleMix, GEMFX_alb1*baseSampleMix);
}
technique AmbientLight_Tech <bool enabled = RFX_Start_Enabled; int toggle = AmbientLight_ToggleKey; >
{
pass AL_DetectHigh
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_DetectHigh;
RenderTarget = alInTex;
}
pass AL_H1
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V1
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H2
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V2
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H3
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V3
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H4
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V4
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H5
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V5
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H6
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V6
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H7
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V7
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H8
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V8
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H9
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V9
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H10
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V10
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H11
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V11
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_H12
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_HGB;
RenderTarget = alOutTex;
}
pass AL_V12
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_VGB;
RenderTarget = alInTex;
}
pass AL_Magic
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AL_Magic;
}
}
#endif
#include GFX_SETTINGS_UNDEF
NAMESPACE_LEAVE()
I did a quick comparison with the old GemFX ambient light to the 3.0 shader and the code looks very similar with only small changes. So the wishful thinking in me thinks that it's very possible to port the same heat haze shader.
Could anyone kind help me?
Please Log in or Create an account to join the conversation.
- FierySwordswoman
Less
More
6 years 10 months ago #6
by FierySwordswoman
Replied by FierySwordswoman on topic McFX /GemFX with Reshade 3.0?
I don't know HLSL, so I can't do much more than mess around with variables. You'll probably want to request it on a thread that specializes in shader conversion.
Please Log in or Create an account to join the conversation.
- Exilium
Less
More