09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker...

35
1 Prof. Dr.-Ing. Detlef Krömker *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing SS 2004 2 GDV 9. Aliasing und Antialiasing © Prof. Dr.-Ing. Detlef Krömker 5FNEOLFN Rasteralgorithmen: Alle bisher behandelten Algorithmen erzeugen Linien oder Objektkonturen mit Treppenstufen Wir haben schon eine einfache, durchaus wirksame (sehr pragmatische) Verbesserung kennen gelernt! Aber: Reicht das? Was ist das Optimum? (= höchste erreichbare Bildqualität) Wie erreichen wir dieses? Was kosten diese Maßnahmen? =XU%HDQWZRUWXQJGLHVHU)UDJHQPVVHQZLUDXIGLH7KHRULH ]XUFNJUHLIHQ$EWDVWXQJXQG5HNRQVWUXNWLRQ

Transcript of 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker...

Page 1: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

1

Prof. Dr.-Ing. Detlef Krömker

*RHWKH�8QLYHUVLWlW��)UDQNIXUW

*UDSKLVFKH�'DWHQYHUDUEHLWXQJ

������������ �������� �

Aliasing und Antialiasing

SS 20042GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

���������

Rasteralgorithmen:Alle bisher behandelten Algorithmen

erzeugen Linien oder Objektkonturen mit Treppenstufen

Wir haben schon eine einfache, durchaus wirksame (sehr pragmatische) Verbesserung kennen gelernt! Aber:

Reicht das?Was ist das Optimum? (= höchste

erreichbare Bildqualität)Wie erreichen wir dieses?Was kosten diese Maßnahmen?

�������������� ��������������������������� �������������������������������������� �������������

Page 2: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

2

SS 20043GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

��������

1. Zusammenstellung der Probleme2. Rückbesinnung auf die Theorie: Identifikation

möglicher Lösungsansätze3. Maßnahmen beim Rendering = Abtastung

1. Area Sampling2. Supersampling und Digitale Filterung3. Alpha-Channel und Compositioning4. A-Buffer5. Einige praktische Realisierungen beim

Realtime-Rendering4. Maßnahmen bei der Anzeige = Rekonstruktion

SS 20044GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

����������������� ��

7. Zusammenfassung 8. Glossar9. Weitere Informationen10.Ausblick – Nächste Schritte

Page 3: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

3

SS 20045GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������ � � �� �������� ��������� � � �� ��

Aliasing ist ein grundsätzliches Abtast- und Rekonstruktionsproblem

Je nach Primitiv sind die subjektiven Wirkungen verschieden … entsprechend auch die Lösungen

Wir müssen unterscheiden:� Linien� Polygone� Texturen� Text

SS 20046GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

!� �

� Vertikale und horizontale Linien sind schwärzer als 450 Linien

� Besonders starke Effekte:� Perlschnüre

� Noch sichtbare Treppen

an fast horizontalen/vertikalen Linien

Page 4: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

4

SS 20047GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

"������!� �

Nach dem Rendernskalierte Linien zeigen nochmals verstärkte Effekte:

� Unterbrechungen� anscheinend

andere Linienart:strichliertpunktiert

100% 20%

20%

SS 20048GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

#���!� �

� zeigen Scintilation(Aufblitzen)

Page 5: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

5

SS 20049GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

$��%��

Zeigen ähnliche Effekte wie Linien an den� Konturkanten� Schattenkanten� Rändern von Hightlights

(Glanzlichter)

überall, wo große Farb-(insbesondere Hellig-keits-) änderungenauftreten

ohne mit 4x4 mit 4x4Antialiasing Subpixel Subpixel

Grid Checkerboard

SS 200410GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

&�� $��%��

zeigen ohne Antialiasing„bösartige“ Szintilationen

Page 6: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

6

SS 200411GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'� ����()#� �

Sehr bekanntes Beispiel:

