sistemi multimediali ii
DESCRIPTION
Lezione 10: la L di T&L. Università dell’Insubria Facoltà di Scienze MFN di Varese Corso di Laurea in Informatica Anno Accademico 2004/05. Sistemi Multimediali II. Marco Tarini. Lighting. L’altra met à del rendering Determinare la luce quanta luce di che colore che arriva - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/1.jpg)
Sistemi Multimediali II
Marco Tarini
Università dell’Insubria
Facoltà di Scienze MFN di Varese
Corso di Laurea in Informatica
Anno Accademico 2004/05
Lezione 10: la L di T&L
![Page 2: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/2.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 2/40
Lighting
• L’altra metà del rendering• Determinare la luce
– quanta luce– di che colore
che arriva – da un punto della scena – all’occhio
• Problema complesso...
![Page 3: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/3.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 3/40
Lighting: alcuni fattori
LUCE
OCCHIOOGGETTO
trasmissione (con rifrazione)
assorbimento
riflessione interna
assorbimentoda parte del mezzo
(e.g. nebbia)
scattering sotto la superficie
ALTRA LUCE
blocker
inombra
rifelssione
raggio incidente
![Page 4: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/4.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 4/40
Lighting: alcuni fattori
LUCE
OCCHIOOGGETTO
riflessioni multiple(illuminazione indiretta)
![Page 5: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/5.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 5/40
Lighting: globale VS locale
– tiene conto solo di:• condizioni di luce
– N. luci– loro pos– loro colore
• pezzetto della superficie da illuminare
– orientamento (normale)– caratteristiche ottiche
» per es, colore
– il resto del mondo non c’è
– riflessioni multiple– ombre– scattering
sottosuperficiale– rifrazione– ...
Illuminazione locale Illuminzione globale
torna molto più
facile da farecon il nostro
Hardware
![Page 6: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/6.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 6/40
Lighting locale
LUCE
OCCHIOOGGETTO
rifelssione
raggio incidente
![Page 7: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/7.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 7/40
Cosa è facile fare
• Illuminazione locale:– riflessioni della luce su oggetti
• con proprietà ottiche molto semplici
– con multiple fonti di luci• ma molto semplici: puntiformi
• Illuminazione globale:– riflessioni multiple
• in maniera BRUTALMENTE approssimata
– assorbimento da parte del mezzo• assunzioni semplificanti (nebbia uniforme)
– tutto il resto solo "a fatica"• escogitando algoritmi ad-hoc che si adattano al nostro l'HW
![Page 8: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/8.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 8/40
I 3 fattori che consideriamo
luce finale=
ambiente+
riflessione+
emissione
per ogni addendo, ho una componente R, G e B.
definite sia per l'oggetto, (sotto forma di attributi per
vertice)sia per ogni luce che uso
le proprieta ottiche dell'oggetto,
(di solito sono attributi per vertice)
nel loro insieme sono detteil suo "materiale"
terminologia OpenGL
![Page 9: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/9.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 9/40
Componente emissione
• LEDs, lampadine...• Non dipende dalle luci
– solo dall'oggetto
• E’ solo una componente additiva – costante per R, G e B
• Nota: non manda mica luce ad oggetti vicini– non e’ illuminazione globale– per fare cio’, devo settare una altra luce
![Page 10: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/10.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 10/40
I 3 fattori che consideriamo
luce finale=
ambiente+
riflessione+
emissione
![Page 11: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/11.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 11/40
Componente ambiente
• Modella (grossolanamete)la luce che arriva attraverso rifelssioni multiple
• Assunzione: "un po di luce arriva da tutte le direzioni in ogni superficie"– anche quelle in ombra
• Piccola costante additiva– non dipende dalla normale della superficie
![Page 12: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/12.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 12/40
Componente ambiente
• prodotto fra:– colore “ambient” del materiale ( RM GM BM)
– colore “ambient” della luce ( RL GL BL)
• Nota: possono essere colori RGB diversi– prodotto componente per componente
![Page 13: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/13.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 13/40
Componente ambiente
• Modella (grossolanamete)la luce che arriva da tutte le direzioniattraverso rifelssioni multiple
senza
con
![Page 14: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/14.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 14/40
I 3 fattori che consideriamo
luce finale=
ambiente+
riflessione+
emissione
riflessione diffusa
+
riflessione speculare
solo componenteambient
![Page 15: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/15.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 15/40
I 4 fattori che consideriamo
luce finale=
ambiente+
riflessione diffusa +
riflessione speculare+
emissione
![Page 16: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/16.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 16/40
Componente riflessione diffusa
• Esibita nella realtà da (per es):– gesso – legno (quasi)– materiali molto opachi (non lucidi)
• Detta anche– diffuse reflection– Lambertian reflection
Johann Heinrich Lambert 1728 - 1777
![Page 17: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/17.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 17/40
Componente riflessione diffusa
• La luce che colpisce una superficie lambertiana si riflette in tuttele direzioni (nella semisfera)– nello stesso modo
![Page 18: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/18.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 18/40
Componente riflessione diffusa
• La luce che colpisce una superficie lambertiana si riflette in tuttele direzioni (nella semisfera)– nello stesso modo
![Page 19: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/19.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 19/40
Componente riflessione diffusa
• La luce che colpisce una superficie lambertiana si riflette in tuttele direzioni (nella semisfera)– nello stesso modo
![Page 20: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/20.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 20/40
Componente riflessione diffusa
• Dipende solo da:– l'orientamento della superficie
• (la "normale")
– la direzione della luce• del raggio incidente
![Page 21: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/21.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 21/40
Componente riflessione diffusa
• Dipende solo da:– l'orientamento della superficie N
• (cioè la sua "normale")
– la direzione della luce L• (cioé del raggio incidente)
cos diffmaterialedifflucediff kII
R, G, B(di solito bianco: 1,1,1)
R, G, B(il "colore" dell'oggetto)
moltiplicazione componente per componente
![Page 22: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/22.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 22/40
fa parte del"materiale"
(caratteristica dell'oggetto)
Componente riflessione diffusa
• Dipende solo da:– l'orientamento della superficie N
• (cioè la sua "normale")
– la direzione della luce L• (cioé del raggio incidente)
cos diffmaterialedifflucediff kII
![Page 23: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/23.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 23/40
Componente riflessione diffusa
• Dipende solo da:– l'orientamento della superficie N
• (cioè la sua "normale")
– la direzione della luce L• (cioé del raggio incidente)
cos diffmaterialedifflucediff kII
![Page 24: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/24.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 24/40
Componente riflessione diffusa
• Dipende solo da:– l'orientamento della superficie N
• (cioè la sua "normale")
– la direzione della luce L• (cioé del raggio incidente)
)L̂N̂( diffmaterialediffluce kI
cos diffmaterialedifflucediff kII
angolo compreso fra 0⁰ e 90⁰,senno fa 0,
(oggetto in ombra di se stesso)
![Page 25: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/25.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 25/40
Componente riflessione diffusa
L
N
componente diffusapiccola⍬=70⁰
L
N
componente diffusagrande⍬=35⁰
L
N
componente diffusamassima⍬=0⁰
![Page 26: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/26.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 26/40
Componente riflessione diffusa
L
N
componente diffusaZERO⍬=90⁰
L
N
componente diffusaZERO⍬>90⁰
(la superficieè nella propria stessa ombra)
![Page 27: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/27.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 27/40
Componente riflessione diffusa
• Proprietà– modello fedele
delle caratteristiche ottichedi alcuni materiali reali
– ma di pochi materiali
– modello fisicamente coerente • per es, conserva l'energia
– molto semplice da calcolare
![Page 28: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/28.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 28/40
I 4 fattori che consideriamo
luce finale=
ambiente+
riflessione diffusa +
riflessione speculare+
emissione
![Page 29: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/29.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 29/40
Componente riflessione speculare
• "Specular" reflection
• Per materiali lucidi– con riflessi brillanti– ("highlights")
senza con
![Page 30: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/30.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 30/40
Componente riflessione speculare
• Idea base:la luce non viene riflessa da materiali lucidiin maniera eguale in tutte le direzioni
![Page 31: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/31.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 31/40
Componente riflessione speculare
L: raggio incidenteN: normaleR: raggio riflessoV: dir. di vista
NL R
V
in 3D
![Page 32: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/32.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 32/40
Componente riflessione speculare
• Phong light model – by Bui-Tuong Phong, 1975
in 3Dcos specmaterialespeclucespec kII
![Page 33: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/33.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 33/40
Componente riflessione speculare
• Elevando il coseno ad una potenza,si ottengono riflessi piu' piccoli e brillanti
![Page 34: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/34.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 34/40
fanno parte del "materiale"(caratteristiche dell'oggetto)
Componente riflessione speculare
• Phong light model – by Bui-Tuong Phong, 1975
in 3D
nspecmaterialespeclucespec kII cos
cos specmaterialespeclucespec kII
![Page 35: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/35.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 35/40
Componente riflessione speculare
• Phong light model – by Bui-Tuong Phong, 1975
in 3D
nspecmaterialespecluce VRkI )ˆˆ(
cos specmaterialespeclucespec kII
nspecmaterialespeclucespec kII cos
![Page 36: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/36.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 36/40
Componente riflessione speculare
1n 5n 10n 100n
![Page 37: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/37.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 37/40
Componente riflessione speculare
• Blinn-Phong light model:• semplificazione del Phong light model• risultati simili, formula diversa:
nspecmaterialespeclucespec VRkII )ˆˆ( phong:
blinn-phong:n
specmaterialespeclucespec NHkII )ˆˆ(
NL R
V
H = L + V / |L+V|
"half-way" vector
![Page 38: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/38.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 38/40
Componente riflessione speculare
• Blinn-Phong light model:• semplificazione del Phong light model• risultati simili, formula diversa:
Jim Blinn
(MEGA-MEGA-GURU)
nspecmaterialespeclucespec VRkII )ˆˆ( phong:
blinn-phong:n
specmaterialespeclucespec NHkII )ˆˆ(
![Page 39: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/39.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 39/40
I 4 fattori che consideriamo
luce finale=
ambiente+
riflessione diffusa +
riflessione speculare+
emissione
![Page 40: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/40.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 40/40
Equazione di lighting in totale
nspacularmaterialespacularluce NHkI )(
)( NLkI diffusematerialediffuseluce
ambientmaterialeambientluce kI
emissionmaterialek
totI
propretà del materiale propretà della luce
![Page 41: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/41.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 41/40
Materiali...
![Page 42: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/42.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 42/40
Equazione di lighting:modellazione delle luci
nspacularmaterialespacularluce NHkI )ˆˆ(
)ˆˆ( NLkI diffusematerialediffuseluce
ambientmaterialeambientluce kI
emissionmaterialek
totI
propretà della luce
VL
VLˆˆ)ˆˆ(
![Page 43: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/43.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 43/40
Modellazione delle luci
• Come varia L?– costante nella scena: fonti di luci "direzionali"
• buono per fonti di luce molto distanti, e.g. il sole
– varia nella scena: fonti di luci "posizionali" • buono per fonti di luci vicine, e.g. lampadine
![Page 44: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/44.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 44/40
Modellazione delle luci: luci posizionali
• Nelle luci posizionali, si può attenuare l'intensità in funzione della distanza
• In teoria (per la fisica) intensità = 1 / distanza2
2L
1
dcf luceoneattentuazi
![Page 45: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/45.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 45/40
Modellazione delle luci: luci posizionali
• In pratica, questo porta ad attenuazioni della luce troppo repentine
• Invece usiamo:
1,1
min2L3L21 dcdcc
f luceoneattentuazi
![Page 46: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/46.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 46/40
Equazione di lighting
nspacularmaterialespacularluce HLkI )(
)( NLkI diffusematerialediffuseluce
ambientmaterialeambientluce kI
emissionmaterialek
totI luceoneattentuazif
1,1
min2L3L21 dcdcc
f luceoneattentuazi
![Page 47: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/47.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 47/40
Tipi di luci
• Tipi di luci:– posizionali– direzionali– spot-lights
• (faretti)
![Page 48: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/48.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 48/40
Spotlights
• Definite da tre parametri:
![Page 49: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/49.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 49/40
Equazione di lighting
nspacularmaterialespacularluce HLkI )(
)( NLkI diffusematerialediffuseluce
ambientmaterialeambientluce kI
emissionmaterialek
totIluceoneattentuazif
1,1
min2L3L21 dcdcc
f luceoneattentuazi
spotlighteffettof
widthbeamAnglecutoffdirectionspotlighteffetto spotspotspotLf ,,,f
![Page 50: Sistemi Multimediali II](https://reader035.vdocumenti.com/reader035/viewer/2022070405/56813dbd550346895da78622/html5/thumbnails/50.jpg)
M a r c o T a r i n i ‧ S i s t e m i M u l t i m e d i a l i I I ‧ 2 0 0 4 / 0 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a - 50/40
Prossimamente:
Fram
men
ti&
att
rib
uti
in
terp
ola
ti
Vert
ici
& loro
att
rib
uti
Screen buffer
Vert
ici
pori
ett
ati
& a
ttri
bu
ti
com
pu
tati
rasterizer
triangoli
com
puta
zioni
per
fram
mento
set-up
rasterizer
segmenti
set-up
rasterizer
punti
set-up
com
puta
zioni
per
vert
ice
lighting: DOVE?
x
y
z
v0v1
v2
v0v1
v2