Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red...

142
Marilena Maule João Comba Rafael Torchelsen Rui Bastos August 22, Ouro Preto, Brazil UFRGS UFRGS UFFS NVIDIA 1

Transcript of Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red...

Page 1: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Marilena Maule

João Comba

Rafael Torchelsen

Rui Bastos

August 22, Ouro Preto, Brazil

UFRGS

UFRGS

UFFS

NVIDIA

1

Page 2: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Introduction

→Transparency effects and applications

→Anti-Aliasing impact in the final image

→Why combine Transparency with Anti-Aliasing?

http://www.freeforpsp.com/free-wallpaper/3d/200906/6418.html2

Page 3: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency

→Understanding and solving Transparency

→High-quality and high-performance Transparency Techniques

http://hdwindowswallpaper.com/3d-transparent-plane.html3

Page 4: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Anti-Aliasing

→Understanding and solving the Aliasing problem

→High-quality and high-performanceAnti-Aliasing Techniques

http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/“Sir! We have incoming aliasing!” “Stay smooth Green5”4

Page 5: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Applications

→How to combine Transparency and Anti-Aliasing

→Applications for Transparency with Anti-Aliasing

→Conclusions

→Future Work

http://wallpaperstock.net/car-mechanics-wallpapers_w11816.html5

Page 6: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Introduction

→Transparency Problem and Basic Approach→Raster-based Transparency Techniques

→AA Problem and Basic Approaches→AA Techniques

→Applications→Conclusions

6

Page 7: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Stochastic Transparency, NVIDIA20107

Effects

Page 8: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

http://www.wallpaper-photo.ru/en/preview.php?hd=152178

Particles

Page 9: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

K-Buffer, 20079

Translucency

Page 10: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

10

CAD

Page 11: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Jimenez, Siggraph Course 201111

Aliased Anti-Aliased

Page 12: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

http://thesavingthrow.blogspot.com.br/2011/05/ati-vs-nvidia-who-is-belle-of-ball.html12

Aliased 4xMSAA

Page 13: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

http://blogs.amd.com/play/2011/03/28/morphological-anti-aliasing-is-a-smooth-operator/13

Aliased MLAA

Page 14: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

http://www.humus.name/index.php?page=3D14

Aliased GBAA

Page 15: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Both refer to visibility computation

– Fragment coverage over pixel area

– Fragment visibility along depth

• Could both be combined into a single visibility representation?

15

Page 16: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Introduction

→Transparency Problem and Basic Approach→Raster-based Transparency Techniques

→AA Problem and Basic Approaches→AA Techniques

→Applications→Conclusions

16

Page 17: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency Problem and Basic Approach

→Transparency Fundaments

→Transparency in Practice

→Primitive Sorting

→Raster-based Transparency Techniques

→Buffer-Based

→Depth Peeling

→Sort Independent

→Stochastic

17

Page 18: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• How do we perceive transparency?

18

Page 19: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• How we render transparency• How much light from the fragment

arrives in the eye?

19

Page 20: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• The Color Channels:

– R: red contribution

– G: green contribution

– B: blue contribution

– α: encodes opacity

• Alpha channel - Introduced by Alvy Ray Smith (1970s)

• Alpha compositing developed by Porter and Duff (1984)

20

Page 21: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Opacity: α

– how much light the surface blocks?

• Transparency: 1 - α

– how much light the surface transmits?

– complement of α

21

Light beam

100%40%

Page 22: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Surface

• Visibility as a function of surfaces opacities:

– how much of the transmitted light the eye can see?

22 LightColorFromS = Srgb · 1.0

Light beam

S

VisibilityS()

100%

Page 23: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Surface

• Visibility as a function of surfaces opacities:

– how much of the transmitted light the eye can see?

23

Light beam

S

B1

VisibilityS(B1)

40%LightColorFromS = Srgb · 0.4

Page 24: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Surface

• Visibility as a function of surfaces opacities:

