Introduction to Computer Graphics - PowerPoint PPT Presentation

1 / 60
About This Presentation
Title:

Introduction to Computer Graphics

Description:

Title: Introduction to Computer Graphics Author: JLzD Last modified by: Office Of Computerservices Created Date: 9/15/1999 5:02:26 PM Document presentation format – PowerPoint PPT presentation

Number of Views:317
Avg rating:3.0/5.0
Slides: 61
Provided by: JLzD
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Computer Graphics


1
??????? 729441 Chapter 4 Lighting Shading
2
Wireframe
?????
????????? ?????????????????????????? (shading
algorithm)
????????? ?????? ?????????
3
(No Transcript)
4
Rendering
  • ????????????? pixel
  • ??????????(??? pixel ) ?????????????
  • ?????????????????? (normal direction)
  • ?????????????????? (luminaires)
  • ??????????????????????????????????????
  • ????????????????????????????????????

5
Rendering Algorithms
  • local illumination algorithms
  • ?????????????????????????????????????
    ??????????????????????????????????????????
  • global illumination algorithms
  • ???????????????????????????????????????????

6
Local VS Global Illumination
7
Local VS Global Illumination
Global
Local
8
Scene Geometry
9
Radiosity
10
Ray-Tracing
11
Illumination Variables
  • ????????????
  • ???????
  • ?????????
  • ?????
  • ??????????????????????
  • ?????????????????????????
  • ?????????????????????????????????
  • surface normal
  • ??????????????????? view plane

p0
N
p
12
A Model for Lighting
  • ???????????????????????????????
  • ?????????????????????????????????????????????????
  • direct light ????????????????????????????????
  • indirect light ???????????????????????????????????
    ??????
  • ?????????????????????????????????????????????

13
A Model for Lighting
  • ????????????
  • ?????????????
  • ?????????
  • ??????????????????
  • ???????????????????
  • ???????????

14
Lighting in Computer Graphics
  • ????????? projection plane
  • ????????????????????? COP ???????
  • projection plane ????????????????????
  • ????? pixel ?????????? interaction model

15
????????????
  • Ambient
  • ???????????????????????????????????????????????
    ????????????????????? Why?

???????????????? ???? ??????????????????????
16
????????????
  • Diffuse
  • ????????????????????????????????????????

Specular ?????????????????????????????????
????? ??????????
Emission ????????????????????????????????????
17
Interaction Between Light and Materials
  • ?? ????????? ????????? ???????????????????????????
    ???????????????????????
  • ?????????????????????????????????????????(??????)
    ???????????? ?????????????????????????????
  • Shading ?????????????????????????????????

18
Material Model
  • ???????????????????????????????????????? ????

??????????????????????
19
Material Model
20
Specular Surfaces
  • ????????????????????
  • ?????????????????????????????????
  • ????? pecfectly specular surface
  • ??????????????????????????

21
Diffuse Surfaces
  • ?????????
  • ??????????????????????
  • ?????????????????????

22
BRDF
  • Bi-directional Reflectance Distribution Function
  • ????????????????????????????????????

Ideal specular
Ideal diffuse
Rough specular
Directional diffuse
23
Illumination Examples
????????????????????specular
?????????????????????(shininess coefficient)
???????????????????? diffuse
24
??????????????????????
directional
positional
25
?????????????????????
  • ???????????????????
  • ?????????????????????????????????
  • ?????????????????????????
  • ??????????????????????????????????????????????????
    ????? ???? ??????????
  • ??????????????????
  • ???????????????????????????????
  • ???????????????????????????????????????????????
  • ??????????????????????????????????????????????????
    ??????????????

26
?????????????????????
  • ??????????????? spot light
  • ???????????????????????????
  • ??????? spor light

27
Shading
28
Lighting Models
  • illumination model
  • surface rendering algorithm

29
Shading
  • ?????????????????? effect ????????????????????????
    ??????????????
  • ??? normal vector ???????????????????????????????
    ?????????????????????

30
Example
31
Normal Vector
n
p0
p1
p2
32
Shading
  • Flat Shading
  • ???????????????????? normal vector
    ???????????????
  • Smooth Shading
  • ??????????????????????????????????????????????????
    ???
  • ?? 2 ????
  • Gouraud Shading
  • Phong Shading

33
Flat Shading
  • Flat Shading
  • ???????????????????? normal vector
    ???????????????
  • ??????????????????? 1 ??????????
  • ????????????????????????????????????

34
Gouraud Shading
  • Gouraud Shading
  • ??????????????????? normal vector ?????????
  • ????? interporation ??????????????????????????????
    ???
  • ?????????
  • ???????????? Flat Shading

35
Normal Vector ?????????
  • Normal Vector ?????????
  • normal vector ????????????????????????????
    ????????????
  • ????? normal vector ?????????????????????????
    effect ??????
  • ?????????
  • ?????????????? normal vector ?????????????????
  • ??????????????????

