Grafika Komputerowa. Teksturowanie
Aleksander Denisiuk
Polsko-Japo ´nska Akademia Technik Komputerowych
Wydział Informatyki w Gda ´nsku
ul. Brzegi 55
80-045 Gda ´nsk
Teksturowanie
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
2 / 19
Najnowsza wersja tego dokumentu dost ˛epna jest pod adresem
Techniki teksturowania
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
Tekstura zawiera informacje o kolorach, które maj ˛
a zast ˛
api´c obliczone
kolory powierzchni.
Tekstura zawiera informacje o kolorach, blasku, przezroczysto´sci,
które maj ˛
a zmieni´c charakterystyki powierzchni po obliczniach
o´swietlenia i cieniowania.
Tekstura zawiera parametry, maj ˛
ace wpływ na obliczenie o´swietlenia
Tekstura
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
4 / 19
Zdj ˛ecie, obrazek skanowany, utworzony edytorem graficznym.
Obrazek zaprogramowany (skompilowany, generowany na bie˙z ˛
aco).
Obrazek generowany podaczas mapowania (odbicie).
Teksturowanie
Interpolacja tekstury
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
1.
Okre´sla si ˛e lokalne współrz˛edne tekstury w wierzchołkach wieloboku
2.
Interpoluje si ˛e wewn ˛
atrz
h0;0i h 3 4 ;0i h 3 4 ; 3 4 i h0;1i
Figure V.1: The square on the left is a texture map. The squareon the rightis lled with a quadrilateral region of this texture map. The oordinates labeling the orners of the square are s;t values indexing into the texture map. The subregion of the he kerboardtexture map sele ted by the s and t oordinates is shown in the left square. This subregionof the texture map was onverted to two triangles rst, and ea h triangle was mapped by linear interpolation into the orresponding triangle in the square on the right: this aused the visible diagonal boundary between the triangles.
Wybór lokalnych współrz ˛ednych dla tekstury
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
6 / 19
Płaszczyzna.
Sze´scian.
Powierzchnia parametryzowana
P (u, v).
Współrz˛edne na teksturze zale˙z ˛
a od
u
i
v
. (Mo˙ze by´c równie˙z od
Walec. Mapowanie cylindryczne
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
p(θ, y) = (r sin θ, y, r cos θ),
0 6 θ < 360, −h/2 6 y 6 h/2
s =
360
θ
,
t =
y+h/2
h
Walec
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
8 / 19
x y z w x y z wFigure V.4: The quadrilateral x, y, z, w sele ts a region of the texture map. The rosshat hed region of the texture map is not the intended region of the texture map. The shaded area is the intended region.
Sfera. Mapowanie sferyczne
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
P (θ, ϕ) = (r sin θ cos ϕ, r sin ϕ, r cos θ cos ϕ)
s =
θ
360
,
t =
ϕ
180
+
1
2
s =
θ
360
,
t =
sin
ϕ
2
+
1
2
Mapowanie sferyczne
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
10 / 19
Figure V.5: Two appli ations of a texture map to a sphere. The sphere on the left has a he kerboard texture applied with texture oordinates given by the spheri al map of equation (V.2). The sphere on the right uses texture oordinates given by the ylindri al proje tion of equation (V.3). The spheres are drawn with a tilt and a small rotation.
Przykładowa tekstura sferyczna
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
Torus
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
12 / 19
P (θ, ϕ) = (R + r cos ϕ) sin θ, r sin ϕ, (R + r cos ϕ) cos θ)
s =
θ
360
,
t =
ϕ
360
Aliasing
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
Rozdzielczo´s´c tekstury jest mniejsza od rozdzielczo´sci ekranu
Rozdzielczo´s´c tekstury jest wi ˛eksza od rozdzielczo´sci ekranu
Miganie, interferencja, plamy
Antialiasing
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
14 / 19
Interpolacja
Mipmapping
Zastosowanie skalowanych tekstur
Interpolacja najbli˙zszych tekstur
Zwi ˛ekszenie pr ˛edko´sci
Zwi ˛ekszenie pami ˛eci o 33%
Mipmapping
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
Supersampling (nadpróbkowanie)
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
16 / 19
Figure V.7: In the rst gure, the nine supersample points are pla ed at the enters of the nine subpixels. In the se ond gure, the supersample points are jittered, but are onstrained to stay inside their subpixel.
Zwykły
Stochastyczny
Supersampling
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
(a)Nosupersampling.(b)Supersamplingwithjitteredsubpixel enters.
Figure IX.9: An example of anti-aliasing using jittered subpixel enters. (a) shows the s enerendered withoutsupersampling; note the \jaggies" on thesilhouettesoftheballs,forinstan e.(b)isthes enewithpixelssele tively supersampleduptoamaximumof40times.See olorplateC.9.
Mapowanie wypukło ´sci
Tekturowanie
Mapowanie
Aliasing i Antialiasing
Bumpmapping
Mapowanie ´srodowiska
18 / 19
Figure V.8: A bump mapped torus. Note the la k of bumps on the silhouette. There are four white lights shining on the s ene, plus a low level of ambient illumination. Thispi turewasgeneratedwiththeraytra ingsoftwaredes ribed in appendixB. See olor plate C.6.