dx11 effects in metro · 2010-09-21 · metro 2033: the game a combination of horror, survival, rpg...

47

Upload: others

Post on 07-Jul-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky
Page 2: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

DX11 Effects in Metro 2033: The Last Refuge

Oles Shishkovtsov, 4A Games Ashu Rege, NVIDIA Nikolai Sakharnykh, NVIDIA

Page 3: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Metro 2033: the game

A combination of horror, survival, RPG and shooting

Based on a novel by Dmitry Glukhovsky

Page 4: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Technology

Developed by Oles Shishkovtsov Lead architect of the STALKER engine

Metro engine is based on new tech Packs a lot of innovation

Pervasive DX11 tessellation Advanced post processing using

DX Compute

Page 5: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Depth of field

Common effect in games these days

Typically post-processing image from a pin-hole camera

Key challenge: Need to keep sharp in-focus objects and blurry backgrounds from bleeding into each other

Page 6: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Circle of Confusion (CoC)

Page 7: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Depth of field effect

Post-processing input color layer by using depth layer to calculate CoC (circle of confusion)

color

CoC

DOF filter result

Page 8: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Bleeding artifacts

From Metro 2033, © THQ and 4A Games

Page 9: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Bleeding artifacts

From Metro 2033, © THQ and 4A Games

Page 10: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Diffusion DOF in Metro

From Metro 2033, © THQ and 4A Games

Page 11: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Diffusion DOF in Metro

From Metro 2033, © THQ and 4A Games

Page 12: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Diffusion DOF in Metro

From Metro 2033, © THQ and 4A Games

Page 13: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Diffusion-based DoF

Main problem: Blur kernel size varies across screen

Diffusion simulation: Convert CoC into varying heat

conductivity and allow colors to diffuse as temperature series.

Small CoC == lower diffusion

See Interactive DOF using Simulated Diffusion on a GPU, Kass et al.

Page 14: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Benefits

No color bleeding

Traditional DOF Diffuse DOF

From Metro 2033, © THQ and 4A Games

Page 15: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Benefits – detail view

Traditional DOF Diffuse DOF

From Metro 2033, © THQ and 4A Games

Page 16: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Benefits

Clear separation of sharp in-focus and blurred out-of-focus objects

From Metro 2033, © THQ and 4A Games

Page 17: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Cinematic look

From Metro 2033, © THQ and 4A Games

Page 18: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Implementation

We cast DOF problem in terms of differential equation

Using Alternate Direction Implicit (ADI) numerical method

( )utu

∇⋅⋅∇=∂∂ β

),( yxu

),( yxβ

Image color

Circle of confusion

Page 19: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Implementation

ADI decomposes equation into X & Y directions

Applies FD scheme which leads to a number of tri-diagonal systems

Color

X Solver

Y Solver

Result

Radius

Page 20: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Solving tridiagonal systems A number of methods exist:

Cyclic reduction (CR) Parallel cyclic reduction (PCR) Simplified Gauss elimination (Sweep) (see references for details)

We use a new hybrid approach PCR + Sweep

Page 21: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Solving tridiagonalsystems (x direction)

Here xi are the per-pixel colors Each system is of size == WIDTH And # of systems == HEIGHT di are the initial conditions We want a GPU friendly version…

Page 22: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Hybrid tridiagonal solver - PCR Few steps of parallel cyclic

reduction (PCR) Implemented in pixel shader

At each PCR step we double the number of systems and halve the size of each system More parallel work to fill GPU.

init

1st

2nd

Page 23: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Hybrid tridiagonal solver - Sweep Finish with simplified Gauss

elimination (Sweep) Implemented in compute shader

Each thread solves one system Forward elimination Backward substitution Complexity O(N)

Page 24: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Tridiagonal solver in DX11

Tridiagonal Fill

PCR steps

Sweep

Pixelshader

Pixelshader

Computeshader

Num systems

System size

Height Width

Height*8 Width/8

PCR steps = 3

Page 25: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

References

“Interactive depth of field using simulated diffusion on a GPU” Michael Kass, Aaron Lefohn, John Owens, Pixar Animation studios, Pixar technical memo #06-01

“Tridiagonal solvers on the GPU and applications to fluid simulation” Nikolai Sakharnykh, GTC 2009

“Fast tridiagonal solvers on the GPU” Yao Zhang, Jon Cohen, John D. Owens, PPoPP 2010

Page 26: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Tessellation

Enables film-level geometric detail in real-time rendering

Automatic LOD without popping High quality meshes at low cost

Page 27: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Bump Mapping Often not Sufficient

Page 28: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Tessellated Monster in Metro 2033

From Metro 2033, © THQ and 4A Games

Page 29: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

More Metro Monsters...

From Metro 2033, © THQ and 4A Games

Page 30: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

... and Characters

From Metro 2033, © THQ and 4A Games

Page 31: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

... more Characters

From Metro 2033, © THQ and 4A Games

Page 32: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Start with a Coarse Base Mesh

Page 33: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

HW-based Subdivision

Page 34: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Apply Displacement

Page 35: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

LOD Computation

TESS_FACT = LEN * NP * Q / DIST

Where LEN is edge length in world space

NP is number of pixels on the screen

Q is quality constant DIST is distance from observer to

edge center

Page 36: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Constant Triangle Size

Page 37: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Subdivision Schemes

Phong tessellation PN-triangles Approximate Catmull-Clark …

Metro uses Phong tessellation

Page 38: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Phong Tessellation

From Boubekeur and Alexa, Siggraph Asia 2008

Page 39: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Phong Tessellation

Simple scheme Does not handle inflections well Acceptable if initial subdivision is

rather dense

BBoubekeur and Alexa, 2008

Page 40: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Content Creation Pipeline

Parameterized coarse model(3DS MAX)

Subdivide and displace

(ZBrush®)

Displacement & occlusion maps

Engine preprocessor

Page 41: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Computing Displacement

Input: coarse and detailed model

Coarse surface

Detailed surface

Page 42: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Cracks: Discontinuity in Parametrization

Page 43: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Cracks: Ownership-Based Solution Boundary triangles share the same

texture coordinates data

Page 44: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Cracks: Ownership-Based Solution Boundary primitives store extra

set of texture coordinates

1 normal texture coordinate 2 extra coordinates per edge 1 extra coordinate per corner

12 coordinates per triangle patch 16 coordinates per quad patch

Page 45: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Artifacts on Hard Edges

Page 46: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Transitional Polygons

Page 47: DX11 Effects in Metro · 2010-09-21 · Metro 2033: the game A combination of horror, survival, RPG and shooting Based on a novel by Dmitry Glukhovsky

Conclusion: DX11 in Metro 2033

Tessellation enables a massive increase in geometric fidelity in game graphics Even existing art assets can benefit

Compute shaders allow first ever implementation of cinematicquality post-processing