36
Phong Shading
37
???????????
38
Lighting in OpenGL
  • ???????????????????? 8 ???
  • GL_LIGHT0,GL_LIGHT1,,GL_LIGHT7

glEnable(GL_LIGHTING) glEnable(GL_LIGHT0)
39
Lighting in OpenGL
glLightfv()
glLightfiv(GL_LIGHT0, param, value)
GL_AMBIENT GL_DIFFUSE GL_SPECULAR GL_POSITION GL_S
POT_DIRECTION GL_SPOT_EXPONENT GL_SPOT_CUTOFF GL_C
ONSTANT_ATTENTUATION GL_LINEAR_ATTENUATION GL_QUAD
RATIC_ATTENUATION
Light source color intensity
spotlight parameters
irradiance control
40
Light Color
  • float amb 0.2, 0.2, 0.2. 1.0
  • glLightfv(GL_LIGHT0, GL_AMBIENT, amb)

41
Light Position
Glfloat position x,y,z,w
1.0f,2.0f,1.0f,1
Glfloat position x,y,z,w
0.0f, 0.0f, 1.0f, 0.0
glLightfv(GL_LIGHT0,GL_POSITION,position)
42
glNormal()
  • glBegin(GL_QUADS)
  • glNormal3f(0,1,0)
  • glVertex3f(1,0,-1,0)
  • glVertex3f(1,0,1,0)
  • glVertex3f(-1,0,1,0)
  • glVertex3f(-1,0,-1,0)
  • glEnd()

43
Shading and OpenGL
glShadeModel(GL_FLAT)
glShadeModel(GL_SMOOTH)
44
Material Model
  • ????????????????????????????????????????

????????????????????????????????? 0?
?????????????????????
45
OpenGL Material Properties
glMaterialfv()
glMaterialifv(face, param, value)
GL_FRONT GL_BACK GL_FRONT_AND_BACK
GL_AMBIENT GL_DIFFUSE GL_AMBIENT_AND_DIFFUSE GL_SP
ECULAR GL_EMISSION GL_SHININESS
RGB Values
Phong Exponent
46
OpenGL Material Properties
glMaterialfv()
Glfloat mat_ambient 1.0,1.0,1.0,1
glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient)
47
OpenGL Material Properties
glMaterialfv()
Glfloat mat_diffuse 1.0,1.0,1.0,1
Glfloat mat_specular 0.5,0.4,1.0,1
Glfloat mat_shininess 128.0
glMaterialfv(GL_FRONT,GL_DIFFUSE, mat_diffuse)
glMaterialfv(GL_FRONT,GL_SPECULAR, mat_specular)
glMaterialf(GL_FRONT,GL_SHININESS, mat_shininess)
48
Example
(0.0,0.0,1.0,1.0)
(0.0,0.0,4.0,1.0)
(0.0,0.0,2.0,1.0)
49
Example
(0.0,0.0,10.0,1.0)
(0.0,0.0,1.0,0.0)
50
Example
51
Example
????
????
52
Example
53
(No Transcript)
54
Display List
  • ????????????????????
  • ???????????? memory
  • ????????????????????????????? display list
  • ???????????????????????????

???????????? Display List
  • ?????????????????????????????????
  • ?????????? texture ???????????
  • ??????????????????????????????? Tree ???

55
Display List Model
glBegin(GL_LINES) glVertex() . glEnd()
56
???????????? Display List
Gluint glGenLists(int count)
  • ????????????????? display list
  • ??? ID(????)
  • count ??????????? display list
  • ???????????????
  • Glboolean glIslist(Gluint list)
  • ?????????????? list ?????????????????

57
?????????? Display List
Glvoid glNewList(Gluinit Listindex,Glenum
Mode) Glvoid glEndList() Listindex ????
display list Mode GLCOMPILE, GLCOMPILE_AND_EXECUT
E
glNewList( 1, GL_COMPILE ) glColor3fv(
colorVector ) glTranslatef( 1.5, 0.0, 0.0
) glBegin( GL_TRIANGLES ) glVertex2f( 0.0, 0.0
) glVertex2f( 1.0, 0.0 ) glVertex2f( 0.0, 1.0
) glEnd() glEndList()
58
?? Display List
GLvoid glDeleteLists( GLuint rstIndex, GLsizei
count )
59
Example
glNewList( 1, GL_COMPILE ) /????? 1
/ drawFin() glEndList() glNewList( 2,
GL_COMPILE ) / ????? 2 / drawFish() glEndLi
st() glNewList( 3, GL_COMPILE ) / ?????
3(run 1?2/ glCallList( 1 ) glCallList(
2 ) glEndList() glCallList( 3 ) /
drawFin() drawFish() /
60
Display List
glNewList( 1, GL_COMPILE ) / define ???? 1
/ drawNewFin() glEndList() glCallList( 3
) / drawNewFin() drawFish() /
Write a Comment
User Comments (0)
About PowerShow.com