– how much of the transmitted light the eye can see?

24

Light beam

S

B1

LightColorFromS = Srgb · 0.32

B2

VisibilityS(B1, B2)

32%

Page 25: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Surface

• Visibility as a function of surfaces opacities:

– how much of the transmitted light the eye can see?

25

Light beam

S

B1

LightColorFromS = Srgb · 0.0

VisibilityS(B1, B2, B3)

0%

B2

B3

Page 26: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• How we render transparency• How much light from the fragment

arrives in the eye?

Visibility 100%

Visibility 50%

Visibility 25%

26

Page 27: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Blending equations [Porter and Duff, 1984]

– Back-to-Front

– A new fragment reduces visibility from the accumulated color

27

𝑪′𝒂𝒄𝒄 Accumulated color

𝐶𝑖 Color from fragment i

𝛼𝑎𝑐𝑐 Accumulated opacity

𝛼𝑖 Opacity from fragment i

Page 28: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Blending equations [Porter and Duff, 1984]

– Front-to-Back

– A new fragments has its visibility reduced by the accumulated opacity

28

𝑪′𝒂𝒄𝒄 Accumulated color

𝐶𝑖 Color from fragment i

𝛼𝑎𝑐𝑐 Accumulated opacity

𝛼𝑖 Opacity from fragment i

Page 29: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Back-to-front blending

29𝐶′

𝑎𝑐𝑐 = 1 − 𝛼𝑖 𝐶𝑎𝑐𝑐 + 𝛼𝑖𝐶𝑖

Page 30: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Back-to-front blending

30𝐶′

𝑎𝑐𝑐 = 1 − 𝛼𝑖 𝐶𝑎𝑐𝑐 + 𝛼𝑖𝐶𝑖

(0.5, 0, 0, 0.5) = 1 − 0.5 (0,0,0,0) + 0.5𝑅𝑒𝑑

Page 31: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Back-to-front blending

31𝐶′

𝑎𝑐𝑐 = 1 − 𝛼𝑖 𝐶𝑎𝑐𝑐 + 𝛼𝑖𝐶𝑖

(0.25,0, 0.5, 0.75) = 1 − 0.5 (0.5, 0, 0, 0.5) + 0.5𝐵𝑙𝑢𝑒

Page 32: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Back-to-front blending

32𝐶′

𝑎𝑐𝑐 = 1 − 𝛼𝑖 𝐶𝑎𝑐𝑐 + 𝛼𝑖𝐶𝑖

(0.125,0.5, 0.25, 0.875) = 1 − 0.5 (0.25,0, 0.5, 0.75) + 0.5𝐺𝑟𝑒𝑒𝑛

Page 33: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

33

• Front-to-back blending

Page 34: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Front-to-back blending

34

(0,0.5,0,0.5) = (0,0,0,0) + 1 − 0 0.5𝐺𝑟𝑒𝑒𝑛

Page 35: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Front-to-back blending

35

(0,0.5,0.25,0.75) = (0,0.5,0,0.5) + 1 − 0.5 0.5𝐵𝑙𝑢𝑒

Page 36: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Front-to-back blending

36

(0.175,0.5,0.25,0.875) = (0,0.5,0.25,0.75) + 1 − 0.75 0.5𝑅𝑒𝑑

Page 37: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Front-to-back blending

• Out-of-order fragments

– Wrong visibility computation

37

(0.5,0,0,0.5) = (0,0,0,0) + 1 − 0 0.5𝑅𝑒𝑑

1st fragment:Red

Goal

Page 38: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Front-to-back blending

• Out-of-order fragments

– Wrong visibility computation

38

(0.5,0.25,0,0.75) = (0.5,0,0,0.5) + 1 − 0.5 0.5𝐺𝑟𝑒𝑒𝑛

2nd fragment:Green

Goal

Page 39: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Front-to-back blending

• Out-of-order fragments

– Wrong visibility computation

39

