HSV Color Space (cont) s value x the sensation of light and dark colors x white has a value of 1 and black has a value of 0 s easier for a human to choose colors x pick the color family (red, green, yellow, etc) x pick the purity or strength of the color
RGB Color Space (cont) s some rgb values for colors
color black white gray red green blue yellow
s
r 0 1 0.5 1 0 0 1
g 0 1 0.5 0 1 0 1
b 0 1 0.5 0 0 1 0
color cyan orange navy khaki maroon
r 0 1 0 0.94 0.69
g 1 0 0.65 0 0.81 0.90 0.19
b 1 1 0 0.5 0.98 0.5
Tristimulus Theory (cont) s many target color lights cannot be matched x what if we add red light to the target light? C + rR = gG + bB this works! x mathematically same as adding a negative amount of red light C = -rR + gG + bB s picture of color-matchin
Structure of the Eye (cont) s fovea x very small region of the retina with the densest collection of cone cells (147,000 cones/mm) some hawks have 1,000,000 cells in the same area (can see a small animal at a distance where a human could not even see the
Appearance of Objects s object appearance depends on three factors: x lighting x material properties x viewer properties s for the most part, graphics techniques do not account for the properties of the viewer x example: for the synthetic camera, properti
Putting It All Together s the total reflected intensity is Itotal = Iamb + Idiff + Ispec = Ia *a + Is *d*lambert + Is *s*phongf
s
Hill writes Itotal a little differently Itotal = Ia *a + Id *d*lambert + Isp *s*phongf is the diffuse intensity of the light
Reflected Specular Intensity s specular intensity models shininess x results in highlights s most of incident intensity reflected in mirror direction x but some is reflected around the mirror direction s Phong approximation is pure hack x reflected intens
Reflected Ambient Intensity (cont) s assume ambient intensity is constant s depends on: x amount of ambient illumination Ia property of light source x material property a property of object called ambient reflection coefficient s a is fraction of ambient
BRDF s the BRDF is often written as R ( , i , i , v , v ) x is the wavelength (hue) of incident light x (i, i) defines the direction to the light source L x (v, v) defines the direction to the viewer V s the BRDF tells us about the ratio of the incoming a
Other Affine Transformations
s s
notice that no shear function must specify all 16 values of transformation matrix for "custom" transformations x OpenGL requires an array with the 16 elements specified like so: m0 m4 m8 m12 m m m m 5 9 13 1 m2 m6 m10 m14
Composition or Concatenation of Transformations
I I I
rare to perform only one elementary transformation composition of affine transformations is also affine order transformations are applied in matters N matrix multiplication does not commute N example:
Applying Translation
I
translation leaves vectors unchanged H T v = [x y z 0]
1 H 0 Tv = 0 0
0 1 0 0
0 tx x x 0 t y y y = 1 tz z z 0 1 0 0 z 1]
T
I
translation moves points by a vector amount P = [x
1 0 TP = 0 0
y 0 1 0 0
0 tx x x + tx 0 t y y y + t y =
Determinant
I I
determinant of a matrix is a scalar value usually only need 2x2 and 3x3 matrix determinants N the determinant of M is |M|
m00 M = m10 m20 = m00
m01 m11 m21 m11 m21
m02 m12 m22 m12 m - m01 10 m22 m20 m12 m + m02 10 m22 m20 m11 m21
= m00 m11
Homogeneous Representation (cont)
I
I
to go from ordinary to homogeneous coordinates N if the object is a point, append a 1 N if the object is a vector, append a 0 to go from homogeneous to ordinary coordinates N if the object is a point, delete the 1 thi
Polygonal Meshes: Shared Vertex Data Structure (cont)
s
vertex list (V vertices) vertex 0 1 . V-1 coordinates x0, y0, z0 x1, y1, z1 xV-1, yV-1, zV-1
s
normal list (N normal vectors) normal vector 0 1 . N-1 coordinates nx0, ny0, nz0 nx1, ny1, nz1 nxN-1, ny
Polygonal Meshes
s
many algorithms assume triangular meshes x hardware support x always convex x always planar polygon normal vector easy to compute
H N = ( P - P0 ) ( P2 - P0 ) 1 H H N n= H N
23
Polygonal Meshes: Per Vertex Normal Vectors
s
a mesh usuall
Representation of Object Surfaces
s
most common representation of objects is polygonal mesh/net x collection of polygons that approximate the outer surface or skin of the object
13
Representation of Object Surfaces
s
s
modern hardware capable of rendering
Basis
I I
I
in R3 a basis is a set of 3 non-parallel vectors common to use orthonormal basis N basis vectors are mutually orthogonal N basis vectors have unit magnitude basis most students are familiar with H T i = [1 0 0] H T j = [0 1 0] H T k = [0 0 1]
Rasterizer Stage (cont)
I I
I
implemented in hardware performs: N hidden surface removal N texturing N compositing N stenciling N accumulation output is image on screen
Summary
I
I
I
application stage N what to draw and how to draw it geometry stage N com
CISC454B: Computer Graphics
I
I
computer graphics is concerned with producing pictures with a computer N this is a very broad definition. we are interested in three-dimensional computer graphics N topics: rendering pipeline mathematical foundations repres
CSE4431: Lab 3
Burton Ma Mon 30 Jan, 2012
1
Introduction
In this lab you will implement simple texture mapping (replace, modulate, and specular preserving), multiple texture mapping, gloss mapping, and bump mapping.
2
Files
Copy the files from the directo
CSE4431: Lab 2
Burton Ma Mon 23 Jan, 2012
1
Introduction
In this lab you will implement the ambient-diffuse-specular (ADS) illumination model using both the reflection direction and halfway vector formulations in both the vertex shader and the fragment sh
CSE4431: Lab 1
Burton Ma Mon 16 Jan, 2012
1
Introduction
In the first part of this lab you will modify a small GLUT program to retrieve the modelling transformation of the modelview transformation. This should be a useful review of simple OpenGL and GLUT
Procedural Textures
Noise in glman
glman automatically creates 2D and 3D textures (with default sizes 64x64 and 64x64x64) named
Noise2 Noise3
stores 4 octaves, 1 each in the R, G, B, A components
Noise in glman
Component 0 1 2 3
Term nv.r nv.g nv.b nv.a
Procedural Textures
Primitives
glsl has some built-in functions that can be used to generate simple textures
float f = step(a, x); 1 f
0 a
returns 0.0 if x < a, 1.0 otherwise
Primitives
float f = smoothstep(a, b, x); 1 f
0 a b
Primitives
a pulse can be fo
Texture Mapping Applications 2
Parallax Mapping with Slope
parallax mapping assumes that the surface is a single plane a better approximation
surface is locally planar where the plane normal is given by the normal vector from the normal map
Parallax Mappi
Texture Mapping Applications
Bump Mapping
a family of techniques for representing small-scale detail
better than ordinary texture mapping but usually less realistic than actual geometry
implemented in the fragment shader
idea: adjust shading parameters so
Texture Mapping
Texturing
process that modifies the appearance of each point on a surface using an image or function
any aspect of appearance can be modified
color, material properties, normal vector, location, .
multiple textures can be applied to the sa
Advanced Illumination Models Chapter 7 of "RealTime Rendering, 3rd Edition"
Fresnel Reflectance
Fresnel Reflectance
the surface of an object can be thought of as being an interface between air and the object material the interaction of light at a planar i
Day 06 Vertex Shader for AmbientDiffuse Specular Lighting
Ambient Reflection
ambient light reflected by an object depends on the incident light intensity and the material ambient reflection coefficient
ambientr,g,b = lightr,g,b * ambreflcoeffr,g,b
Ambient