0% found this document useful (0 votes)
8 views60 pages

Lec 10

The document discusses various aspects of shading, light, and textures in computer graphics, focusing on the limitations of the Phong Illumination Model and the importance of the Bidirectional Reflectance Distribution Function (BRDF). It covers properties of BRDFs, including rotational symmetry and Helmholtz reciprocity, as well as techniques for modeling surface reflection and roughness. Additionally, it highlights the significance of texture mapping and different methods such as bump and displacement mapping to enhance the realism of rendered images.

Uploaded by

kojo klevor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views60 pages

Lec 10

The document discusses various aspects of shading, light, and textures in computer graphics, focusing on the limitations of the Phong Illumination Model and the importance of the Bidirectional Reflectance Distribution Function (BRDF). It covers properties of BRDFs, including rotational symmetry and Helmholtz reciprocity, as well as techniques for modeling surface reflection and roughness. Additionally, it highlights the significance of texture mapping and different methods such as bump and displacement mapping to enhance the realism of rendered images.

Uploaded by

kojo klevor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Shading  

/  Light  /  Textures

Thanks  to  Srinivas  Narasimhan,  Langer-­‐‑Zucker,  Henrik  Wann  Jensen,  Ravi  Ramamoorthi,  
Hanrahan,  Preetham
Real-­‐‑world  objects  –  Phong  Illumination  Model  is  not  adequate
BRDF:  Bidirectional  Reflectance  Distribution  Function

source
z
incident
direction viewing
direction
θ
(θi , φi ) (θr ,φr )
normal
y
φ
surface
element
x

E surface (θ i , φi ) Irradiance  at  Surface  in  direction   (θ i , φi )


Lsurface (θ r , φr ) Radiance  of  Surface  in  direction   (θr , φr )

Lsurface (θ r , φr )
f (θ i , φi ; θ r , φr )
BRDF  : =
E surface (θ i , φi )
Important  Properties  of  BRDFs
source
z
incident
direction viewing
direction
θ
(θi , φi ) (θr ,φr )
normal
y
φ
surface
x element

•    Rotational  Symmetry  (isotropic  materials):



Appearance  does  not  change  when  surface  is  rotated  about  the  normal.    

BRDF    is  only  a  function  of  3  variables  : f (θi , θ r , φi − φr )


•    HelmholX  Reciprocity:    (follows  from  2nd  Law  of  Thermodynamics)

           Appearance  does  not  change  when  source  and  viewing  directions  are  swapped.

f (θi , φi ; θ r , φr ) = f (θ r , φr ; θi , φi )
Diffuse  Reflection  and  Lambertian  BRDF
Rendered  Sphere  with  Lambertian  BRDF

•      Edges  are  dark  (N.S  =  0)  when  lit  head-­‐‑on

•      See  shading  effects  clearly.


Specular  Reflection  and  Mirror  BRDF
source  intensity  I specular/mirror
         direction r (θr ,φr )
incident
direction s normal n
(θi , φi ) viewing
surface direction v (θv , φv )
element

•    Very  smooth  surface.

v r
•    All  incident  light  energy  reflected  in  a  SINGLE  direction.    (only  when                =                )
Specular  Reflec,ons  in  Nature  

It's  surprising  how  long  the  


reflec,ons  are  when  viewed  
siDng  on  the  river  bank.    

Compare  sizes  of  objects  and  their  reflec,ons!  


 
 
 
The  reflec,ons  when  seen  from  a  lower  view  
point  are  always  longer  than  when  viewed  
from  a  higher  view  point.  
Specular  Reflec,ons  in  Nature  
Glossy  Surfaces

•  Delta  Function  too  harsh  a  BRDF  model  


(valid  only  for  highly  polished  mirrors  and  metals).

•  Many  glossy  surfaces  show  broader  highlights  in  addition  to  mirror  reflection.

•  Surfaces  are  not  perfectly  smooth  –  they  show  micro-­‐‑surface  geometry  (roughness).
Blurred  Highlights  and  Surface  Roughness

Roughness
Phong  Examples

• These  spheres  illustrate  results  from  our  simple  Phong  Illumination  


model  as  lighting  direction  and  nshiny  are  varied:
Those  Were  the  Days

• “In  trying  to  improve  the  quality  of  the  


synthetic  images,  we  do  not  expect  to  be  able  to  
display  the  object  exactly  as  it  would  appear  in  
reality,  with  texture,  overcast  shadows,  etc.    We  
hope  only  to  display  an  image  that  
approximates  the  real  object  closely  enough  to  
provide  a  certain  degree  of  realism.”  
–  Bui  Tuong  Phong,  1975
Components  of  Surface  Reflection
With  Fresnel  Reflectance Without  Fresnel  Reflectance

