Simple motion blur

  • jas01
  • Topic Author
More
9 years 3 months ago - 9 years 3 months ago #1 by jas01 Simple motion blur was created by jas01
Hello!

*First of all sorry for my poor grammar*

So I have radial blur effect from this topic: reshade.me/forum/shader-suggestions/61-motion-blur
But this is only static effect. It is possible to get this to work only when I hold/press "w" (key)?... Or when my character is moving. I need a command for this (or something like that). Please help.

best wishes,
jas01
Last edit: 9 years 3 months ago by jas01. Reason: bad link

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

  • crosire
More
9 years 3 months ago #2 by crosire Replied by crosire on topic Simple motion blur
ReShade provides a way to check for keyboard input. So:
// true if key is pressed, false otherwise
uniform bool isMovingForward < source = "key"; keycode = 0x57; /* W key */ >;

float4 RadialBlur(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
	...

	return isMovingForward ? color : tex2D(colorSampler, texcoord);
}

Now it only shows up while you hold down the W key. It's still static though and the transform is a hard cut, would need some more work to make it smooth.
The following user(s) said Thank You: jas01

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

  • jas01
  • Topic Author
More
9 years 3 months ago - 9 years 3 months ago #3 by jas01 Replied by jas01 on topic Simple motion blur
Thank you for answer. :) I'm glad that i can write with you.

Your method works. But now blur looks strange. The image is moved down. Actually, I have two images now... I'm using MasterEffect. Can this cause the problem? Here are my settings:
www.mediafire.com/download/7sx47cpr8s6585i/ReShade.fx (I am a beginner, so sorry for all my mistakes...)


Here you can see the problem. This happens without holding "w".
www.mediafire.com/download/8ww0mn45tmn63t4/problem.rar


I can change ,,static const float2 BLUR_CENTER = float2(0.5, 0.5)" to ,,static const float2 BLUR_CENTER = float2(0.0, 0.0)" and ,,static const float BLUR_WIDTH = -0.5" to ,,static const float BLUR_WIDTH = -0.01", but then but then the entire screen is also blurred...
Last edit: 9 years 3 months ago by jas01. Reason: more information

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

  • crosire
More
9 years 3 months ago #4 by crosire Replied by crosire on topic Simple motion blur
Mind showing a screenshot of it? =)

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

  • jas01
  • Topic Author
More
9 years 3 months ago - 9 years 3 months ago #5 by jas01 Replied by jas01 on topic Simple motion blur
I added a link for the screenshot in previous post.

/Edit:
I should go to sleep. :) I'll be available tomorrow.

Good night. :)
Last edit: 9 years 3 months ago by jas01. Reason: more information

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

  • crosire
More
9 years 3 months ago - 9 years 3 months ago #6 by crosire Replied by crosire on topic Simple motion blur
Oh, or course, I'm stupid. Didn't see how that shader subtracts the blur center from texcoord at the top. This works:
float4 RadialBlur(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
	if (!isMovingForward)
	{
		return tex2D(SamplerColorLDR, texcoord);
	}
	
	texcoord -= BLUR_CENTER;

	....
	
	color /= BLUR_SAMPLES;

	return color;
}

Now if you use this with MasterEffect (like you do), to optimize I would move all that after these lines:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Functions
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Then remove these lines:
texture colorTex : COLOR;
sampler colorSampler { Texture = colorTex; };
And inside the RadialBlur function, replace "colorSampler" with "SamplerColorLDR".
Last edit: 9 years 3 months ago by crosire.
The following user(s) said Thank You: jas01

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

  • jas01
  • Topic Author
More
9 years 2 months ago #7 by jas01 Replied by jas01 on topic Simple motion blur
I'm very sorry that I didn't write to you sooner...

Of course, it works perfectly now. I'm very happy with the result. :) Looks really nice in Overgrowth by Wolfire Games (action game in third person mode). Thank you very very much.

I want to thank you for all of your hard work. You gave me a reason to smile. :)
The following user(s) said Thank You: crosire, andrew

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