4k checkerboard in battlefield 1 and mass effect andromeda

154
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda Graham Wihlidal Rendering Engineer Frostbite Labs

Upload: electronic-arts-dice

Post on 19-Mar-2017

26.708 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

4K Checkerboardin Battlefield 1 andMass Effect AndromedaGraham WihlidalRendering EngineerFrostbite Labs

Page 2: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Conclusion

Page 3: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 4: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 5: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 6: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 7: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Conclusion

Page 8: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 9: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1080p

Page 10: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1800p

Page 11: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

2160p

Page 12: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 13: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1080p 4K

Page 14: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 15: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

4K1080p

Page 16: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 17: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

4K1080p

Page 18: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 19: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

4K1080p

Page 20: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Motivation► Over the past few years...

► Visual fidelity and complexity has greatly increased

► More memory (order of magnitude)► Primitive rate (order of magnitude)

► Computational demands (PBR, Dynamic GI, SSR, etc.)

Page 21: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Motivation► Over the past few years...

► Increases in rendering resolution has not

► Majority of current titles are 900p or 1080p

► It’s time that ‘perceived’ resolution got a bump!

Page 22: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 23: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Motivation► Detailed geometry results in aliasing artifacts

► Lack of high resolution geometry information► Image quality is reduced in favor of temporal stability

► Frostbite had deferred MSAA support previously► Maintenance nightmare (i.e. shader permutations)► Removed to reduce complexity

► Sony added hardware features to PS4™Pro► Easier and faster decoupling of geometry and shading rate► Less risk for initial adoption

Page 24: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Motivation► Reduce shading cost in majority of graphics pipeline

► Shade only a subset of pixels► Compute geometry information for all pixels► Some information is lost

► 4k sampling rate adjacent pixels are strongly correlated► Assuming they belong to the same surface

► High quality geometry-aware resolve to reconstruct

Page 25: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

History► SIE (WWS ATG): PS3™ Edge MLAA (’09)

► Used Object IDs to drive MLAA edge detection in SOCOM4 [5]

► SIE (WWS ATG): PS4™ AA Prototype (’13, unreleased)► Use EQAA for higher resolution depth► Reconstruct full-resolution image, then resolve down► Layer further AA techniques on resulting image

► Guerrilla Games: ’Killzone: Shadowfall’ (’13)► Temporal super-resolution with alternating pixel-column► Difference blend operator [3]

Page 26: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

History► SIE: PS4™Pro Architecture (’13-15)

► Alternating Packed Checkerboard Sampling [15]► Texture Gradient Adjustment(*)► Pixel Shader Invocation Control(*)► High-Resolution Object and Primitive ID Buffers(*)

► SIE (WWS ICE/ATG): 4KCB / 4KG Demos (’15)► First implementations of these techniques in game titles► inFamous: First Light, Knack, Uncharted 4 - on PS4™Pro hardware [16,17]

► Ubisoft: Rainbow Six | Siege (‘15)► MSAA checkerboard implementation [1]