Zeigt sehr schön, dass die Anti-alias-Maßnahme weit über die Konturgrenze hinaus greifen müssen, aber auch, dass Auflösung,Gamma, etc. zu berücksichtigen sind !

SS 200412GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

"������ �

Pixelreplikation

Anti-aliased Scaling

Page 7: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

7

SS 200413GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

*+��� ���,��� �

Point-Sampling (nearest neightbour)

Mipmapping

Summed Area Tables

Ein gutes Antaliasing ist extrem wichtig!

Verfahren behaneln wir später!

SS 200414GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�� �����������-� ��./���

Point Sampling:Es entstehenniederfrequenteSrukturen! Nicht wie erwünschtGrauwerte!

Page 8: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

8

SS 200415GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'������,������/��� ����,��� � 0.1�

SS 200416GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

2��������,,�/��� ����,��� � 0.3�

Page 9: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

9

SS 200417GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

"���� �

Ist in jedem Fall als spezielles Primitiv zu behandeln

„Normales“ Antaliasing liefert oft schlechte Ergebnisse, z.B. deutlich bei Flash

Aus Gründen der optimalen, möglichst kontraststarken Darstellung müssen signaltheoretische Erwägungen zurücktreten

� spezielle BildschirmschriftenHinting u.a.

SS 200418GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

��������

1. Zusammenstellung der Probleme2. Rückbesinnung auf die Theorie (siehe 2. Digitale Bild)

Identifikation der Problemklassen1. Maßnahmen beim Rendering = Abtastung

1. Area Sampling2. Supersampling und Digitale Filterung3. Alpha-Channel und Compositioning4. A-Buffer5. Einige praktische Realisierungen beim

Realtime-Rendering

2. Maßnahmen bei der Anzeige = Rekonstruktion

Page 10: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

10

SS 200419GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������� �-- ��� ��������

AbtastungRekonstruktion

kontinuierliche Bildfunktion

diskretes Bild

SS 200420GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

4���������� �

Jetzt sind wir in der Lage, die Abtastung formal zu fassen und zu beschreiben:

Gegeben:

kontinuierliche Bildfunktion

Diracfeld

� � � � � � � � ���

( , ) ( , )= − −=−∞

=−∞

∑∑ δ ∆ ∆

� � �( , ) 0 1 2 3 4 5 6 7 8 90

2

4

0

10

20

30

40

50

40-50

30-40

20-30

10-20

0-10

12

34

56

7

R1

R2

R3

R4

R5

0

0,1

0,2

0,3

0,4

0,5

0,6

0,7

0,8

0,9

1

Page 11: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

11

SS 200421GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�������

� � �( , )

