Welcome, Guest.
Username: Password: Remember me

TOPIC: Simple motion blur

Simple motion blur 1 year 9 months ago #1

  • jas01
  • jas01's Avatar
  • Offline
  • Posts: 79
  • Thank you received: 10
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: 1 year 9 months ago by jas01. Reason: bad link
The administrator has disabled public write access.

Simple motion blur 1 year 9 months ago #2

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2451
  • Thank you received: 1391
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.
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: jas01

Simple motion blur 1 year 9 months ago #3

  • jas01
  • jas01's Avatar
  • Offline
  • Posts: 79
  • Thank you received: 10
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: 1 year 9 months ago by jas01. Reason: more information
The administrator has disabled public write access.

Simple motion blur 1 year 9 months ago #4

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2451
  • Thank you received: 1391
Mind showing a screenshot of it? =)
Cheers, crosire =)
The administrator has disabled public write access.

Simple motion blur 1 year 9 months ago #5

  • jas01
  • jas01's Avatar
  • Offline
  • Posts: 79
  • Thank you received: 10
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: 1 year 9 months ago by jas01. Reason: more information
The administrator has disabled public write access.

Simple motion blur 1 year 9 months ago #6

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2451
  • Thank you received: 1391
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".
Cheers, crosire =)
Last Edit: 1 year 9 months ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: jas01

Simple motion blur 1 year 9 months ago #7

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