► EA Frostbite | Labs : PS4™Pro Support for Frostbite ('16)► ‘Battlefield 1’ and ‘Mass Effect Andromeda’

(*) PS4™Pro custom hardware features

Page 27: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Exploration► Tried a number of high resolution techniques

► Variety of resolutions► 50” TV at living room distance

► Super-sampling \ native 4K► Looks great!► Perf timers don’t…

► Reduced resolution to 1800p► Still too expensive @ 60Hz

7209001080

144018002160

/ 2 =

Page 28: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

2160p29.07ms

PS4™Pro

Page 29: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1800p21.07ms

PS4™Pro

Page 30: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Exploration► Variable shading rate is popular

► Checkerboard is a practical idea

► Greatly increase resolution

► Without much performance cost

Page 31: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Exploration► Stencil out 1x1 blocks

► Using stencil is terrible, no performance gain

► GPU shades in 2x2 quads

► Same cost as rendering native 4K► Throw away half of the work► 50% inactive lanes

Page 32: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Exploration► Stencil out 2x2 blocks

► Sampling distribution is bad; less correlation► Great coverage in a 2x2 block, then a huge hole► Blurry dilated color bits every 2nd quad

► End up blurring even more to solve► What’s the point?

Page 33: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 34: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Exploration► 2x color and 4x depth checkerboard

► Available on any MSAA platform► Requires all shaders to load from MS textures (lots of changes)► Sub-optimal – more on this later

► Alternatively, 2x color and 2x depth [1]

Page 35: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Exploration► 1x color and 4x depth geometry resolve (4K Geometry)

► 1080p to 4K► Was a good idea, and is similar to SRAA [14]► Single Pass + IDs + custom reconstruction► Quality wasn’t high enough

► Abandoned early in favor of 4K CB► Comparable implementation cost► More research would improve concept

Page 36: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Exploration► Settled on “packed checkerboard” technique

► Started with PS4™Pro reference implementation► Customized + optimized further, and incorporated our own TAA

Frame N Frame N+1 Resolved

Page 37: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 38: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 39: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 40: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Spatial + Temporal Resolve

Page 41: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1800p CB15.99ms

PS4™Pro

Page 42: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1800p 21.07msPS4™Pro

Page 43: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1800p CB 15.99msPS4™Pro

Page 44: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Conclusion

Page 45: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA – What is it?► EQAA [7] (AMD) is a superset of MSAA

► Possible to store fewer color fragments than depth fragments

► Color <= ID <= Depth

► 4K checkerboard exploits this configuration► 1x color fragment► 2x ID fragments► 2x depth fragments

Page 46: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Shading Quads – 2x Color : 4x Depth

8 Shaded, 2 Stored

ddx

ddxddy

ddy

Page 47: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Shading Quads – 1x Color : 2x Depth

4 Shaded, 2 Stored

• 2x method: 2 steps and sqrt(2) steps.• 4x method: 2 steps and sqrt(8) steps.

ddx

ddy

Page 48: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Checkerboard Layout

Center

Sample 0

Sample 1

-1/4 0 +1/4

-1/4 0 +1/4

Note: Positions are specified per-quad

Page 49: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Conclusion

Page 50: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Object and Primitive ID Buffer► Generated at a resolution higher than shading resolution

► Each visible geometry sample► Identifier stored in image buffer► Uniquely identifies object and primitive

► Instanced draws provide a separate object ID per instance► Draws take pointer to an array of object IDs, one for each instance

► Tessellated draws are given a primitive ID per input patch

Page 51: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Object and Primitive ID Buffer► Written during depth-only passes, or main scene render

► Depth/ID-only► Consumes less memory bandwidth than shading passes► Performed without shader involvement (on PS4™Pro)► Allows asynchronous compute jobs running in parallel

► CPU and GPU overhead► We don’t use full pre-pass► Alpha tested objects + dominant occluders

► Main shading► Easier to integrate if no existing depth-only pass► Competes with memory bandwidth► ID-only samples don’t pay for shading

Page 52: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Object and Primitive ID Buffer► 32-bit, 16-bit, or 8-bit

► We use 31-bits wide► MSB ignored by hardware► 14-bit object ID + 17-bit primitive ID

► Primitive ID reset to 0 at the end of each instance or draw

Page 53: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Object and Primitive ID Buffer► Color target bound as 8th MRT

► Uses CB’s data paths and color target tile modes► Safe to use null pixel shader► Not treated as a pixel shader target during ID propagation

► IDs can also be exported from vertex shader► Could reduce number of VS wavefronts active on chip

► Many other interesting use cases► Not covered in this presentation

► Can be used in resolve to improve quality of final image [5]

Page 54: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 55: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 56: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 57: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust► Horizontal gradient is twice the expected value► Vertical gradient is stretched and rotated 45˚► Resembles bad anisotropic filtering

Expected Gradient Real Gradient

ddx

ddy

ddx

ddy

Page 58: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust► Need to apply non-uniform rescale

► Rectangular pixels

► LOD Bias► Doesn’t work – scales uniformly

► Use SampleGrad fetch:

Expected Gradient

Real Gradient

Page 59: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust

|𝑑 [𝑢𝑣𝑤 ]𝑑𝑥′

𝑑 [𝑢𝑣𝑤 ]𝑑𝑦′ |=|𝑓 𝑎𝑐𝑡𝑜𝑟00 𝑓𝑎𝑐𝑡𝑜 𝑟01

𝑓𝑎𝑐𝑡𝑜𝑟 10 𝑓𝑎𝑐𝑡𝑜𝑟11|∗|𝑑 [𝑢𝑣𝑤 ]𝑑 𝑥𝑑 [𝑢𝑣𝑤 ]𝑑𝑦|

Identity (No Adjustment):

|𝑑 [𝑢𝑣𝑤 ]𝑑𝑥′

𝑑 [𝑢𝑣𝑤 ]𝑑𝑦′ |=|1.0 0.0

0.0 1.0|∗|𝑑 [𝑢𝑣𝑤 ]𝑑𝑥𝑑 [𝑢𝑣𝑤 ]𝑑𝑦|

Page 60: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust

Frame N + 1:

Frame N + 0:

|𝑑 [𝑢𝑣𝑤 ]𝑑𝑥′

𝑑 [𝑢𝑣𝑤 ]𝑑𝑦′ |=|+0 .5 0.0

−0.5 1.0|∗|𝑑 [𝑢𝑣𝑤 ]𝑑𝑥𝑑 [𝑢𝑣𝑤 ]𝑑𝑦|

|𝑑 [𝑢𝑣𝑤 ]𝑑𝑥′

𝑑 [𝑢𝑣𝑤 ]𝑑𝑦′ |=|0 .5 0.0

0 .5 1.0|∗|𝑑 [𝑢𝑣𝑤 ]𝑑 𝑥𝑑 [𝑢𝑣𝑤 ]𝑑𝑦|

Page 61: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust► Manual gradient correction with shader ALU

► ~10% extra cost in main shading

► SampleGrad issue is more expensive than normal fetch (in cy)

► No change in bandwidth / latency► Fetch and filter are unaffected

► Increased register pressure► Keep derivatives around► Need to be careful!

Page 62: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust► However…

► Only shade half the pixels

► Not all instructions in the shader are a fetch

► Overall win

Page 63: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust► PS4™Pro has special hardware and compiler support!

► Hardware can perform this in the texture unit

► Affine transform stored in texture unit

► Just turn it on ALU portion is free

Page 64: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust

Page 65: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Gradient Adjust► Most cases can be automatically adjusted

► Explicit gradients (ddx/ddy) need to be manually corrected► Custom filtering► Virtual texturing► etc.

Page 66: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Broken GradientsProgrammer Art

Page 67: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Adjusted GradientsProgrammer Art

Page 68: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Barycentric Evaluation

Pixel Positionsû ü Sample Positions

Images courtesy of SIE [15]

Page 69: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Barycentric Evaluation

Pixel Positionsû

Images courtesy of SIE [15]

Page 70: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Barycentric Evaluation

ü Sample Positions

Images courtesy of SIE [15]

Page 71: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 72: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Alpha Unrolling► Alpha test computes depth/coverage inside pixel shader

► Instead of relying on scan-converter, like opaque

► By default, pixel shader runs at pixel rate

► All samples of a pixel share output of single shader invocation

► IDs at shading rate instead of full rate

► Serious problem with hole reconstruction

Page 73: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Alpha Unrolling► Solution: Run samples at coverage rate!

► Generate full resolution depth and IDs

► Each pixel quad is unrolled► Shading quad created per sample

► Large increase in pixel shader work► Important to switch off when not needed

Page 74: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Alpha Unrolling► Run minimal pass to calculate coverage

► Computes coverage/depth (Clip / Depth Write)► Coverage rate (2x)

► Run expensive shading pass► Computes color values (Depth Equals)► Benefits from maximal hidden surface removal► Pixel rate (1x)

Page 75: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Alpha Unrolling► Positions need to be invariant!

► Positions written by coverage and shading need to match

► Subtle differences in computation can lead to z-fighting

► Disable “fast math” for everything that goes into the position

Page 76: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Before

Programmer Art

Page 77: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

After

Programmer Art

Page 78: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Before

Programmer Art

Page 79: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

After

Programmer Art

Page 80: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Conclusion

Page 81: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

PS Invoke► Every sample position…

► If covered by a triangle, can trigger pixel shading► Checkerboard uses 1x color and 2x depth/IDs► Half of the shading does not contribute to final image

► How can we prevent over-shading?

► Pixel Shader Invocation Control (PS Invoke)► Can make samples "non-shading”► Get the shading work back to what it would be with a single sample

Page 82: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

FP16► PS4™Pro has support for FP16 GCN instructions

► Used throughout checkerboard resolve shader

► 30% performance improvement

Page 83: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve► Many passes do not require higher-resolution depth and IDs

► Don’t waste depth block (DB) bandwidth! Can be ½ instead

► Transparent objects + post-processing are candidates► Do not write depth► Read from single-sample!

► Resolve to single-sample depth and stencil► Occurs after partial pre-pass + gbuffer laydown

Page 84: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve► Simple approach is to copy depth with compute shader

► Requires depth\HTILE decompression ► Slow!

► Use color block (CB) trick to resolve without decompression!

► AMD Evergreen Acceleration document [8] describes:► CB copy of depth to color target► No decompression needed► Great! But we want a usable depth surface in the end, not color

► Buckle up....

Page 85: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve► Dummy shader that writes R32F 0.0f

► exp mrt0, 0.0, off, off, off vm done

► Alias the destination depth target as a color target► 2d non-displayable thin and 1xAA depth micro tiling are the same

► Set DEPTH_COPY bit on DB_RENDER_CONTROL► PS puts a dummy value on mrt0.x► DB replaces it later

► The CB writes the depth to the destination Z surface► Without HTILE!

Page 86: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve► Stencil is done in a similar manner

► Set STENCIL_COPY bit in DB_RENDER_CONTROL

► CB writes stencil to G channel

► Destination is a color target aliasing stencil► Only R channel present

► Adjust CB color info register to swizzle► G to R on write► As per COMP_SWAP [4] to configure as SWAP_ALT

Page 87: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve

Page 88: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 89: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 90: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 91: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve► Original HTILE has correct ranges

► but has compressed ZMask codes

► Patch up the HTILE by copying it► Fast compute shader! (6µs)► Force ZMask bits to 0xF (expanded)► Store patched meta data

► HTILE acceleration works on the 1xAA destination► Any further writes will compress as expected

Page 92: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve► HTILE copy:

Page 93: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

EQAA Depth Resolve► This saved us 1ms over basic copy!

► Leaves the source depth and stencil fully compressed► DBs and CBs do the work

► Which understand compression

► Instead of shader cores doing it► Would require decompression

► Technique is completely bandwidth-bound ► ~0.1ms for depth, ~0.1ms for stencil

Page 94: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Conclusion

Page 95: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Post Processing► Trade-off between performance and quality

► Move as much post-processing before CB resolve as possible

► Very time consuming and painful work► Evolving codebase breaks checkerboard often► New concept to many

► Auto-test checkerboard pipeline if possible

Page 96: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Post Processing► Operations that ignore geometry provide little value at 4K

► i.e. SSAO, luminance estimation, etc..

► Limiting color propagation over an edge - run at lower res

► Need to account for checkerboard ”pixel grid”► Linear sampling of checkerboard surface is problematic► Aspect ratio of the buffer is different from normal 16:9

► Most cases you can ½ the horizontal filter width

Page 97: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Test Scene - Broken

Page 98: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Test Scene - Fixed

Page 99: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Post ProcessingCorrected with:

Offsets UV used for clip-space position reconstruction

Page 100: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 101: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1600x1800

• Clear (IDs and Depth)• Partial Z-Pass• G-Buffer Laydown• Resolve AA Depth• G-Buffer Decals• HBAO + Shadows• Tiled Lighting + SSS• Emissive• Sky• Transparency• Velocity Vectors

3200x1800

• CB Resolve + Temporal AA• Motion Blur• Foreground Transparency• Gaussian Pyramid• Final Post-Processing• Silhouette Outlines

3840x2160 • Display Mapping + Resample

BF1 : PS4™Pro

Page 102: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1600x1800

• Clear (IDs and Depth)• Partial Z-Pass• G-Buffer Laydown• Resolve AA Depth• G-Buffer Decals• HBAO + Shadows• Tiled Lighting + SSS• Emissive• Sky• Transparency• Velocity Vectors

3200x1800

• CB Resolve + Temporal AA• Sprite Depth-of-Field• Motion Blur• Foreground Transparency• Gaussian Pyramid• Final Post-Processing• Silhouette Outlines

3840x2160 • Display Mapping + Resample

MEA : PS4™Pro

Page 103: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Checkerboard Resolve► Spatial Component

► Color Bounding Box► Differential Blend Operator► Object and Primitive IDs

► Temporal Component► Sub-Pixel Jittering► Velocity-Based Reprojection► Neighborhood Clamping

Page 104: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Spatial Component► Color Bounding Box► Differential Blend Operator► Object and Primitive IDs

Page 105: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Color Bounding Box► Checkerboard resolve does not use depth

► Use color to determine if edges are soft

► Avoid contribution to a pixel from different objects

► If all neighbors are different objects, average is used

Page 106: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Color Bounding Box

A

B

C

Image courtesy of SIE [15]

Page 107: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Color Bounding Box

Copy Single Sampleû ü Comparison Heuristic

Page 108: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Color Bounding Box

Copy Single Sampleû

Page 109: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Color Bounding Box

ü Comparison Heuristic

Page 110: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Differential Blend Operator

Neighborhood Averageû ü Differential Blending

Images courtesy of SIE [15]

Page 111: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Differential Blend Operator

Differential Blending üü Differential Blending + IDsü

Images courtesy of SIE [15]

Page 112: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Differential Blend OperatorImages courtesy of SIE [15]

Neighborhood Averageû

Page 113: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Differential Blend OperatorImages courtesy of SIE [15]

üü Differential Blending + IDs

Page 114: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Differential Blend Operator

Page 115: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Object and Primitive IDs

Object IDPrimitive ID

ûû

Object IDPrimitive ID

üü

Object IDPrimitive ID

üû

Object IDPrimitive ID

ûü

Images courtesy of SIE [15]

Page 116: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Temporal Component► Similar to existing research - [2][11][12]

► Not covered here► Sub-Pixel Jittering► Neighborhood Clamping

► Velocity-Based Reprojection► Updated for checkerboard

Page 117: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Velocity-Based Reprojection► Objects and surfaces are moving► Pixel grid is stationary

► Need to correlate 3D surfaces in motion► Surfaces write per-pixel velocity vectors

► Dilate velocities to keep anti-aliased edges► Use front-most velocity in 3x3 window► Depth is expensive to fetch!

Page 118: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Dilate Velocity Separately For Each Pixel

2 Pixels Per ThreadPass-through and Filtered

Estimate Velocity Variation

Use Average Velocity

Is Similar?

YES

NOX

Pass-through Pixel

Filtered Pixel

X

Page 119: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 120: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Checkerboard Input

LDSHalf Res (CB)

Spatial Resolve

LDSFull Res (No CB)

Fetch History

Temporal AA

LDS Sharpen FilterHistory (Full) Final Frame (Full)

2 Pixels Per ThreadPass-through and Filtered

Fetch ID(Not in LDS)

Reprojection

Checkerboard Resolve

Page 121: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Sharpen Filter► Blurred image lacks high-frequency components

► Hard to discern objects, visual cortex lacks information► Ganglion cells respond acutely to high-frequency components [6]

Page 122: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Sharpen Filter► Amplify (recover) high-frequency

components► Greatly enhance visual quality► Performed after image reconstruction in temporal

AA

► Be careful to not reintroduce aliasing► (false high-frequency)

► Be careful to not introduce ringing► (over-sharpening)

Page 123: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Before

Page 124: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

After

Page 125: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Before

Page 126: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

After

Page 127: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Before

Page 128: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

After

Page 129: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 130: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Post Processing► Once checkerboard is in enabled, brace yourself

► Every single artifact now looks like a checkerboard artifact

► Add lots of debug overlays to help debug

► Teach others how to diagnose!

Page 131: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 132: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 133: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 134: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 135: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 136: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Future Work

Page 137: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Render Target Aliasing► Biggest pain of 4K transition was memory!

► Majority of our render targets were to blame► At the time, no fancy memory management of them

► Extra effort spent here impacted other 4K improvements

► “11th hour” explicit aliasing to ship – saved ~230mb

► Future Titles► See: FrameGraph: Extensible Rendering Architecture in Frostbite

Page 138: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
Page 139: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Dynamic Resolution Scaling► Developed by DICE and Microsoft

► Plays nicely with 4K checkerboard

► Checkerboard always active

► Dynamic scaled initial frame resolution► Determined with running performance heuristic

Page 140: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Dynamic Resolution Scaling► BF1 contains a number of infrequently running GPU tasks

► Caused resolution to slightly adjust almost every frame► Not an issue

► Worked with jitter to provide variation in subpixel detail

► Tried preventing upscale if camera wasn’t moving► Resulted in noticeably lower quality image

Page 141: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Dynamic Resolution Scaling► No one complained about it!

Page 142: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Agenda► Motivation► Configuration► Features► Optimizations► Post Processing► Pipeline► Conclusion

Page 143: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1800p CB15.99ms

PS4™Pro

1800p21.07ms

Page 144: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Performance► Total: 15.99 ms

► Clear IDs: 0.57 ms► Copy Expanded HTile [3x]: 0.02 ms► Resolve EQAA Depth [3x]: 0.69 ms► CB Resolve + Temporal AA: 1.15 ms

► Everything Else: 13.56 ms

► 1800p CB vs 1800p (saves 5.08 ms)

PS4™Pro

Page 145: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

PerformanceTimer 1800p 1800p CB

G-Buffer 4.25 ms 3.11 ms

Shadows 4.13 ms 2.63 ms

Lighting 2.31 ms 1.61 ms

Sky 0.63 ms 0.32 ms

Half Res 1.54 ms 0.77 ms

Velocity 0.57 ms 0.25 ms

HBAO 2.47 ms 1.08 ms

PS4™Pro

Page 146: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

1800p CB23.42ms

PS4™Pro

1800p36.82ms

Page 147: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Performance► Total: 23.42 ms

► Clear IDs: 0.41 ms► Copy Expanded HTile [3x]: 0.02 ms► Resolve EQAA Depth [3x]: 0.80 ms► CB Resolve + Temporal AA: 2.00 ms

► Everything Else: 20.19 ms

► 1800p CB vs 1800p (saves 13.40 ms)

PS4™Pro

Page 148: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

PerformanceTimer 1800p 1800p CB

G-Buffer 5.11 ms 4.41 ms

Shadows 3.70 ms 3.32 ms

Lighting 13.5 ms 7.32 ms

Sky 0.50 ms 0.29 ms

Half Res 2.53 ms 1.48 ms

Velocity 0.32 ms 0.27 ms

HBAO 3.11 ms 1.27 ms

PS4™Pro

Page 149: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Future Work► Further improvements to checkerboard resolve

► Alternative approaches to alpha testing► Alpha mask export► Pixel rate coverage (not sample)

► More uses for IDs► Temporally stable object and primitive IDs?► Replace stencil-based tagging [9]

► Help eliminate ghosting with temporal re-projection► Remove heuristics in favor of comparisons

Page 150: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Future Work► Packed checkerboard on other platforms

► Hardware features like ID buffer only exist on PS4™Pro► Reasonable workarounds exist for Xbox™ and base PS4™.

► Need EQAA + programmable sample locations► Vulkan + DirectX12

► Driver support for efficient EQAA depth resolve► Leave source compressed► Bandwidth-bound

Page 151: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Future Work► Filtered visibility buffer [10] + decoupled shading

► G-buffers are challenging at high resolutions

► Classic deferred shading isn’t the answer

► Decouple g-buffer from screen resolution

Page 152: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Special Thanks► Tobias Berghoff► Nicolas Serres► Tim Dann► Tomasz Stachowiak► Yasin Uludag► Keven Cantin► Mark Cerny► Johan Andersson► Christina Coffin► Chris Brennan► Timothy Lottes

► Rob Srinivasiah► Jason Scanlin► Dave Simpson► Bart Wronski► Martin Fuller► James Stanard► Ivan Nevraev► Colin Barré-Brisebois► Matthäus Chajdas► Frostbite Rendering► Sucker Punch

Page 153: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

References► [1] Rendering ‘Rainbox Six | Siege’ – Jalal El Mansouri► [2] High Quality Temporal Supersampling – Brian Karis► [3] Taking Killzone Shadow Fall Image Quality Into The Next Generation – Michal Valient► [4] Radeon Southern Islands 3D/Compute Register Reference Guide – AMD► [5] MLAA on PS3 – Tobias Berghoff, Cedric Perthuis► [6] Hubel, D. H., and T. N. Wiesel. 1979. "Brain Mechanisms of Vision." Scientific American 241(3), pp. 150–162.► [7] EQAA Modes for AMD 6900 Series Graphics Cards – AMD► [8] Radeon Evergreen/Northern Islands Acceleration - AMD► [9] Temporal Antialiasing in Uncharted 4 – Naughty Dog► [10] The Filtered and Culled Visibility Buffer – Wolfgang Engel► [11] Real-Time Global Illumination and Reflections in Dust 514 – Hugh Malan► [12] Anti-Aliasing Methods in CryENGINE 3 – Tiago Sousa► [13] Dynamic Resolution Rendering – Doug Binks► [14] Subpixel Reconstruction Antialiasing – NVIDIA► [15] "PlayStation®4 SDK / PS4™Pro High Resolution Technologies " - SIE (Tobias Berghoff, Tim Dann)► [16] "Implementing 4K Checkerboard - Lessons from 4K Knack and U4 Demos", Jason Scanlin - SIE WWS ICE, May 2016► [17] "Making the inFAMOUS 4K Demo", Tobias Berghoff - SIE WWS ATG, May 2016

Page 154: 4K Checkerboard in Battlefield 1 and Mass Effect Andromeda

Questions?

Graham [email protected] - @gwihlidal

Thank You!