27

DX11 TECHNIQUES IN HK2207

Embed Size (px)

DESCRIPTION

DX11 TECHNIQUES IN HK2207. Takahiro Harada AMD. HK2207. Demo for Radeon HD 6970 Based in Hong Kong 2207. Not just a single technique Cinematic with practical effects Physics effects Bullet CPU-physics CS rigid body Procedural adaptive tessellation Lighting effects Deferred rendering - PowerPoint PPT Presentation

Citation preview

Page 1: DX11 TECHNIQUES IN HK2207
Page 2: DX11 TECHNIQUES IN HK2207

DX11 TECHNIQUES IN HK2207

Takahiro HaradaAMD

Page 3: DX11 TECHNIQUES IN HK2207

HK2207• Demo for Radeon HD 6970• Based in Hong Kong 2207

Not just a single technique Cinematic with practical effects

– Physics effects Bullet CPU-physics

CS rigid body

– Procedural adaptive tessellation

– Lighting effects Deferred rendering

Post effects

28th Feburary 2011 AMD‘s Favorite Effects

Page 4: DX11 TECHNIQUES IN HK2207

Live Connection

28th Feburary 2011 AMD‘s Favorite Effects

Page 5: DX11 TECHNIQUES IN HK2207

CS RIGID BODY SIMULATION

28th Feburary 2011 AMD‘s Favorite Effects

Page 6: DX11 TECHNIQUES IN HK2207

CS Rigid Body• For visual effect• Simulation using CS

– CS5.0 has full functionality to realize simulation

• Key Features of CS– Group shared memory

• Tree traversal• Narrowphase(NP)

– Atomics• Collision

– Random write

28th Feburary 2011 AMD‘s Favorite Effects

Page 7: DX11 TECHNIQUES IN HK2207

Particle Representation• Approximate shapes with particles• Arbitrary convex mesh input

– Scan conversion

• Integration– A thread, rigid body

• Collision– A thread, particle

• Collision with mesh– Conversion to particles– Collide against triangles

GPU Gems3, Real-time Rigid Body Simulation on GPUs28th Feburary 2011 AMD‘s Favorite Effects

Page 8: DX11 TECHNIQUES IN HK2207

• BVH used for broad phase collision detection– Contains static scene triangles– Node : 4 children, 4 volumes– Pack a few triangles in a leaf

• Traversal efficiency• Separate data to another buffer

Mesh Collision (BVH)

28th Feburary 2011 AMD‘s Favorite Effects

TriData

Page 9: DX11 TECHNIQUES IN HK2207

• Tree traversal– Traversal stack located in Thread Group Shared

Memory(TGSM)

• Traversal and Narrow phase(NP) are separated to keep high efficiency on the GPU– Less divergence– Reduce local resource usage

Mesh Collision (BVH)

28th Feburary 2011 AMD‘s Favorite Effects

Page 10: DX11 TECHNIQUES IN HK2207

Narrow Phase• Output from tree collision

– HitData, List of triangle indices per body– Sparse

• 1 body x 1 leaf collision == n particles x m tris– Cache relevant triangles in TGSM

• Reduce memory traffic

– Use 1 thread group(TG) for a body 00 11 22 33 44 55 66 77 88 99 1010

Body0 Body1 Body2 Body3 Body5

HitData

28th Feburary 2011 AMD‘s Favorite Effects

Body4

Page 11: DX11 TECHNIQUES IN HK2207

Narrow Phase: 1 Thread Group• 1 thread : 1 particle• Use 1 thread as a controller of the SIMD

– Read HitData -> LeafData– Share LeafData (TGSM)– All the threads are used to read 64 tris in parallel

• 64 collisions in parallel– AABB overlap test– 1 Triangle vs 64 particles collision

28th Feburary 2011 AMD‘s Favorite Effects

Void NP(){ Bring64ParticlesIntoGPRs(); if( LOCAL_IDX == 0 ) LoadAllCollisionInfo(); BARRIER; forAllLeaves(;;) { forAllTriangles(;;j+=TG_SIZE) { fillTriangle( ldsVtx, ldsAabb , LOCAL_IDX ); BARRIER; for(k<TG_SIZE;k++) { if( ovelaps(ldsAabb[k]) ) collide( pData, ldsVtx[k] ); } } }}

Page 12: DX11 TECHNIQUES IN HK2207

Inefficiencies• Hit data buffer is sparse

– We launch too many TGs– TG with 0 hit returns after mem access

• Controller sections– Only controller is working– 63 threads are idle

• Redundant overlap test(Particle-Tri)– Body-Tri test is enough

• Leaf is not completely filled– Several leaves are colliding– Can issue more memory requests

28th Feburary 2011 AMD‘s Favorite Effects

