Port GemFX Adv. Motion Blur for Reshade 3

More
4 years 4 months ago - 4 years 4 months ago #1 by TheBlueOne Port GemFX Adv. Motion Blur for Reshade 3 was created by TheBlueOne
I have tried advanced motion blur with Reshade 1, but I had bad luck in BeamNG Drive as Reshade 1 apparently had no access to the depth buffer which this effect uses for a more convincing blur. Reshade 3 on the other hand does have access to the depth buffer with exactly the same in-game settings. But Reshade 3 installer and the forum doesn't have the advanced motion blur from GemFX like Reshade 1 does. :(

Could anyone port this effect for Reshade 3? It would be very appreciated as I love decent motion blur in car games.
Last edit: 4 years 4 months ago by TheBlueOne.

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

More
4 years 4 months ago #2 by Marty Replied by Marty on topic Port GemFX Adv. Motion Blur for Rehade 3
Maybe not 100% relevant, but I'd too love to see GemFX shaders ported to ReShade 3, the more the better. Especially color correction ones. As far as I know we only have Ambient Light (which I really like btw).
The following user(s) said Thank You: Viper_Joe, TheBlueOne

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

More
4 years 4 months ago #3 by TheBlueOne Replied by TheBlueOne on topic Port GemFX Adv. Motion Blur for Rehade 3
Yes, I'd love to see more GemFX shaders ported. I'm just really curious how advanced motion blur would look like with depth buffer support. Since I could never make it work in GemFX and ReShade 1.

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

More
4 years 4 months ago #4 by Wicked Sick Replied by Wicked Sick on topic Port GemFX Adv. Motion Blur for Rehade 3
That would be nice. Also, what has happened to Lucifer's Hawk?

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

More
4 years 4 months ago - 4 years 4 months ago #5 by Marty Replied by Marty on topic Port GemFX Adv. Motion Blur for Rehade 3

Wicked Sick wrote: That would be nice. Also, what has happened to Lucifer's Hawk?

Yeah, no idea. If I remeber right he planned to port GemFX to ReShade. Which didn't happen apart from excellent Ambiend Light, sadly.
Last edit: 4 years 4 months ago by Marty.

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

More
4 years 4 months ago - 4 years 4 months ago #6 by TheBlueOne Replied by TheBlueOne on topic Port GemFX Adv. Motion Blur for Reshade 3
It might be easier if I also post the code I would like to see ported.

Reshade v1 code:

NAMESPACE_ENTER(GFX)
NAMESPACE_ENTER(GFX_MB)

#include GFX_SETTINGS_DEF

#if USE_ADV_MOTION_BLUR

/**
* 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.
*/

texture2D ambCurrBlurTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
texture2D ambPrevBlurTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
texture2D ambPrevTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
sampler2D ambCurrBlurColor { Texture = ambCurrBlurTex; };
sampler2D ambPrevBlurColor { Texture = ambPrevBlurTex; };
sampler2D ambPrevColor { Texture = ambPrevTex; };

float4 PS_AMBCombine(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 prev = tex2D(ambPrevBlurColor, texcoord);
float4 curr = tex2D(RFX_backbufferColor, texcoord);
float4 currBlur = tex2D(ambCurrBlurColor, texcoord);

float diff = (abs(currBlur.r - prev.r) + abs(currBlur.g - prev.g) + abs(currBlur.b - prev.b)) / 3;
diff = min(max(diff - ambPrecision, 0.0f)*ambSmartMult, ambRecall);

#if ambDepth_Check
float depth = tex2D(RFX_depthTexColor, texcoord).r;

return lerp(curr, prev, min(ambIntensity+diff*ambSmartInt, 1.0f)/(depth.r+ambDepthRatio));
#endif
return lerp(curr, prev, min(ambIntensity+diff*ambSmartInt, 1.0f));
}

void PS_AMBCopyPreviousFrame(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 prev : SV_Target0)
{
prev = tex2D(RFX_backbufferColor, texcoord);
}