(0.5,0.25,0.175,0.875) = (0.5,0.25,0,0.75) + 1 − 0.75 0.5𝐵𝑙𝑢𝑒

3rd fragment:Blue

Goal

Page 40: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Summary

– Back-to-Front

– Front-to-Back

– Out-of-Order

• FTB blending

• BTF blending

40

+ + =++

++

++

=

=

=

Page 41: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency Problem and Basic Approach

→Transparency Fundaments

→Transparency in Practice

→Primitive Sorting

→Raster-based Transparency Techniques

→Buffer-Based

→Depth Peeling

→Sort Independent

→Stochastic

41

Page 42: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Depth Test Enabled

– Incorrect fragment discard

42

Page 43: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Depth Test Disabled

• Out-Of-Order rendering

– Incorrect visibility results

43

Page 44: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Depth Test Disabled

• Depth-Sorted-Order rendering– Primitive sorting

• Assuming no interpenetration

– Correct visibility results

44

Page 45: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

Primitive Sorting Fragment Sorting

X

45

All fragments have the same depth-sorted order from their

primitive.

The fragments are depth-sorted individually.

Page 46: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency Problem and Basic Approach

→Transparency Fundaments

→Transparency in Practice

→Primitive Sorting

→Raster-based Transparency Techniques

→Buffer-Based

→Depth Peeling

→Sort Independent

→Stochastic

46

Page 47: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Interpenetration Issue

47

Page 48: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

48

• Interpenetration Issue

Goal

Result

Page 49: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

49

• Interpenetration Issue

Goal

Results

Page 50: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Interpenetration

• Spatial data structures

– BSP

– Kd-Tree

– Octree

– . . .

3 triangles...50

Page 51: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Interpenetration

• Spatial data structures

– BSP

– Kd-Tree

– Octree

– . . .

– Split primitives

– Rebuild for animations

n times more triangles!51

Page 52: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency Problem and Basic Approach

→Transparency Fundaments

→Transparency in Practice

→Primitive Sorting

→Raster-based Transparency Techniques

→Buffer-Based

→Depth Peeling

→Sort Independent

→Stochastic

52

Page 53: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

1. Store fragments

53

Color Buffer

Renderorder

Page 54: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

1. Store fragments

2. Sort fragments

54

Page 55: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

1. Store fragments

2. Sort fragments

3. Blend fragments

Back-to-Front𝐶′

𝑎𝑐𝑐 = 1 − 𝛼𝑓𝑟𝑎𝑔 𝐶𝑎𝑐𝑐 + 𝛼𝑓𝑟𝑎𝑔𝐶𝑓𝑟𝑎𝑔

55

Page 56: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

1. Store fragments

2. Sort fragments

3. Blend fragments

Front-to-Back𝐶′

𝑎𝑐𝑐 = 𝐶𝑎𝑐𝑐 + (1 − 𝛼𝑎𝑐𝑐)𝐶𝑓𝑟𝑎𝑔𝛼𝑓𝑟𝑎𝑔

56

Page 57: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store all fragments

57 Carpenter, 1984

Page 58: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store all fragments

→ PPLLGPU Linked ListsEmulation

58 “Real-Time Concurrent Linked List Construction on the GPU”, Yang et al, 2010

Page 59: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store all fragments

→ PPLLGPU Linked ListsEmulation

→ DFBGPU DynamicVectors

59 “Dynamic Fragment Buffer”, Maule et al, 2012

Page 60: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→ 3D buffersStores all attributes

Correct order

→ Z3

→ k-buffer60 “Z3: an economical hardware technique for high-quality antialiasing and transparency”, Jouppi, 1999

“Multi-fragment effects on the GPU using the kbuffer”, Bavoil et al, 2007

Page 61: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→ 3D buffersStores all attributes

→ Adaptive TransparencyStores only depth and visibility values

Correct order

→ Z3

→ k-buffer61 “Adaptive transparency”, Salvi et al, 2011

Page 62: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store all fragments

