Motionblur

Preview:

DESCRIPTION

Motion blur in DX9

Citation preview

Pixel Motion Blur

http://ozlael.egloos.com

Motion blur

• What is motion blur?

– Rapidly moving objects appear to be blurred in direction of motion

• What causes motion blur?

– In real cameras, film is exposed to moving scene while shutter is open

• Why do motion blur?

– Adds realism, cinematic look to games

– 24fps with motion blur can look better than 60fps without

Trails behind objects

● Not the same as real motion blur

Radial Blur

● 2D Effect

Depth-Base Velocity

● For static mesh

depth

velocity

Using Accumulation Buffer

● Large time interval between multiple rendering

Image space (2.5D) motion blur

● Pixel Process Motion Blur

Pixel Motion Blur

● Works as a Post Process

● Blurs an image of the scene based on object velocities

● Not a physically correct but plausible

Better than Accumulation Buffer

Algorithm

● 1. Render scene to texture

- At current time

● 2. Calculate velocity at each pixel

- Another Buffer

- Calculate current position – previous position

● 3. Render motion blurred scene

Velocity

Step 1

Step 2

Step 3

What is the Fault?

What is the Fault?

What are the fault?

● Without knowledge of object edges

● Velocity outside silhouette of object is zero(= no blur)

● Solution : Geometry distortion

Stretch object geometry

Matthias Wloka's trick

Matthias Wloka's trick

● stretch object geometry between previous and current position

● Compare normal direction with motion vector using dot product

● If normal is pointing in direction of motion, transform vertex by current transform, else transform it by the previous transform

● Not perfect, but it works

Matthias Wloka's trick

Original Image

Stretched Geometry

Velocity Visualization

Motion Blurred Image

Well... Not Perfect

● Not information to avoid occlusion artifacts

● Number of samples needed depends on amount of motion

- 8 samples is good, 16 is better

- Ironically, more samples will reduce frame rate, and therefore increase motion magnitude

Occlusion fault

Resolve occlusion

Color Motion

Depth

Iterative sampling

● First pass uses 8 samples

● Ping-pong results

● Second pass uses blurred results, this results in 8 * 8 samples (virtually 64)

● 3rd = 512 samples, 4th = 4096, etc

Iterative sampling

Skinning limitation in DX9

● 256 vertex shader constant registers limit

● Our characters have an average of 54 Matrix per drawcall

● For motion blur we need previous frame bone(Matrix)s transformations

● If Bone == Quaternion & Tlanslation then must be Uniform Transform

● Or decrease bone count

So....?

● In RS3 for Now

● Using Pixel Motion Blur = Only Object’s Transform

● Animation’s Proceed = Using Accumulation Buffer

● Any suggestion?

Reference● Stupid OpenGL ShaderTricks -Simon Green

● Pixmotor:A Pixel Motion Integrator - Ivan Neulander

● Interactive Real-Time Motion Blur - Matthias M. Wloka & Robert C.Zeleznik

● Motion Blur Using Geometry and Shading Distortion - Natalya Tatarchuk, Chris Brennan, John Isidoro

● Pixel Motion Blur - Direct X SDK

● Motion Blur as a Post-Processing Effect - GPU Gems 3

● CrysisNext Gen Effects -TiagoSousa

● Hardware Accelerated Motion Blur Generation -Clement Shimizu, AmitShesh, BaoquanChen

● Motionblur - Myia

● http://incrysis.com/forums/

● Capcom presentation on Lost Planet