void PS_AMBBlur(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 curr : SV_Target0, out float4 prev : SV_Target1)
{


float4 currVal = tex2D(RFX_backbufferColor, texcoord);
float4 prevVal = tex2D(ambPrevColor, texcoord);

float weight[11] = { 0.082607, 0.040484, 0.038138, 0.034521, 0.030025, 0.025094, 0.020253, 0.015553, 0.011533, 0.008218, 0.005627 };
currVal *= weight[0];
prevVal *= weight[0];

float ratio = -1.0f;

float pixelBlur = ambSoftness/max(1.0f,1.0f+(-1.0f)*ratio) * (BUFFER_RCP_HEIGHT);

[unroll]
for (int z = 1; z < 11; z++) //set quality level by user
{
currVal += tex2D(RFX_backbufferColor, texcoord + float2(z*pixelBlur, 0)) * weight[z];
currVal += tex2D(RFX_backbufferColor, texcoord - float2(z*pixelBlur, 0)) * weight[z];
currVal += tex2D(RFX_backbufferColor, texcoord + float2(0, z*pixelBlur)) * weight[z];
currVal += tex2D(RFX_backbufferColor, texcoord - float2(0, z*pixelBlur)) * weight[z];

prevVal += tex2D(ambPrevColor, texcoord + float2(z*pixelBlur, 0)) * weight[z];
prevVal += tex2D(ambPrevColor, texcoord - float2(z*pixelBlur, 0)) * weight[z];
prevVal += tex2D(ambPrevColor, texcoord + float2(0, z*pixelBlur)) * weight[z];
prevVal += tex2D(ambPrevColor, texcoord - float2(0, z*pixelBlur)) * weight[z];
}

curr = currVal;
prev = prevVal;
}

technique AdvancedMotionBlur_Tech <bool enabled = RFX_Start_Enabled; int toggle = AdvancedMB_ToggleKey; >
{
pass AMBBlur
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AMBBlur;
RenderTarget0 = ambCurrBlurTex;
RenderTarget1 = ambPrevBlurTex;
}

pass AMBCombine
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AMBCombine;
}

pass AMBPrev
{
VertexShader = RFX_VS_PostProcess;
PixelShader = PS_AMBCopyPreviousFrame;
RenderTarget0 = ambPrevTex;
}
}

#endif

#include GFX_SETTINGS_UNDEF

NAMESPACE_LEAVE()
NAMESPACE_LEAVE()


Reshade v1 default config

////

//
///**ADV_MOTION_BLUR**///
//
////
#define USE_ADV_MOTION_BLUR 1 //[AdvMotionBlur] //-Advanced Motion Blur: More accurate and advanced motion blur.

//>Advanced Motion Blur Settings<\\
#define ambDepth_Check 1 //[0:1] //-Depth dependent motion blur
#define ambDepthRatio 0 //[0.0:1.0] //-Amount of addition MB due to distance; Lower Value => Higher Amount
#define ambRecall 1 //[0.0:1.0] //-Increases detection level of relevant smart motion blur
#define ambPrecision 0 //[0.0:1.0] //-Increases relevance level of detected smart motion blur
#define ambSoftness 10 //[0.0:10.0] //-Softness of consequential streaks
#define ambSmartMult 10 //[0.0:10.0] //-Multiplication of relevant smart motion blur
#define ambIntensity 0 //[0.00:1.00] //-Intensity of base motion blur effect
#define ambSmartInt 0 //[0.00:1.00] //-Intensity of smart motion blur effect
#define AdvancedMB_ToggleKey RFX_ToggleKey //[undef] //-No description given
Last edit: 4 years 4 months ago by TheBlueOne.

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

More
4 years 4 months ago #7 by matsilagi Replied by matsilagi on topic Port GemFX Adv. Motion Blur for Reshade 3
The following user(s) said Thank You: Scorpio82CO, andrew, TheBlueOne

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

More
4 years 4 months ago #8 by TheBlueOne Replied by TheBlueOne on topic Port GemFX Adv. Motion Blur for Reshade 3

matsilagi wrote: pastebin.com/hZNe8mXL

Done


I'm so glad you done it! I've tried it In BeamNG. Works beautifully! Very appreciated. Thank you. :cheer:

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

More
4 years 4 months ago #9 by Martigen Replied by Martigen on topic Port GemFX Adv. Motion Blur for Reshade 3
Please add to the GitHub repository :)
The following user(s) said Thank You: Scorpio82CO

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

More
4 years 3 months ago #10 by Scorpio82CO Replied by Scorpio82CO on topic Port GemFX Adv. Motion Blur for Reshade 3
hi.. thanks for ported it to ver 3xx.. I have a question.. do you see the luluco´s MBMB shader??(mouse based motion blur)... could be applied the code inside of the advanced motion blur to make it work with the depth buffer.. it´s like improved shader.. please... it will be awesome!!
The following user(s) said Thank You: jas01, andrew

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

More
3 years 10 months ago #11 by UTwelve Replied by UTwelve on topic Port GemFX Adv. Motion Blur for Reshade 3

matsilagi wrote: pastebin.com/hZNe8mXL

Done

PerformanceMode doesn't work :huh:

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

More
3 years 9 months ago #12 by MichaelZFreeman Replied by MichaelZFreeman on topic Port GemFX Adv. Motion Blur for Reshade 3
I tried this but nothing seems to be happening. Everything else in ReShade is operative. I checked the stats and nothing in the two popup images is visible. The third image ("last frame") shows a very faint image. Fake Motion Blur (the one supplied with ReShade is working.

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

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.