Welcome, Guest.
Username: Password: Remember me

TOPIC: Motion Blur?

Motion Blur? 1 year 11 months ago #1

  • Ioxa
  • Ioxa's Avatar
  • Offline
  • Posts: 267
  • Thank you received: 245
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?
The administrator has disabled public write access.

Motion Blur? 1 year 11 months ago #2

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

Motion Blur? 1 year 10 months ago #3

  • Ioxa
  • Ioxa's Avatar
  • Offline
  • Posts: 267
  • Thank you received: 245
Ah, ok, that makes sense, you would need the previous frames to calculate the change. Damn.
The administrator has disabled public write access.

Motion Blur? 1 year 10 months ago #4

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

Motion Blur? 1 year 8 months ago #5

  • Paperboy
  • Paperboy's Avatar
  • Offline
  • You're a big guy.
  • Posts: 10
  • Thank you received: 1
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! [ Click to expand ]

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.
The administrator has disabled public write access.

Motion Blur? 1 year 8 months ago #6

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
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.
The administrator has disabled public write access.