CIS736-Lecture-12-20080218 - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

CIS736-Lecture-12-20080218

Description:

... pages: http://snipurl.com/1y5gc ... 3.1, 20.3 20.13, Eberly 2e see http://snurl.com/1ye72 ... Fog. Stencil buffering. Fragment programs (to be concluded in ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 25
Provided by: kddres
Category:
Tags: cis736 | com | fog | lecture

less

Transcript and Presenter's Notes

Title: CIS736-Lecture-12-20080218


1
CIS 636/736 Computer GraphicsLecture 12 of 42
Surface Detail 5 Pixel and Vertex Programs
William H. Hsu Department of Computing and
Information Sciences, KSU KSOL course pages
http//snipurl.com/1y5gc Course web site
http//www.kddresearch.org/Courses/CIS636 Instruct
or home page http//www.cis.ksu.edu/bhsu Readin
gs All slides from SIGGRAPH 2000 tutorial on
OpenGL, Shreiner, Angel, Shreiner
http//www.cs.unm.edu/angel/SIGGRAPH/ Sections
2.6, 3.1, 20.3 20.13, Eberly 2e see
http//snurl.com/1ye72 NeHe tutorials 6 10,
http//nehe.gamedev.net Article
http//www.kuro5hin.org/story/2003/10/28/9853/1617
2
Lecture Outline
  • Based in part on OpenGL Tutorials from SIGGRAPH
    2000
  • Vicki Shreiner Animation and Depth Buffering
  • Double buffering
  • Illumination light positioning, light models,
    attenuation
  • Material properties
  • Animation basics in OpenGL
  • Vicki Shreiner Imaging and Raster Primitives
  • Ed Angel Texture Mapping
  • Dave Shreiner Advanced Topics
  • Display lists and vertex arrays
  • Accumulation buffer
  • Fog
  • Stencil buffering
  • Fragment programs (to be concluded in Tutorial 3)

3
Lighting
  • Dave Shreiner

4
Lighting Principles
  • Lighting simulates how objects reflect light
  • material composition of object
  • lights color and position
  • global lighting parameters
  • ambient light
  • two sided lighting
  • available in both color indexand RGBA mode

5
Surface Normals
  • Normals define how a surface reflects light
  • glNormal3f( x, y, z )
  • Current normal is used to compute vertexs color
  • Use unit normals for proper lighting
  • scaling affects a normals length
  • glEnable( GL_NORMALIZE ) orglEnable(
    GL_RESCALE_NORMAL )

6
Light Properties
  • glLightfv( light, property, value )
  • light specifies which light
  • multiple lights, starting with GL_LIGHT0
  • glGetIntegerv( GL_MAX_LIGHTS, n )
  • properties
  • colors
  • position and type
  • attenuation

7
Light Sources
  • Light color properties
  • GL_AMBIENT
  • GL_DIFFUSE
  • GL_SPECULAR

8
Turning on the Lights
  • Flip each lights switch
  • glEnable( GL_LIGHTn )
  • Turn on power
  • glEnable( GL_LIGHTING )

9
Light Material Tutorial
10
Controlling a Lights Position
  • Modelview matrix affects a lights position
  • Different effects based on when position is
    specified
  • eye coordinates
  • world coordinates
  • model coordinates
  • Push and pop matrices to uniquely control a
    lights position

11
Light Position Tutorial
12
Pixel Pipeline
  • Programmable pixel storage and transfer
    operations

glBitmap(), glDrawPixels()
Rasterization (including Pixel Zoom)
Pixel-Transfer Operations (and Pixel Map)
Pixel Storage Modes
Per FragmentOperations
FrameBuffer
CPU
glCopyTexImage()
TextureMemory
glReadPixels(), glCopyPixels()
13
Texture Mapping
  • Ed Angel

14
Texture Mapping
  • Apply 1-D, 2-D, or 3-D image to geometric
    primitives
  • Uses of Texturing
  • simulating materials
  • reducing geometric complexity
  • image warping
  • reflections

15
Texture Mapping
screen
geometry
image
16
Texture Mapping andOpenGL Pipeline
  • Images and geometry flow through separate
    pipelines that join at the rasterizer
  • complex textures do not affect geometric
    complexity

17
Texture Example
  • The texture (below) is a 256 x 256 image that
    has beenmapped to a rectangularpolygon which is
    viewed inperspective

18
Applying Textures 1
  • Three steps
  • specify texture
  • read or generate image
  • assign to texture
  • assign texture coordinates to vertices
  • specify texture parameters
  • wrapping, filtering

19
Applying Textures 2
  • specify textures in texture objects
  • set texture filter
  • set texture function
  • set texture wrap mode
  • set optional perspective correction hint
  • bind texture object
  • enable texturing
  • supply texture coordinates for vertex
  • coordinates can also be generated

20
Specify Texture Image
  • Define a texture image from array of texels
    in CPU memory
  • glTexImage2D( target, level, components, w, h,
    border, format, type, texels )
  • dimensions of image must be powers of 2
  • Texel colors are processed by pixel pipeline
  • pixel scales, biases and lookups can bedone

21
Tutorial Texture
22
Summary
  • OpenGL Tutorials from SIGGRAPH 2000
  • Vicki Shreiner Animation and Depth Buffering
  • Double buffering
  • Illumination light positioning, light models,
    attenuation
  • Material properties
  • Animation basics in OpenGL
  • Vicki Schreiner Imaging and Raster Primitives
  • Ed Angel Texture Mapping in OpenGL
  • More in CG Basics 5 GL Primer 2 of 3

23
Terminology
  • Double Buffering
  • Lighting
  • Illumination Equation describes light in scene
  • Ambient light catch-all term for whole scene,
    all lights
  • Diffuse reflectance omnidirectional, from matte
    surfaces
  • Specular reflectance unidirectional, for
    highlights shiny surfaces
  • Attenuation how quickly light drops off as
    function of distance
  • Pixel and Fragment Programs (Pixel Shaders)
  • Vertex Shaders
  • Texture Maps
  • Other Mappings Discussed in Course
  • Bump aka displacement perturb surface normal,
    calculate lighting
  • Reflection and transparency
  • Shadow
  • Environment

24
Next Polygons, OpenGL Tutorial 3
  • Dave Shreiner Advanced Topics (concluded)
  • Advanced Primitives Cubic Curves, Bicubic
    Surfaces
  • More on Shadow Stencil Buffer
  • Alpha, Blending, Antialiasing
  • Accumulation Buffer, Fog, Jitter
  • Using the OpenGL Shading Language
  • More on fragment programs
  • Demo color interpolation
  • Example Fast Phong shading
  • Special Effects
Write a Comment
User Comments (0)
About PowerShow.com