– Precise compositing of fragments

– Unbounded amounts of memory

• Fixed storage

– Faster but approximate

• Not all fragments considered in each pixel

• Approximate visibility contributions

62

Page 63: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency Problem and Basic Approach

→Transparency Fundaments

→Transparency in Practice

→Primitive Sorting

→Raster-based Transparency Techniques

→Buffer-Based

→Depth Peeling

→Sort Independent

→Stochastic

63

Page 64: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store the farthest unblended layer

– 1st geometry pass

64

Page 65: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store the farthest unblended layer

– 1st geometry pass

65

Page 66: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store the farthest unblended layer

– 1st geometry pass

66

Page 67: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Store the farthest unblended layer

– Blend with the opaque layer

End of geometry pass

Modified DP, nVidia 2001

67

Page 68: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– 2nd geometry pass

68

Page 69: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– 2nd geometry pass

69

Page 70: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– 2nd geometry pass

70

Page 71: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– Blend with the opaque layer

End of geometry pass

Modified DP, nVidia 2001

71

Page 72: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– 3rd geometry pass

72

Page 73: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– 3rd geometry pass

73

Page 74: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– 3rd geometry pass

74

Page 75: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose layers over several geometry steps

– Blend with the opaque layer

End of geometry pass

Modified DP, nVidia 2001

Modified DP, nVidia 200175

Page 76: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Compose two layers per geometry step

– Front-most and back-most

76

Page 77: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Fixed and small amount of memory

• Slow geometry multipass

77

Page 78: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency Problem and Basic Approach

→Transparency Fundaments

→Transparency in Practice

→Primitive Sorting

→Raster-based Transparency Techniques

→Buffer-Based

→Depth Peeling

→Sort Independent

→Stochastic

78

Page 79: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• 2 Geometry passes

• Alpha accumulation

• Good approximation for low alpha

• Inaccurate for high alpha

79

Page 80: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

SortedWeighted Average

Weighted Sums

• 2 Geometry passes

• Alpha accumulation

• Good approximation for low alpha

• Inaccurate for high alpha

BM08, Meshkin0780

Page 81: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• 2 Geometry passes

• Alpha accumulation

• Good approximation for low alpha

• Inaccurate for high alpha

Sorted – 50%

Weighted Sums – 50%

SortedWeighted Average

Weighted Sums

BM08, Meshkin0781

Page 82: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Transparency Problem and Basic Approach

→Transparency Fundaments

→Transparency in Practice

→Primitive Sorting

→Raster-based Transparency Techniques

→Buffer-Based

→Depth Peeling

→Sort Independent

→Stochastic

82

Page 83: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Super resolution screen-door transparency

– Alpha and visibility translate to sample individual probability of coverage

83

Page 84: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

6

16

84

Color

Page 85: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

6

16

9

16

85

Color

Page 86: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

6

16

9

16

5

16

86

Color

Page 87: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

87

Color

Page 88: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• MSAA samples to represent visibility

– Pre-passes to estimate visibility

• Small number of samples per pixel leads to noise

Stochastic Transparency, nVidia 2010

8 samples 32 samples

Depth PeelingStochasticStochastic

88

Page 89: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

PPLL

Beyond Programming Shading, SIGGRAPH 2010 Stochastic

Adaptive

89

Page 90: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Introduction

→Transparency Problem and Basic Approach→Raster-based Transparency Techniques

→AA Problem and Basic Approaches→AA Techniques

→Applications→Conclusions

90

Page 91: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→AA Problem and Basic Approaches

→The Aliasing Problem

→Single Sample Problem

→Super Sampling

→Sample Distribution

→AA Techniques

→FSAA

→IAA

→GBAA

91

Page 92: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• I want to draw a shape...

92

Page 93: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• But what appears doesn’t look like my shape!

93

Page 94: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

+

• Why doesn’t it look like my shape?

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

94

+

Page 95: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Thin primitives

95

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

+ + + + + + + + + +