Page 13: DX11 TECHNIQUES IN HK2207

Introduce Prepass• Hit data buffer is sparse

– We launch too many TGs– TG with 0 hit returns after mem access

• Controller sections– Only controller is working– 63 threads are idle

• Redundant overlap test(Particle-Tri)– Body-Tri test is enough

• Leaf is not completely filled– Several leaves are colliding– Can issue more memory requests

• Use Append Buffer– A body/thread

• Use 64 threads to read– Less single thread work

• Do Body-Tri test

• Pack triangle Data– LeafA(4), LeafB(4) -> 8

Reduce local resource usageBetter HW occupancy28th Feburary 2011 AMD‘s Favorite Effects

Page 14: DX11 TECHNIQUES IN HK2207

Pre Narrow Phase• Use 1 thread for a body

– Read HitData -> LeafData -> Triangle

• Body-Triangle AABB test– 64 Particle-Triangle collisions– Store colliding triangle indices

• If any collide– Write to append buffer

• Write triangle index to contiguous mem

• Sorting by n hits improves divergence– Local sort

28th Feburary 2011 AMD‘s Favorite Effects

AppendAppend AppendAppend AppendAppend AppendAppend AppendAppend AppendAppend

Page 15: DX11 TECHNIQUES IN HK2207

Improved Narrow PhaseVoid NP(){ Bring64ParticlesIntoGPRs(); if( LOCAL_IDX == 0 ) LoadNumHits();

BARRIER;

for(i<ldsHitTriData.m_n;i+WG_SIZE) { fillTriangle( ldsVtx[LOCAL_IDX] , i+LOCAL_IDX );

BARRIER;

for(j<WG_SIZE;j++) { collide( pData, ldsVtx[j] ); } }}

28th Feburary 2011 AMD‘s Favorite Effects

Void NP(){ Bring64ParticlesIntoGPRs(); if( LOCAL_IDX == 0 ) LoadAllCollisionInfo(); BARRIER; forAllLeaves(;;) { forAllTriangles(;;j+=TG_SIZE) { fillTriangle( ldsVtx, ldsAabb , LOCAL_IDX ); BARRIER; for(k<TG_SIZE;k++) { if( ovelaps(ldsAabb[k]) ) collide( pData, ldsVtx[k] ); } } }}

Page 16: DX11 TECHNIQUES IN HK2207

Result

28th Feburary 2011 AMD‘s Favorite Effects

Page 17: DX11 TECHNIQUES IN HK2207

28th Feburary 2011 AMD‘s Favorite Effects

Page 18: DX11 TECHNIQUES IN HK2207

MAKING IT LOOK PRETTY …

28th Feburary 2011 AMD‘s Favorite Effects

Page 19: DX11 TECHNIQUES IN HK2207

Procedural Adaptive Tessellation• Add surface detail using DX11 tessellation• Hull shader

– Calc tessellation factor using depth• Tessellator• Domain shader

– Interpolate vertex position, normal– Displacement factor using 3D Perlin noise

• Evaluate in local space– Displacement vector– Displace

• Pixel shader– Normal is gradient

28th Feburary 2011 AMD‘s Favorite Effects

Page 20: DX11 TECHNIQUES IN HK2207

Cracks• Different tessellation factor on edge

– Objects are small enough– Sample depth at the center

• Discontinuous displacement vector– Normal is not continuous– Use convexity of geometry– Interpolate normal and vector from center

28th Feburary 2011 AMD‘s Favorite Effects

Page 21: DX11 TECHNIQUES IN HK2207

Other Techniques Used• Deferred shading• Depth of field• Emissive materials• Lens ghosting and flare• Aerial perspective• Reflections• Tone mapping• LUT color correction

28th Feburary 2011 AMD‘s Favorite Effects

Page 22: DX11 TECHNIQUES IN HK2207

28th Feburary 2011 AMD‘s Favorite Effects

Page 23: DX11 TECHNIQUES IN HK2207

Color

28th Feburary 2011 AMD‘s Favorite Effects

Page 24: DX11 TECHNIQUES IN HK2207

Light

28th Feburary 2011 AMD‘s Favorite Effects

Page 25: DX11 TECHNIQUES IN HK2207

Emissive etc

28th Feburary 2011 AMD‘s Favorite Effects

Page 26: DX11 TECHNIQUES IN HK2207

DOF

28th Feburary 2011 AMD‘s Favorite Effects

Page 27: DX11 TECHNIQUES IN HK2207

End• Questions?

• Acknowledgement– Jay McKee, Jason Yang, Justin Hensley, Lee Howes, Ali Saif,

David Hoff, Abe Wiley, Dan Roeger

28th Feburary 2011 AMD‘s Favorite Effects