h9p://www.graphics.cornell.edu/~westin/misc/fresnel.html
Reflections  on  water  surfaces  -­‐‑  Glieering
Split  off-­‐‑specular  Reflections  in  Woven  Surfaces
Why  does  the  Full  Moon  have  a  flat  appearance?  

•  The  moon  appears  maee  (or  diffuse)

•  But  still,  edges  of  the  moon  look  bright


(not  close  to  zero)  when  illuminated  by
earth’s  radiance.
Why  does  the  Full  Moon  have  a  flat  appearance?  

Lambertian  Spheres  and  Moon  Photos  illuminated  similarly


Surface  Roughness  Causes  Flat  Appearance

Actual  Vase Lambertian  Vase


Rendered  Sphere  with  Lambertian  BRDF

•      Edges  are  dark  (N.S  =  0)  when  lit  head-­‐‑on

•      See  shading  effects  clearly.


Surface  Roughness  Causes  Flat  Appearance  

 Increasing  surface  roughness

Lambertian  model

Valid  for  only  SMOOTH  MATTE  surfaces.

Bad  for  ROUGH  MATTE  surfaces.
Modeling  Rough  Surfaces  -­‐  Microfacets  

•Roughness  simulated  by  Symmetric  V-­‐groves  at  Microscopic  level.  

•Distribu,on  on  the  slopes  of  the  V-­‐grove  faces  are  modeled.  

•Each  microfacet  assumed  to  behave  like  a  perfect  lamber,an  surface.  

•For  more  informa,on,  look  into  the  Oren-­‐Nayar  Model    


Measuring  BRDFs

Why  bother  modeling  BRDFs?  


 
Why  not  directly  measure  BRDFs?

• True  knowledge  of  surface  properties

• Accurate  models  for  graphics


Measuring  BRDFs

• A  full  BRDF  is  4-­‐‑dimensional

• Simpler  measurements  (0D/1D/2D/3D)  often  useful

• Lets  start  with  simplest  and  get  more  complex


Measuring  Reflectance

0º/45º 45º/45º
Diffuse  Measurement Specular  Measurement
Gloss  Measurements

• Standardized  for  applications  such  as  paint  manufacturing

• Example:  “contrast  gloss”  is  essentially  ratio  of  specular  to  diffuse

• “Sheen”  is  specular  measurement  at  85°


Gloss  Measurements

• “Haze”  and  “distinctness  of  image”  are  measurements  of  width  of  
specular  peak
Gonioreflectometers

• Three  degrees  of  freedom  spread  


among  light  source,  detector,  and/
or  sample

• Can  add  fourth  degree  of  freedom  


to  measure  anisotropic  BRDFs
Image-­‐‑Based  BRDF  Measurement

• Reduce  acquisition  time  by  obtaining  larger  


       (e.g.  2-­‐‑D)  slices  of  BRDF  at  once
• Idea:  Camera  can  acquire  2D  image
• Requires  mapping  of  angles  of  light  to  camera  
pixels
Disney’s  BRDF  Explorer

• hep://www.disneyanimation.com/technology/
brdf.html
Real  objects  have  texture!
Every triangle can be supplied with texture
coordinates, which are interpolated over the
triangle during rasterization
Uses for Texture Mapping
Use texture to affect a variety of parameters
• surface color - radiance of each point on surface (Catmull 1974)
• surface reflectance - reflectance coefficients kd, ks, or nshiny
• normal vector - bump mapping (Blinn 1978)
• geometry - displacement mapping
• transparency - transparency mapping (clouds) (Gardener 1985)
• light source radiance - environment mapping (Blinn 1978)
Radiance vs. Reflectance Mapping
+ =

Sphere  w/  Uniform  Diffuse  coefficient Radiance  Map Sphere  w/  Radiance  Map

Texture specifies (isotropic) radiance for each point on surface

+ =

Sphere  w/  Uniform  Diffuse  coefficient Reflectance  (kd)  Map Sphere  w/  Reflectance  Map

Texture specifies diffuse color (kd coefficients) for each point on surface
- three coefficients, one each for R, G, and B radiance channels

Bump Mapping
Basic texture mapping paints on to a smooth surface
• How do you make a surface look rough?
– Option 1: model the surface with many small polygons
– Option 2: perturb the normal vectors before the shading
calculation

Real Bump Fake Bump Flat Plane

+ =

Sphere  w/Diffuse  Texture  Map Bump  Map Sphere  w/Diffuse  Texture  +  Bump  Map
Bump Mapping
• We can perturb the normal vector without having to
make any actual change to the shape.
• This illusion can be seen through—how?