Thin primitive Single sample per pixel result

Single sample per pixel

Page 96: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Single-Sample Problem: Temporal Aliasing

96

0%

100%

Page 97: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• If only I could estimate the pixel coverage...

97

Aliasing on edges

Aliasing on thin primitives Temporal anti-aliasing

original aliased anti-aliased

original aliased

anti-aliased

50%

50%

Page 98: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→AA Problem and Basic Approaches

→The Aliasing Problem

→Single Sample Problem

→Super Sampling

→Sample Distribution

→AA Techniques

→FSAA

→IAA

→GBAA

98

Page 99: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into a normal resolution

99

Page 100: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into a normal resolution

– Center sampling

100

Page 101: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into a normal resolution

– Center sampling

– Aliased result

101

Page 102: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→AA Problem and Basic Approaches

→The Aliasing Problem

→Single Sample Problem

→Super Sampling

→Sample Distribution

→AA Techniques

→FSAA

→IAA

→GBAA

102

Page 103: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into 4x-higher resolution

103

Page 104: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into 4x-higher resolution

– Center sampling

104

Page 105: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into 4x-higher resolution

– Center sampling high-resolution result

105

Page 106: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into 4x-higher resolution

– 2x2 box filter

+ + + + + + + + + + + +

+ + + + + + + + + + + +

+ + + + + + + + + + + +

+ + + + + + + + + + + +

106

Page 107: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Rendering into 4x-higher resolution

– 2x2 box filter

– Down-filtered result

107

Page 108: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

108

Ce

nte

r sa

mp

le4

x su

pe

r sa

mp

ling

Page 109: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Thin Primitives

109

Center sampling

4x super sampling

Rasterization process Result in the display

Page 110: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Temporal Aliasing

110

Center sampling 4x super sampling

+

+

+ +

+ ++ +

+ +Frame

i

Frame i+1

0%

100%

50%

50%

Page 111: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→AA Problem and Basic Approaches

→The Aliasing Problem

→Single Sample Problem

→Super Sampling

→Sample Distribution

→AA Techniques

→FSAA

→IAA

→GBAA

111

Page 112: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Critical Angle

112

Critical angle:

Nearly horizontal and nearly vertical edges

Critical angle rotated:

Less disturbing

Page 113: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Regularity

JitteredGood and cheap

+

PoissonGood and costly

+

RandomCheap but arbitrary

+

113

Good = pixel area well covered by samplesArbitrary = pixel coverage by samples may be good may be notCheap= low computational costCostly = high computational cost

Page 114: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→AA Problem and Basic Approaches

→The Aliasing Problem

→Single Sample Problem

→Super Sampling

→Sample Distribution

→AA Techniques

→FSAA

→IAA

→GBAA

114

Page 115: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Input: 3D scene

– No selection

• Entire scene is processed

– More than one sample per pixel

• Buffers

• Filtering

• Downsampling

• Output: anti-aliased image

115

Page 116: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Per-sample color evaluation

116

All attributes are computed individually per sample

SSAA

Page 117: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Single color evaluation

– Once per pixel

117

Color replicated to the samples.Depth is computed individually per sample

Shaded color computed at the pixel center

MSAA

Page 118: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Also EQAA

• Single color evaluation

• Coverage-only and regular samples

118

Shaded color computed at the pixel center

Color replicated to the samples.Depth is computed individually per sample

Boolean samples encoding coverage.No attribute stored

CSAA

Page 119: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Single color evaluation

119

Shaded color computed at the pixel center

Color replicated to the samples.Depth is computed individually per sample

Isolines approximation

DAEAA

Page 120: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Single color evaluation

• Samples reconstruction

120

Shaded color computed at the pixel center

Color replicated to the samples

Deferred Shading geometric samples

SRAA

Page 121: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Single color evaluation

• Boolean coverage mask

• Max and min depth values

121

Shaded color computed at the pixel center

Boolean samples encoding coverageNo attribute stored

