Lec 11
Lec 11
Lec 11
Part 1:
What is Light?
Lig
h t t
g h
Li Part II:
Part IV:
Light
Lighting The Eye
No
Lig
Part III: ht
Part V:
Reflectance Shadows
!"#$%&'()*++,-%&#.%/&
0%'".)!/,1234)3-%.)+%'".
56)4732.1,-
8/4%.%/&)#&$)$%132.%/&
!,19#234)139+32.)+%'".
:39+32.#&23
;3/-3.1<)=7/4%.%/&>)/1%3&.#.%/&>)-%21/?4.1,2.,13@
AB4/17.%/&
C1#&4-%44%/&
*++,-%&#.%/&)$3.31-%&3$)B<)."3)%&.31#2.%/&4)B3.D33&)+%'".)4/,1234)#&$)
4,19#234
Surface
Computer Graphics 15-462 20
BRDF
Surface scattering can be modeled as a function that maps light from incoming (light)
directions ωin to outgoing (viewing) directions ωout:
4
BRDFs (Continued)
BRDF Model:
�
Lo (ωo ) = Li (ωi )f (ωi , ωo )dω
Ω
Constraint:
�
f (ωi , ωo )dω ≤ 1
Ω
5
!"#$%&'%&())%)'#*+%#,-.$%$-/#0
1(2"$%3&($"%4-)-*5
67'4.)#* "(2")(2"$8
6"#/-&8
9-%$*#+8:(88(-+%-;%)(2"$%$"*-.2"%8.*;#4'8
9-%*';)'4$(-+8%;*-:%-$"'*%8.*;#4'8
Diffuse reflection occurs from dull, matte surfaces, like latex paint, or chalk.
These diffuse or Lambertian reflectors reradiate light equally in all directions.
Picture a rough surface with lots of tiny microfacets.
7
Diffuse reflectors
…or picture a surface with little pigment particles embedded beneath the surface
(neglect reflection at the surface for the moment):
8
Diffuse reflectors, cont.
The reflected intensity from a diffuse surface does not depend on the direction of the
viewer. The incoming light, though, does depend on the direction of the light source:
9
!"##$%&'(&#)&*+",-
. /"01)&%+'2"-3',#'4&#)&*+,4'56)%,'2-,7-'6%'Lambertian
Reflection8
. 9,3&)%'6'06++&'%$4#6*&':: 4,$;<'6+'+<&'0"*4,%*,1"*')&=&)
. >3&6)'3"##$%&'4&#)&*+,4
? "-*,0"-;')";<+'"%'%*6++&4&3'&@$6))A'"-'6))'3"4&*+",-%
? ="&7&3'B4";<+-&%%'3,&%'-,+'3&1&-3',-'="&7"-;'3"4&*+",-
? B4";<+-&%% does 3&1&-3',-'3"4&*+",-',#'"))$0"-6+",-
Illumination direction
c # cos !
c # n"l
n 2..34&5"6%.)0&#"1
l 2.,(&%6'(0).'0.1(-+'
! 2..!(-+'780&#"1.")-1%
n"l
cos ! $
nl
kd ,**02&7"3%*&%78%3'"53%*31%77-3-%5'*-5*9:;<=
! ,**!-./'>?1&#"8*"5.8%
c " cr cl max(0, n ! l )
c " cr cl n ! l 61+7)/8'8%4/0"$
Ideally, we would do the calculation on these functions. For the ambient shading
equation, we would start with:
then we would find good RGB values to represent the spectrum I(λ).
Traditionally, though, ka and Ia are represented as RGB triples, and the computation is
performed on each color channel separately:
14
!"#$%&'()*+),-++.(')/&&.$-0#1-*0
2#$')(%3'4')&-1)5-++.('&6)+4*$)5-++'4'01)&-731-07)#07&'(
83#1)3#%%'0()9-13)(.4+#:'()+#:-07)#9#6)+4*$)13')&-731;
<-1:3)=&#:>?0*1)'"#:1&6)4'#&-(1-:
@*9)1*)(*&A';
2'A'4#&)&-731)(*.4:'(?5-$)&-731)(*.4:')#1)'6'B)+*4)
'"#$%&'
C$=-'01)&-731
Computer Graphics 15-462 26
!"#$%&'()(*$++,-%(.%+/%0'$1&
Ia B((!"#$%&'(/$45'($&'%&-$'>(@4/1#2/A
ka B((!"#$%&'(6%+/%0'2&0%(@/102/A
*$++,-%($//,"$&2'$1&(3/,-(2(-$"3/%(2"#$%&'(/$45'('%6"
2(7.89:('1(2001,&'(+16(2(#20;461,&<(/$45'(/%=%/(02,-%<(#>(
",/'$3/%(6%+/%0'$1&-(+61"(2//(1#?%0'-($&('5%(-0%&%(@/%--(526-5(
233%262&0%A
Specular reflection accounts for the highlight that you see on some objects.
It is particularly important for smooth, shiny surfaces, such as:
metal
polished stone
plastics
apples
skin
Properties:
Specular reflection depends on the viewing direction V.
For non-metals, the color is determined solely by the color of the light.
For metals, the color may be altered (e.g., brass)
18
!"#$%&'( )#*&#$+,-./012-.3 !2'4,.35
6 !2,.7/8%(*'$#8/$2'.3#/'""#'('.$#/92#./:,#9"-,.+/,8/:'(,#4
; 8"#$%&'(,+,#8 02,32&,32+85/'(#/:,#9<4#"#.4#.+
; $'%8#4/=7/8%(*'$#8/+2'+/'(#/>,$(-8$-",$'&&7/8>--+2/0+,&#/*&--(8? 3&-88/
"',.+?/92,+#=-'(485
6 @-(/82,.7/8%(*'$#8/"'(+/-*/+2#/,.$,4#.+/&,32+/(#*&#$+8/
$-2#(#.+&7
; './,.$->,.3/('7/,8/(#*&#$+#4/,./'/8,.3&#/4,(#$+,-./0-(/.'((-9/=#'>5
; 4,(#$+,-./,8/4#*,.#4/=7/+2#/,.$->,.3/4,(#$+,-./'.4/+2#/8%(*'$#/.-(>'&
; 92#./! ,8/.#'(/A#(-?/:,#9#(/8##8/(#*&#$+,-.
p
I specular " k s I light (e ! r )
ks 8%%9.$('3-/ /$&3$()-#($
p 8%%:-)$%+&%2.$('3-/ &-33+&&%;.,+#6 $0.+#$#)<
! -../$%'0.10,200$.304'05,06.'*%",.3+7.R +$6.8*0203.V
ks -..9:05('+3 304'05,+$50
p -..;+,0.#4.<:05('+3 4+''#44.=:"#$% 0>:#$0$,?
@#.30+'.:"7<*5+'.1+<*<.1(,.:3#8*60<.+::3#>*)+,0'7.,"0.3*%",.+$<203
Computer Graphics 15-462 33
!"#$%&'()*&+,*-,./,0&,1*-23
blackboard
-#.*$%/,"0/'*%",/1#(230
4"+$%*$%/5
Experiment with different parameter settings. To get you started, here are a few
suggestions:
ns kd ks
Medium, color of
Plastic medium Medium, white
plastic
Planet 0 varying 0
25
More sophisticated BRDF’s
Cook and
Torrance, 1982
26
BRDF
27
ating the sample material. By fitting an expression derived f
BSSRDF
usion theory it is possible to estimate the absorption and sca
properties of the material.
source: http://graphics.stanford.edu/papers/bssrdf/
Theory
BSSRDF, S, relates the outgoing radiance, Lo (xo , ω � o ) at
t xo in direction ω� o , to the incident flux, Φi (xi , ω
� i ) at the p
rom direction ω � i [14]:
dLo (xo , ω
� o ) = S(xi , ω
� i ; xo , ω
� o ) dΦi (xi , ω
� i ).
he BRDFBRDF is an
is an approximation of
approximation thatthe
assumes xi = xofor
BSSRDF . whic
ssumed that light enters and leaves at the same point (
= x ). Given a BSSRDF, the outgoing radiance is compu 28
Snow
Shading
Part 1:
What is Light?
Lig
h t t
g h
Li Part II:
Part IV:
Light
Lighting The Eye
No
Lig
Part III: ht
Part V:
Reflectance Shadows
Shading
Part 1:
What is Light?
Lig
h t t
g h
Li Part II:
Part IV:
Light
Lighting The Eye
No
Lig
Part III: ht
Part V:
Reflectance Shadows
Types of Light Sources
! "#$%&'()**&+,-.*.%/0(*%'*-..*1%2&3(%4'5
6 -*0-37*(4*#41&.*%'(&282&9.&3(%4'5
! :%2&3(%4'-.)**.%/0(*2-;5*42%&'(&1*%'*5-#&*1%2&3(%4'
6 /441*942*1%5(-'3&*.%/0(*54,23&5*<5,'.%/0(=
! >4%'()**.%/0(*2-;5*1%?&2/&*924#*-*5%'/.&*@4%'(
6 -@@24A%#-(%4'*(4*-*.%/0(*$,.$*<$,(*0-250&2=
OpenGL supports three different kinds of lights: ambient, directional, and point. Spot
lights are also supported as a special form of point light.
We’ve seen ambient light sources, which are not really geometric.
Directional light sources have a single direction and intensity associated with them.
33
Point lights
The direction of a point light sources is determined by the vector from the light
position to the surface point.
Physics tells us the intensity must drop off inversely with the square of the distance:
34
Spotlights
OpenGL also allows one to apply a directional attenuation of a point light source, giving a
spotlight effect.
where
L is the direction to the point light.
S is the center direction of the spotlight.
β is the cutoff angle for the spotlight
e is the angular falloff coefficient
35
“Iteration four”
Since light is additive, we can handle multiple lights by taking the sum over every light.
Our equation is now:
36
More Light Sources
! "#$%&'()%*++#$',%+-$./01+2'%)+3'/10%'$,4&+54&&6$55
7 ',%1,-'%8+'-+94:'94&+4&$,(+-$91+3'/10%'$,+;<+54&&-+$55+4248+5/$9 ;
7 -#10'5'13+=8+0$&$/<+#$',%<+3'/10%'$,<+54&&6$55+#4/491%1/-
! >/14+"$./01*++?.9',$.-+@;+-./5401+
7 /43'4%1-+&'()%+5/$9+4&&+#$',%-+$,+'%-+-./5401
7 (1,1/4%1-+-$5%+-)43$2-
!
I & ka I a % fatt Ilight kd cos$ % ks (cos#) p
"
0 ;,/'2"*#$9*-'*$&.#'8,"/:-8
< =-9-4#'#.-'6$77"8-'4%6'89-:"*4/ :4*:"*4#$,%8'7,/'-4:.'*$&.#'8,"/:-
< )66'#.-':,29,%-%#8'7/,2'4**'*$&.#'8,"/:-8
< +.-'423$-%#'#-/2':,%#/$3"#-8',%*>',%:-
0 +.-'6$77-/-%#'/-7*-:#4%:-':,-77$:$-%#8':4%'6$77-/?'
< @$29*-'A2-#4*BC'ka 4%6'kd 8.4/-'24#-/$4*':,*,/5'ks $8'D.$#-'
< @$29*-'9*48#$:C'ks 4*8,'$%:*"6-8'24#-/$4*':,*,/
< E,/-',%'#.-8-'F$%68',7'94/42-#-/8'D.-%'D-'#4*F'43,"#'
/-7*-:#4%:-'2,6-*8'$%'4'7-D'D--F8
Part 1:
What is Light?
Lig
h t t
g h
Li Part II:
Part IV:
Light
Lighting The Eye
No
Lig
Part III: ht
Part V:
Reflectance Shadows
Shading
Part 1:
What is Light?
Lig
h t t
g h
Li Part II:
Part IV:
Light
Lighting The Eye
No
Lig
Part III: ht
Part V:
Reflectance Shadows
!"#$%&'
!"#$%&'(%))*+(&",+,(%-.,)/'(#+,("0$$,1(2+%3(#(405"/('%*+),
%30/(#16(01/,1'0/6()%1/+0-*/0%1(2+%3("0$$,1(405"/('%*+),'
7%+8015(%*/(&"#/(0/("0$$,1(0'('03946(#(:0'0-040/6(9+%-4,3
)#1(/",(405"/('%*+),(',,(/",(%-.,)/;
*',(/",(<=-*22,+('"#$%&(#45%+0/"3>
+*1(/",(#45%+0/"3(2+%3(/",(405"/('%*+),?'(:0,&9%01/
'#:,(/",(<=-*22,+(#'(/",('"#$%&(-*22,+
+*1(/",(+,#4(<=-*22,+(#45%+0/"3@(/+#1'2%+3015(,#)"(9%01/(01/%(/",(405"/(
How does the z-buffer work?
'%*+),?'()%%+$01#/,'(#1$()%39#+015(/",(<(:#4*,(#5#01'/(/",('"#$%&(
How can we use the z-buffer to compute shadows?
-*22,+
• Why? How?
!"#$%&'%%'($)*'+,)-./"#0+'($
1 -./"#0+'($2
3 +,.)4.$5'$6)(/)7'6,+)58.)+()'+%)5'//.".$+)9.7(0'+'.%)+,"(86,)5'//.".$+)
&#+."'#7%
1 -./"#0+'9.)'$5.:2
3 7'6,+)+"#9.7%)#+)%;..5)c/n '$)#)&#+."'#7)(/)"./"#0+'9.)'$5.:)n
3 c '%)+,.)%;..5)(/)7'6,+)'$)#)9#088&
3 9#"'.%)*'+,)*#9.7.$6+,),.$0.)"#'$4(*%)#$5);"'%&%
<=!>-?=@ ?AB>C)DE)->E-=F!?DA
='"GH#088& I
J#+." IKLL
M7#%% #4(8+)IKN
B'#&($5 OKP
?1#.+2"#$*$
(/-3#-$@+A/37#1+#.+)*3.*B+%2+#)*3#'*+
/4+&/37#12 4/3+#$C#0*&.+4#0*2+
D"/&'@+%&.*38/1#.*+&/37#12 %&2.*#$+/4+
blackboard %&.*&2%.%*2
!"#$%&'(")*+%,#-"%+./0#)"%0"#*./"+1%&/%*"2*./"
34"%&5*6&47%.+"%#%,.8"%4.9'"/%&0%5&$:8&4+%;6*,%
#55/&5/6#*"%+./0#)"%)&$&/648%#4<%/"0$")*#4)"%
),#/#)*"/6+*6)+
="2*./"%9#55648%8"*+%:&.%9&/"%<"*#6$%#*%$"++%)&+*
> ?++684%/#<6#4)"%'#+"<%&4%#4%69#8"
3/%.+" Procedural shaders *&%+5")60:%#4:%0.4)*6&4%:&.%
;#4*%*&%<"064"%/#<6#4)"
> @"4"/#*"%/#<6#4)"%&4%*,"%0$:1%<./648%+,#<648
glEnable(GL_LIGHTING);