58
THE DEVIL IS IN THE DETAILS

Siggraph2016 - The Devil is in the Details: idTech 666

Embed Size (px)

Citation preview

Page 1: Siggraph2016 - The Devil is in the Details: idTech 666

THE DEVIL IS IN THE DETAILS

Page 2: Siggraph2016 - The Devil is in the Details: idTech 666

Initial Requirements

Page 3: Siggraph2016 - The Devil is in the Details: idTech 666

Anatomy of a Frame

Frame Cost

Page 4: Siggraph2016 - The Devil is in the Details: idTech 666

Data Structure for Lighting & Shading

Page 5: Siggraph2016 - The Devil is in the Details: idTech 666

Preparing Clustered Structure

𝑍𝑆𝑙𝑖𝑐𝑒 = 𝑁𝑒𝑎𝑟𝑧 × ( 𝐹𝑎𝑟𝑧

𝑁𝑒𝑎𝑟𝑧)

𝑠𝑙𝑖𝑐𝑒

𝑛𝑢𝑚 𝑠𝑙𝑖𝑐𝑒𝑠

Page 6: Siggraph2016 - The Devil is in the Details: idTech 666

Preparing Clustered Structure

//Pseudo-code - 1 job per depth slice ( if any item )

for ( y = MinY; y < MaxY; ++y ) {

for ( x = MinX; x < MaxX; ++x ) {

intersects = N planes vs cell AABB

if ( intersects ) {

Register item

}

}

}

Page 7: Siggraph2016 - The Devil is in the Details: idTech 666

Preparing Clustered Structure

Page 8: Siggraph2016 - The Devil is in the Details: idTech 666

Preparing Clustered Structure

Page 9: Siggraph2016 - The Devil is in the Details: idTech 666

Preparing Clustered Structure

Page 10: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 11: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 12: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

𝑒0 𝑒1

const float4 albedo = tex2Dgrad( decalsAtlas, uv.xy * scaleBias.xy + scaleBias.zw, uvDDX, uvDDY );

𝑒

𝑒 𝑒𝑒0𝑥

𝑒1𝑥 2𝑥 𝑥

𝑒0𝑦𝑒1𝑦 2𝑦 𝑦

𝑒0𝑧𝑒1𝑧 2𝑧 𝑧

0 0 0 1

0.5

𝑠𝑖𝑧𝑒𝑋0 0 0.5

00.5

𝑠𝑖𝑧𝑒𝑌0 0.5

0 00.5

𝑠𝑖𝑧𝑒𝑍0.5

0 0 0 1

Page 13: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 14: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 15: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 16: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 17: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 18: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 19: Siggraph2016 - The Devil is in the Details: idTech 666

Detailing the World

Page 20: Siggraph2016 - The Devil is in the Details: idTech 666

Lighting

Page 21: Siggraph2016 - The Devil is in the Details: idTech 666

Lighting

//Pseudocode

ComputeLighting( inputs, outputs ) {

Read & Pack base textures

for each decal in cell {

early out fragment check

Read textures

Blend results

}

for each light in cell {

early out fragment check

Compute BRDF / Apply Shadows

Accumulate lighting

}

}

Page 22: Siggraph2016 - The Devil is in the Details: idTech 666

Lighting

Page 23: Siggraph2016 - The Devil is in the Details: idTech 666

Lighting

Page 24: Siggraph2016 - The Devil is in the Details: idTech 666

Lighting

Page 25: Siggraph2016 - The Devil is in the Details: idTech 666

Lighting

Page 26: Siggraph2016 - The Devil is in the Details: idTech 666

Transparents

Page 27: Siggraph2016 - The Devil is in the Details: idTech 666

Particle Lighting

Page 28: Siggraph2016 - The Devil is in the Details: idTech 666

Decoupled Particle Lighting

Page 29: Siggraph2016 - The Devil is in the Details: idTech 666

Decoupled Particle Lighting

//Pseudocode – Particle shading becomes something like this

Particles( inputs, outputs ) {

const float3 lighting = tex2D( particleAtlas, inputs.texcoord );

result = lighting * inputs.albedo;

}

Page 30: Siggraph2016 - The Devil is in the Details: idTech 666

Decoupled Particle Lighting

Particle Light Atlas

Page 31: Siggraph2016 - The Devil is in the Details: idTech 666

Decoupled Particle Lighting

Page 32: Siggraph2016 - The Devil is in the Details: idTech 666

Post-Process

Page 33: Siggraph2016 - The Devil is in the Details: idTech 666

Optimizing Data Fetching ( GCN )

Page 34: Siggraph2016 - The Devil is in the Details: idTech 666

Clustered Lighting Access Patterns

Page 35: Siggraph2016 - The Devil is in the Details: idTech 666

Clustered Lighting Access Patterns

Page 36: Siggraph2016 - The Devil is in the Details: idTech 666

Clustered Lighting Access Patterns

Page 37: Siggraph2016 - The Devil is in the Details: idTech 666

Clustered Lighting Access Patterns

Page 38: Siggraph2016 - The Devil is in the Details: idTech 666

Analyzing the Data

Page 39: Siggraph2016 - The Devil is in the Details: idTech 666

Leveraging Access Patterns

Thread X A B D

Thread Y B C E

Thread Z A C D E

Scalar A B C D E

Page 40: Siggraph2016 - The Devil is in the Details: idTech 666

Special Paths

Page 41: Siggraph2016 - The Devil is in the Details: idTech 666

Dynamic Resolution Scaling

Page 42: Siggraph2016 - The Devil is in the Details: idTech 666

Async Post Processing

Page 43: Siggraph2016 - The Devil is in the Details: idTech 666

GCN Wave Limits Tuning

Page 44: Siggraph2016 - The Devil is in the Details: idTech 666

GCN Register Usage

Page 45: Siggraph2016 - The Devil is in the Details: idTech 666
Page 46: Siggraph2016 - The Devil is in the Details: idTech 666
Page 47: Siggraph2016 - The Devil is in the Details: idTech 666
Page 48: Siggraph2016 - The Devil is in the Details: idTech 666
Page 49: Siggraph2016 - The Devil is in the Details: idTech 666
Page 50: Siggraph2016 - The Devil is in the Details: idTech 666
Page 51: Siggraph2016 - The Devil is in the Details: idTech 666

What’s next ?

Page 52: Siggraph2016 - The Devil is in the Details: idTech 666

Special Thanks

Page 53: Siggraph2016 - The Devil is in the Details: idTech 666

We are Hiring !

Page 54: Siggraph2016 - The Devil is in the Details: idTech 666

Thank you

Page 55: Siggraph2016 - The Devil is in the Details: idTech 666

References

Page 56: Siggraph2016 - The Devil is in the Details: idTech 666

Bonus Slides

Page 57: Siggraph2016 - The Devil is in the Details: idTech 666

Lighting

Page 58: Siggraph2016 - The Devil is in the Details: idTech 666

Deferred Passes