s (x,y) Diracfeld

),( ���V

SS 200422GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

4���������� �

Wir definieren als abgetastetes Bild:

� � � � � � �

� � � � � � � � �

� � � � � � � � �

� � � � � ������ � � � � � � � � �

� �

� �

= ⋅

= ⋅ − −

= ⋅ − −

= = = =

=−∞

=−∞

∑∑

∑∑

( , ) ( , )

( , ) ( , )

( , ) ( , )

( , ) ( , ) ,

,

,

δ

δ

∆ ∆

∆ ∆

∆ ∆ ∆ ∆0

© D

etle

f K

röm

ker

Page 12: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

12

SS 200423GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

4���������� �

������������������ ������� ��������������� ��� �������������� ������� ����� ����������� �������� ����

� � � � � � �� = ⋅( , ) ( , )

� � � � � �

� � � � � �

6

N O

����� � � ��� �

( , ) ( , ) ( , )

( , ),

/ /

= ⊗

= − −= −∞

∑∑= =

∆ ∆ ∆ ∆

∆ ∆ ∆ ∆

4 2

2 2

ππ π

SS 200424GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

5�� ���������� ������� ������� �

x

y

∆y

∆x

u

v

bubv

� � ( , )� � �( , )

� � V( , )

u

v

∆∆

��

= 2π

∆∆

= 2π

Page 13: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

13

SS 200425GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

5�� ���������� ������� ������� �6���� �����7

x

y

∆�

∆�

SS 200426GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

5�� ���������� ������� ��� ��������

x

y

∆�

∆�

f(x,y) kann durch einen idealen Tiefpaß mit

� � � ���� �

��� �� � �� ��� � �

( , ) ( , )=

< < − < < −

∆ ∆

∆ ∆

ξη

ξ η

rekonstruiert werden.

�X

∆�v

u

�Y

© D

etle

f K

röm

ker

Page 14: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

14

SS 200427GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

����������,�0�

Ein bandbegrenztes Bild f(x,y), das orthogonal mit Abtastintervallen abgetastet wird, kann fehlerfrei rekonstruiert werden, wenn die Abtastfrequenzen größer als die Nyquist-Frequenzen sind.

∆ ∆� �,

12

12

∆ ∆�� �

� �� � � = > = >,

mit � � �X Y

( , ) , ,ξ η ξ η= > >0

� �X Y,

VV�� ,

SS 200428GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

����������,�1�

Ein diskretes Bild lässt sich mit Hilfe eines (idealen) Tiefpasses mit der Übertragungsfunktion

rekonstruieren, so daß dieses mit dem ursprünglichen Signal identisch ist. Das rekonstruierte Bild ist dann

� � � � � � � � � � �

� � � � � � � �

� � � � � � �

7 3

X X Y Y

7 3

( , ) ( , )

( , ) s i n c ( ) s i n c ( )

=

< < − < < −=

∆ ∆

∆ ∆∆ ∆

ξ η

ξ ηξ η

� � �G

( , )

� � � � � � � �

��

��

��

��

�QP

( , ) ( , )sin( )

( )

sin( )

( )=

−=−∞

=−∞

∑∑ ∆ ∆ ∆

π

π

π

π

Page 15: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

15

SS 200429GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�� �-�� ���� -0�

�����

����

���

����

����

� ��

�( )

sin=

π 2π 3π 4π−π−2π

© D

etle

f K

röm

ker

SS 200430GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

1�-"� � - ��������� �������� � � ����

,283-4,712

-3,142-1,571

0,0001,571

3,1424,712

6,2837,854

0,000

1,571

3,142

4,712

6,283

7,854

9,425

0,9-1

0,8-0,9

0,7-0,8

0,6-0,7

0,5-0,6

0,4-0,5

0,3-0,4

0,2-0,3

0,1-0,2

0-0,1

-0,1-0

-0,2--0,1

-0,3--0,2

� � ��

��

�( , )

sin sin= ⋅

© D

etle

f K

röm

ker

Page 16: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

16

SS 200431GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

1�-"� � - ��������� �������� � � ����

-6,2

83

-4,7

12

-3,1

42

-1,5

71

0,00

0

1,57

1

3,14

2

4,71

2

6,28

3

7,85

4

9,42

5

10,9

96

12,5

66

0,000

1,571

3,142

4,712

6,283

7,854

9,425

-0,3

-0,2

-0,1

0

0,1

0,2

0,3

0,4

0,5

0,6

0,7

0,8

0,9

1

0,9-1

0,8-0,9

0,7-0,8

0,6-0,7

0,5-0,6

0,4-0,5

0,3-0,4

0,2-0,3

0,1-0,2

0-0,1

-0,1-0

-0,2--0,1

-0,3--0,2

� � ��

��

�( , )

sin sin= ⋅

© D

etle

f K

röm

ker

SS 200432GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

���������� �� ���� ��������

Die Forderungen des Abtasttheorems sind in realen Systemen nicht zu erfüllen. Im einzelnen:

� Bandbegrenzung: Reale Bildvorlagen sind nicht bandbegrenzt Aliasing (1.Art)

� ideale Abtastung (mit Diracimpuls): Reale Abtaster haben endliche Apertur Unschärfe

� ideale Rekonstruktion (mit sinc-Funktion): Real nur Approximationen möglich

Aliasing (2.Art)

Page 17: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

17

SS 200433GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

Ortsraum

Frequenz-raum

bu Bandgrenze

Nyquistfrequenz

us Abtast-frequenz

������ � 08���.5�� ���������� ��,0�

-1,25

-1

-0,75

-0,5

-0,25

0

0,25

0,5

0,75

1

1,25

0 15 30 45 60 75 90 105 120 135 150 165 180

© D

etle

f K

röm

ker

SS 200434GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������ � 08���.9 ��������� �

-1,5

-1

-0,5

0

0,5

1

1,5

0 15 30 45 60 75 90 105 120 135 150 165 180

Ortsraum

Frequenz-raum

bu Bandgrenze

Nyquistfrequenz

us Abtast-frequenz

© D

etle

f K

röm

ker

Page 18: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

18

SS 200435GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������ � 08���.5�� ���������� ��,0�

�����

��

�����

����

�����

����

���

����

����

Ortsraum

ALIASDoppelgänger

© D

etle

f K

röm

ker

SS 200436GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������ � 08����,1�

x

y

∆�

∆�

ALIASING

Page 19: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

19

SS 200437GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������ � 08���:9 ���������$����,��,�����

� Ursache: Unterabtastung, Überlappung der Spektren

� Die Konturkanten werden trivialerweise als Sprünge angesehen = „unendlich steil“ �unendliches Spektrum � Nyquistgrenze liegt im Unendlichen!

� Einmal in ein digitales Bild eingebrachte Artefakte sind durch nachträgliche Filterung nicht korrigierbar!

� Lösung geht nur über Bandbegrenzung:d.h. unser Bild wird weniger scharf!

SS 200438GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������ � 08����������������/�; ��, � �� �<��

Bandbegrenzung des abzutastenden Bildes durch z.B.

� optische Unschärfe (im Videobereich eingesetzt!)� einfach, adhoc einsetzbar

� wenig effektiv, weil Filterflanken nicht steil genug

� erfordert Abtastraten deutlich über Nyquistfrequenz

� deutlich sichtbare Unschärfe

� endliche Abtastapertur � hat Tiefpaßwirkung

� führt direkt zum sogenannten Area-Sampling

Page 20: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

20

SS 200439GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������� �,�� ������������

Apertur: kleines Fenster im Ortsbereich, innerhalb dessen ein Abtastwert durch gewichtete Summation beiträgt.

Beispiele aus der Technik:� CCD Chip: nahezu rechteckförmig� Röhre: Gausfunktion

bei Aufnahme von Realbildern (Kamera) schon aus energetischen Gründen unvermeidbar;Punktabtastung ist nicht realiiserbar!

SS 200440GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

/������� �� � ����� ������

endliche Apertur (= Integration über eine endliche Fläche) hat Tiefpaßwirkung� Röhre: Gaußfunktion relativ gut� CCD: Rechteck (FT sinc!) nicht harmlos!

Apertura(x,y) H(u,v)

f(x,y) f’’(x,y) fd(x,y)

s(x,y) (Diracfeld)

� � � � � � � � � �������

� � � � � �

’( , ) ( , ) ( , ) ( )

’( , ) ( , ) ( , )

= ⊗= ⋅

Page 21: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

21

SS 200441GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'�� ��� �����������=���� � "������=

� Idealer Tiefpaß wäre sinc-Funktion � minimaler Verlust von Schärfe

� Pixelbreite sei x, dann Nyquist Frequenz 1/2x� Sync-Funktion 1. Nullstelle in 1Pixel Abstand

also sollte die Region of Support 2 Pixel breit sein� Übliche Approximationen:

� Box (Rechteck)� Dreieck � Bartlett� Gauß kommen wir drauf zurück!

SS 200442GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

������ *�� � ��,���

1

∆[

−∆[2

∆[2

10.

1

∆[10.

10.

2∆[

1

∆[10.

2 0ξ[

∆[∆[

4 0ξ[

4 0ξ[

( )sinc 1

x0sinc 2

y0

ξξ

ξξ

sinc 1

x0sinc 2

y0

ξξ

ξξ

2

H

− +

2 2 2

12

22π σ ξ ξ

( )rect 1

x0rect 2

y0

ξξ

ξξ

1

2 2

2

2 2

π σσ

H

[

1

∆ ∆[

WUL

[

[

1

∆ ∆[

UHFW

[

[

1

∆ ∆[

[

[

sin c

Page 22: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

22

SS 200443GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

��������

1. Zusammenstellung der Probleme2. Rückbesinnung auf die Theorie: Identifikation

möglicher Lösungsansätze3. Maßnahmen beim Rendering = Abtastung

1. Area Sampling2. Supersampling und Digitale Filterung3. Alpha-Channel und Compositioning4. A-Buffer5. Einige praktische Realisierungen beim

Realtime-Rendering4. Maßnahmen bei der Anzeige = Rekonstruktion

SS 200444GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�� ��� � �.� ��� �>#���������� �>������� �

DigitalesBild

Digital-video

Graphik Animation

statischeModelle

dynamischeModelle

Reiz

Rendering

AbtastungBildbearbeitung

Page 23: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

23

SS 200445GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

/�; ��, ��,� ��� �

Idee: Area-Sampling (entspricht einer endliche Apertur)� unweighted (Rechteck, wie beim CCD-Chip)

Catmull [CATM 78]Flächenanteile am Pixel

werden beim Scannen errechnet:

Pixel ist weder rot noch grünBeispiel: 70% grün, 30% rot

� weighted (mit größerem Abstand vom idealen Sample Punkt wird der Einfluß geringer (nach welcher Funktion?)

Abram, Westover, Whitted [ABRA 85]

SS 200446GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

9 ������ ��� "�,��� �.$����,

Entspricht einemBoxfilter über der„Pixelfläche“

Page 24: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

24

SS 200447GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'����� ��� "�,��� ��� ������

Entspricht z.B. einem Dreiecksfilter über der„Pixelfläche“

SS 200448GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�-#� ���������,��$��� �?� �

� Pro: Geringerer Aufwand als Catmull

� Con: Kein Einfluß auf NachbarpixelBox-Filter (Rechteck) ist schlechter Tiefpaß

Page 25: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

25

SS 200449GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'����� ��� "�,��� � ����@����� ���A�#��B)C

Signaltheoretisch korrektHat jedoch sehr hohen

Aufwand!

Man verwendet i.d. Regel nur die diskrete Variante des Area-Sampling = Supersampling

A B C

D E F

G H I

SS 200450GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'����� ��� "�,��� � ����@�����

Page 26: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

26

SS 200451GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

"�����,��� ���������5���� ������ "�,��� ��

DigitalesBild

Graphik

n x m

n x m

pn x qm

Dig. Filter

TiefpaßStraight ForwardFull-Scene Antialiasing FSAA

SS 200452GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

"�����,��� � "��,���

In der Praxis sind verschiedene Schemata gebräuchlich!Man sucht möglichst wirksame, dabei aufwandsarme Möglichkeiten, z.B.Quincunx: nur 2 Samples/ Pixel! Ecken werden auch von Nachbarn genutzt!RGSS Rotated Grid Supersampling, usw.

Page 27: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

27

SS 200453GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

#����� �����������

In Realtime-Anwendungen meist unweightedSubpixel: tragen gleichermaßen bei (Ausnahme Quincunx: Mitte 1/2, Ecke 1/8)

Signaltheoretisch besser:� Bartlett-Fenster: Dreieck� Gaus-Fenster� Hanning-Fenster: Cosinusquadrat� Kaiser-Bessel-Fenster, u.s.w.

SS 200454GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

#����� ���������

1 2 3 4 3 2 12 4 6 8 6 4 23 6 9 12 9 6 34 8 12 16 12 8 43 6 9 12 9 6 32 4 6 8 6 4 21 2 3 4 3 2 1

1 4 8 10 8 4 1 4 12 25 29 25 12 4 8 25 49 58 49 25 8

10 29 58 67 58 29 10 8 25 49 58 49 25 8 4 12 25 29 25 12 4 1 4 8 10 8 4 1

7x7 Bartlett Filter 7x7 Gauss Filter

1 2 3 2 12 4 6 4 23 6 9 6 32 4 6 4 21 2 3 2 1

5x5 Bartlett Filter 3x3 Bartlett Filter

1 2 12 4 21 2 1

Page 28: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

28

SS 200455GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'���/D�������� ��,���������

Tschebyscheff-Approximation:� füllt vorgegebenes Toleranzschema optimal

aus� konstante Welligkeit im Durchlaß- und

Sperrbereich� Achtung: die berechneten Koeffizienten

müssen genau genug realisiert werden� bei 8/9 Bit Wortlänge gehen Vorteile

gegenüber Kaiser-Bessel verloren

SS 200456GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

"�����,��� �$��� �?� �

� Con: Löst das Aliasing-Problem 1. Art nur unvollständig: ������ �� d.h. es gilt

� Artefakte sind durch nachträgliche Filterung nicht vollständig korrigierbar! aber

� Daumenregel: 4-faches Oversampling liefert zufriedenstellende Ergebnisse bei scharfen Konturen Texturen können noch Probleme bereiten

Page 29: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

29

SS 200457GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'���*�����

� “leichtes” Rauschen kann Effekte noch weiter reduzieren

� Realisierbar durch stochastische Sampling: z.B. nach einer Poisson Verteilung (entspricht in etwa der Anordnung unserer Zapfen)

� Achtung: nur subjektive Wirkung: lediglich (für den Menschen) weniger störend

� vorsichtig einsetzen!

SS 200458GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

#����������� ��������������� �����������������

� ���� Software-Rendering: Die Szene wird in „logischen“ Teilen in

mehreren Phasen (Render-läufen, ggf. verschiedenen Renderern) gerechnet, die dann zusammengefügt werden.

� Hardware-Rendering: die aufwendigen Operationen des Renderingwerden “offline” (im Modelling) oder verteilt auf mehrere Prozessoren ausgeführt:

� Mixed Reality: Integration von Realbild (Kamera) und synthetischem Bild

� richtig gemacht lassen sich Bildteile selektiv löschen und einschreiben, ggf. auch gemäß z-Wert (Tiefe) überlagern

� relativ einfache Operation nötig (s.u.)Unterstützung durch Hardware möglich

Page 30: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

30

SS 200459GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

4��-?�� �

Pixel ist weder rot noch grünBeispiel: 70% grün, 30% rotBeim Rendering wird Überdeckungsinformation(coverage) generiert: ���������

��� �������������������z.B. (0,1,0,0.7)

SS 200460GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�������� ��� #����

no overlap total overlap proportional overlap

α -Wert liefert keine geometrischen Angaben

Annahmen: (1) proportional overlap gilt immer!!!,(2) Gleichverteilung für Geometrie

dann gemeinsame Überdeckung = α Α α Β

30%50%

15,0=⋅*U�Q5RW

αα

Page 31: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

31

SS 200461GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

��<�� ��D; � �,D���������

�� � � �� � �

�� � � � �

�� � � � � �

w e d e r - n o c h ( 1 - α A ) ( 1 - α B ) 0

n u r A α A (1 - α B ) 0 ,A

n u r B α B ( 1 -α A ) 0 ,B

b e id e α A α B 0 ,A ,B

SS 200462GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

$�� ������������ ��,D�������� �0�

Es sei:Result. Farbe cComp und Coverage α Comp :

cComp = FA cA + FB cB

α Comp = FA α A + FB α B

FA, FB : Anteil des Pixels aus Bild A bzw. B

Quadrupel: Farben für die Fälle(weder A noch B, A, B, beide)

Page 32: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

32

SS 200463GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

$�� ������������ ��,D�������� �1�

cComp = FA cA + FB cB

α Comp = FA α A + FB α B

Quadrupel:

(weder A noch B, A, B, beide)

operation quadrup le diagram F A F B

clear (0, 0 , 0 , 0) 0 0

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

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

A over B (0, A , B , A ) 1 1-α A

B over A (0, A , B , B ) 1-α B 1

A in B (0, 0 , 0 , A ) α B 0

B in A (0 , 0 , 0 , B ) 0 α A

A held out by B (0, A , 0, 0 ) 1-α B 0

B held out by A (0 , 0 , B , 0) 0 1-α A

A atop B (0, 0 , B , A ) α B 1-α A

B atop B (0, A , 0, B ) 1-α B α A

A xor B (0, A , B , 0 ) 1-α B 1-α A

SS 200464GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'����� ���� �,D�������� ,���,α-?�� �

� darken� fade� opaque� fade (A,t) plus fade (B, 1-t)

Page 33: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

33

SS 200465GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

'������ ������� ���$����,

� Wie gewinnt man α-Wert, wenn die Ausgangsbilder dies nicht haben:

siehe Fiskin-Barsky [FISH 84]

SS 200466GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�-#� ���������,��

A

B

=

=

0 0 0 0 0 0 0 0

0 0 0 0 1 0 0 0

0 0 0 1 1 0 0 0

0 0 1 1 1 1 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

1 1 1 1 1 1 1 1

0 0 0 0 0 0 0 0

0 0 0 0 1 0 0 0

0 0 0 1 1 0 0 0

1 1 1 1 1 1 1 1

BetrachteterBereich

=

0 0 0 0 0 0 0 0

0 0 0 0 1 0 0 0

0 0 0 1 1 0 0 0

0 0 1 1 1 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 1 0 0 0

0 0 0 1 1 0 0 0

1 1 1 1 1 1 1 1

0 0 0 0 0 0 0 0

0 0 0 0 1 1 1 1

0 0 0 1 1 1 1 1

0 0 1 1 1 1 1 1

0 0 0 0 0 0 0 0

0 0 0 0 0 1 1 1

0 0 0 0 0 1 1 1

0 0 0 0 0 0 1 1

xor xor

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

=

Page 34: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

34

SS 200467GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

E���,, ���� �

� Supersampling (trotz der bekannten Nachteile) ist oft günstigste Alternative Auswahl geeigneter Filter nötig, ggf. Designvorgaben/Richtlinien ermitteln

� Compositing mit α-Channel ist geeignetes Update-Verfahren

� ggf. HW-Unterstützung realisieren

SS 200468GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

��������

1. Zusammenstellung der Probleme2. Rückbesinnung auf die Theorie: Identifikation

der Problemklassen3. Maßnahmen beim Rendering = Abtastung

1. Area Sampling2. Supersampling und Digitale Filterung3. Alpha-Channel und Compositioning4. A-Buffer5. Einige praktische Realisierungen beim

Realtime-Rendering4. Maßnahmen bei der Anzeige = Rekonstruktion

Page 35: 09 Aliasing und Antialiasing - gdv.informatik.uni-frankfurt.de · 1 Prof. Dr.-Ing. Detlef Krömker *RHWKH 8QLYHUVLWlW )UDQNIXUW *UDSKLVFKH'DWHQYHUDUEHLWXQJ Aliasing und Antialiasing

35

SS 200469GDV9. Aliasing und Antialiasing© Prof. Dr.-Ing. Detlef Krömker

�������

Antialiasing beim RenderingArea SamplingWeighted Area SamplingA-BufferSupersampling und FilterungFilterkerne und FilterdesignAlpha-Channel

Bildüberlagerung�������������������� � ���������