Original model (5M) Simplified (500) Simple model with bump map
Bump Mapping

Greg Turk
Another Bump Mapping Example

+ =

Bump  Map

Cylinder w/Diffuse Texture Map


Displacement Mapping
• Use texture map to displace each point on the surface
– Texture value gives amount to move in direction normal to
surface

• How  is  this  different  from  bump  mapping?


Environment Mapping

Specular reflections that mirror the


environment
Environment Mapping
Specular reflections that mirror the environment

Cube is a natural
intermediate object
for a room

eye
Environment Mapping: Cube Maps
Basics of Texture Mapping in OpenGL
Glubyte my_texels[512][512][3];
Gluint texID;

glGenTextures(1, &texID);
glBindTexture(GL_TEXTURE_2D, texID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0,
GL_RGB,GL_UNSIGNED_BYTE, my_texels);
/* level, components, w, h, border, format, type, tarray */

/* assign texture coordinates */


glEnable(GL_TEXTURE_2D);
glBegin(GL_QUAD);
glTexCoord2f(0.0, 0.0);
glVertex3f(x1,y1,z1);
glTexCoord2f(1.0, 0.0);
glVertex3f(x2,y2,z2);
glTexCoord2f(1.0,1.0);
glVertex3f(x3,y3,z3);
glTexCoord2f(0.0,1.0);
glVertex3f(x4,y4,z4);
glEnd();
glDisable(GL_TEXTURE_2D);
Grungy details we’ve ignored
• Specify s or t out of range? Use GL_TEXTURE_WRAP in
glTexParameter because many textures are carefully designed to
repeat

• Aliasing? Mapping doesn’t send you to the center of a texel. Can


average nearest 2x2 texels using GL_LINEAR

• Mipmapping: use textures of varying resolutions. 64x64 becomes


32x32,16x16,8x8,4x4,2x2 and 1x1 arrays with
gluBuild2Dmipmaps
Texture Generation
Photographs
Drawings
Procedural methods (2D or 3D)
(2D: stripe, wave, and noise patterns
3D: sculpting in marble and granite)
Painting a mesh with a 2D texture

• www.uvmapper.com
Data Driven Approaches
• Made popular by Efros and Leung, 1999

hep://graphics.cs.cmu.edu/people/efros/research/EfrosLeung.html

Procedural Methods

Reaction-Diffusion
Greg Turk, Siggraph ‘91
Solid Textures
• Have a 3-D array of texture values (e.g., a
block of marble)

• In practice the map is often defined


procedurally
– No need to store an entire 3D array of
colors
– Just define a function to generate a color
for each 3D point

• The most interesting solid textures are


random ones

• Evaluate the texture coordinates in object


coordinates - otherwise moving the object
changes its texture! From:    An  Image  Synthesizer  

by  Ken  Perlin,  SIGGRAPH  'ʹ85
• Ken Perlin's talk "Making Noise"
BTF  databases  are  available,  e.g.,    hep://cg.cs.uni-­‐‑bonn.de/en/projects/btfdbb/
Materials  Change  with  Time  
Practice  Problems

Sketch  a  picture  of  what  you  think  the  BRDF  might  look  like  for  
a  single  incoming  light  direction  and  a  particular  surface.    Please  
assume  an  incoming  light  direction  45  degrees  from  the  surface  
normal.    Assume  a  surface  with  both  diffuse  color  and  
highlights,  e.g.  a  green  pepper.      Write  notes  to  explain  your  
sketch.

Are  there  types  of  materials  for  which  a  constant  is  acceptable  as  
a  BRDF?      What  would  such  a  surface  look  like?

Practice  Problems


Describe  an  experiment  to  measure  the  BRDF  that  you  sketched  
for  the  problem  on  the  previous  slide.

What  data  structure  would  you  use  to  store  such  a  BRDF?

Are  there  types  of  materials  for  which  a  one-­‐‑dimensional  
function  is  acceptable  as  a  BRDF?      a  two-­‐‑dimensional  function?    
a  three-­‐‑dimensional  function?      When  do  you  need  all  four  
parameters  to  represent  the  BRDF  adequately?    When  might  you  
need  five  dimensions  instead  of  four?

Practice Problems

How might you create an environment map to capture lighting


effects from a real-world outdoor scene? Assume only tools that
you may have in your home (e.g., a camera).
Practice Problems

When would you choose a displacement map over a bump map?


Which is likely to be more difficult to implement and why? (Think
carefully about the flow of operations in the standard computer
graphics pipeline.)

Why do you not get a realistic appearance when using an


environment map to render the appearance of a large flat mirror?
What visual artifacts would you expect to see if you tried to do
this?

You might also like