Page 122: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

122

+++

++

+

+ + +

SSAA MSAA

CSAA DAEAA

A-Buffer

SRAA

Page 123: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Pros

– High image quality

– Temporal stability

– Subpixel anti-aliasing

• Cons

– High memory consumption

123

Page 124: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→AA Problem and Basic Approaches

→The Aliasing Problem

→Single Sample Problem

→Super Sampling

→Sample Distribution

→AA Techniques

→FSAA

→IAA

→GBAA

124

Page 125: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Input: digital image

– Search for aliased pixels

– Selection of aliased pixels

– Intelligent blur of aliased pixels

• Output: anti-aliased image

125

Page 126: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Search for aliased patterns

– Create list of found patterns

• Rebuild approximated geometry

• Blur

126

Page 127: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Parallel MLAA– MLAA in real time using GPU filtering

127

Search for edge distances with filtering

Identify crossing edges with filtering

Page 128: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Search for aliased pixels

– Local luma contrast

• 4-neighbors

• Directional blur filter

– Perpendicular to luma gradient

128

Edge detection

Orientation

Higher contrast

End of edge search

Position shift 90⁰

FXAA white paper 2009

Page 129: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Photoshop prototype

– Filtering sequence

129

Vertical blur

Vertical high-pass

Threshold mask

+

Page 130: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Pros

– Very fast

– Low resource consumption

• Cons

– Does not adequately handle subpixels

– Temporal instability

130

Page 131: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→AA Problem and Basic Approaches

→The Aliasing Problem

→Single Sample Problem

→Super Sampling

→Sample Distribution

→AA Techniques

→FSAA

→IAA

→GBAA

131

Page 132: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Input: 3D scene

– Extra information to edge pixels

– Post-processing blur

• Output: anti-aliased image

132

Page 133: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Pixel distance to triangle edge

– Distance approximated by color

• Each vertex receives one channel setup

– Interpolation

• Distance-guided blur

– Only if smaller than one pixel

133

Page 134: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Pixel distance to triangle edge

– Computed analytically

• Encoded into RGB texture

• Major direction

• Distance-guided blur

– Only if less than half pixel

134

Page 135: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Pros

– Image quality

– Temporal stability

• Cons

– Does not resolve thin primitives

135

Page 136: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Introduction

→Transparency Problem and Basic Approach→Raster-based Transparency Techniques

→AA Problem and Basic Approaches→AA Techniques

→FSAA →Image Post-Processing →Geometric AA

→Applications→Conclusions

136

Page 137: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Coverage is used to weight alpha

– Order-dependent

– Less memory

137

MSAA AA-OIT

(0,1,0,1) (0,1,0,1)

(0,0,0,1)(0,1,0,0.5)

(0,0,0,1)

Page 138: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• Multisampled texture used to store fragments

– Post-processed sorting and blending

– Uniform alpha

• Channel alpha used to store depth

138

MSAA

(1,0,0, z )

Page 139: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• FSAA

– High quality

– High memory consumption

• GAA

– High quality

– Geometric borders only

• IAA

– Low quality

– Low memory consumption139

Page 140: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

→Introduction

→Transparency Problem and Basic Approach

→Raster-based Transparency Techniques

→AA Problem and Basic Approaches

→AA Techniques

→Applications

→Conclusions140

Page 141: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• OIT and AA are still open problems

– Combining them is challenging

– Combining them with Deferred Shading is even more challenging

• There is no default solution

– Application dependent

• Quality x Performance x Memory

141

Page 142: Marilena Maule UFRGS Rafael Torchelsen · arrives in the eye? 19 •The Color Channels: –R: red contribution –G: green contribution –B: blue contribution –α: encodes opacity

• OIT and AA with Deferred Shading

• Deferred Shading– G-buffers

– Shading as a post-processing stage

• +OIT– Overburden G-buffers

• +AA– Overburden G-buffers

– Decoupling of sample from fragment• MSAA impractical

142