Motion Blur?

  • Ioxa
  • Topic Author
More
9 years 3 months ago #1 by Ioxa Motion Blur? was created by Ioxa
Would it be possible to use the depth buffer to calculate a rate of change and apply a blur when it reached a set speed? Maybe even a directional blur depending on what direction the "camera" is moving and a heavier blur depending on speed?

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 Motion Blur?
Not sure if that's possible with the depthbuffer alone.
I had the idea to provide access to previous frames in the future (not only the current one), so to calculate the difference between the two images, which then maybe could be used as a velocity replacement to create motion blur. But those are only ideas, I don't know if that would work out.
The following user(s) said Thank You: MaxG3D

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

  • Ioxa
  • Topic Author
More
9 years 3 months ago #3 by Ioxa Replied by Ioxa on topic Motion Blur?
Ah, ok, that makes sense, you would need the previous frames to calculate the change. Damn.

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

  • crosire
More
9 years 2 months ago - 9 years 2 months ago #4 by crosire Replied by crosire on topic Motion Blur?
While it's impossible to achieve "real" motion blur (which only affects moving objects) even with access to previous frames (I don't see a way to calculate pixel velocity just from color data, so what I said before doesn't make sense), there is another way, besides blending multiple frames together (no real motion blur either, though some people title this "motion blur" too).

Anybody remembering the motion blur in Need for Speed Most Wanted?

This one is actually very very simple to implement (it doesn't exactly look great, but oh well). It's a simple radial blur post-processing effect, nothing more.

Here's a radial blur implementation taken from here (note that it's a static effect of course, but still can look nice on screenshots or in motion):
static const float2 BLUR_CENTER = float2(0.5, 0.5); // center of the blur
static const float BLUR_START = 1.0f; // blur offset
static const float BLUR_WIDTH = -0.05; // blur size
static const int BLUR_SAMPLES = 10; // number of samples, more = higher quality, but bigger performance hit

texture colorTex : COLOR;
sampler colorSampler { Texture = colorTex; };

float4 RadialBlur(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
	texcoord -= BLUR_CENTER;

	float4 color = float4(0, 0, 0, 0);

	for (int i = 0; i < BLUR_SAMPLES; i++)
	{
		color += tex2D(colorSampler, texcoord * (BLUR_START + BLUR_WIDTH * (i / (float)(BLUR_SAMPLES - 1))) + BLUR_CENTER);
	}
	
	color /= BLUR_SAMPLES;

	return color;
}
Warning: Spoiler!
Last edit: 9 years 2 months ago by crosire.
The following user(s) said Thank You: jas01

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

  • Paperboy
More
9 years 4 weeks ago #5 by Paperboy Replied by Paperboy on topic Motion Blur?

crosire wrote: While it's impossible to achieve "real" motion blur (which only affects moving objects) even with access to previous frames (I don't see a way to calculate pixel velocity just from color data, so what I said before doesn't make sense), there is another way, besides blending multiple frames together (no real motion blur either, though some people title this "motion blur" too).

Anybody remembering the motion blur in Need for Speed Most Wanted?


This one is actually very very simple to implement (it doesn't exactly look great, but oh well). It's a simple radial blur post-processing effect, nothing more.

Here's a radial blur implementation taken from here (note that it's a static effect of course, but still can look nice on screenshots or in motion):
static const float2 BLUR_CENTER = float2(0.5, 0.5); // center of the blur
static const float BLUR_START = 1.0f; // blur offset
static const float BLUR_WIDTH = -0.05; // blur size
static const int BLUR_SAMPLES = 10; // number of samples, more = higher quality, but bigger performance hit

texture colorTex : COLOR;
sampler colorSampler { Texture = colorTex; };

float4 RadialBlur(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
	texcoord -= BLUR_CENTER;

	float4 color = float4(0, 0, 0, 0);

	for (int i = 0; i < BLUR_SAMPLES; i++)
	{
		color += tex2D(colorSampler, texcoord * (BLUR_START + BLUR_WIDTH * (i / (float)(BLUR_SAMPLES - 1))) + BLUR_CENTER);
	}
	
	color /= BLUR_SAMPLES;

	return color;
}
Warning: Spoiler!


How is the motion blur in ENB achieved, then? The old version detected camera rotation and velocity and applied a fullscreen directional or radial blur. The new version is depth buffer affected, and blurs things more the closer they are to the camera. It was gorgeous.

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

  • Ganossa
More
9 years 4 weeks ago #6 by Ganossa Replied by Ganossa on topic Motion Blur?
Don't worry, you will get exactly that with the upcoming ReShade framework. However, Crosire is right, with post processing we can only estimate velocity values.

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 forum. 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.