+ Devices - Calligraphic Devices I Line Drawing CRT * To draw a line, sweep the beam from A to B * Pen plotter, laserbeam deflector, direct view storage tube CRT - Raster Device I Color frame Buffer * Array of light bulbs, LCD, plasma panel, ink jet printer, electroluminenscentdisplay * Active: emit light source, passive: reflectance * To draw a line, turn on a select set of matrix element * Bit planes -> color map -> color CRT + Line Drawing Algorithm - Sampling at pixel center - Area projection, pixels equal to (length * width of the line) - Turn on pixel touch by line (x + y) - Bresenham Algorithm max(x, y) - DDA Yk+l = Yk + I, Xk+l = round(Xk + 11m) max(x, y) + Interpolation - p(t) = A + t(B-A) + s(C-A) - p(t) = (a/t)A + (b/t)B + (c/t)C - L(t) = A + t(B-A) * Perspective image line proof P(t) = (l-t)*A+T*B P'(t) = TP(t) = T[(I-t)*A + t*B] P'(t) = (l-t)*A' + t*B' # line stays straight under perspective projection, but the rate of t is no longer uniform # Lines are simply following the endpoints as if they were rubber bands and because of linearity of the transform, the right things are happening + Color - Index Color * Can have up to 2"k color on the screen at one time. Where k is the depth of the frame buffer * 2"k indexes to map 2"(3m) where m is the accuracy for one color * Less memory - RGB * Commonly have 24 bits (8 bits for each), may have alpha component (transparency) + Input Device - Physical input device * keyboard, lighten, mouse, trackball, joystick, space ball, data glove, polhemus magnetic wand - Logical input device * Measure, describe the value, trigger signal event * String Locator, Pick, Choice Dial, Stroke - Input mode * Request mode (request trigger measure) * Sampling mode (polling) * Event mode (event queue) - Interaction task * Make selection, set value, pick location, and enter text, trigger, and velocity + Coordinate System - Master Space (object space) - World Space (world, hierarchy of objects) - Camera Space (vrc, clip, cull) - Image space, 2d projection - Normalized Device Coord (unit square for manipulation, device independence) - Screen Space (vp) + Modeling - Voxels Octree, quadtree, octtree, brain scan, sponge - CSG, Boolean set operation, Swiss chess, pipe assemblies, mechanical parts - B-rep winged edge data structure, describe polygon via vertices, edges, faces, polyhedral with odd angles, tessellate surface approximate smooth surface - Procedural modeling, iterated object, gear wheels, fractal mountains, trees, geometric sculpture - Sweep pipes, sausages, rotationally symmetrical - Instantiation hierarchy, reuse parts several times by making copies, complicated scenes + Essence of scene hierarchies - Don't care about individual parts, when moving the parent - Functional dependencies - Reuse + Homogenizing Coord - Rigid body transform (rotate translate) - Affine (scaling shear) + Row Vectors Column Vectors - column vector Ew = TOutside TInside Ee - row vector Ew = Ee TInside TOutside + Advantage of bounding box - Size estimates - LOD representation - Culling - Collision detection - Clipping - Best fit, axis aligned, circles - Every rotation, axis aligned box may grow + Rotation around an arbitrary point - Translate to origin, do rotation, translates back to old plact + Window to viewpoint transform - Scale the image by the min of the two ratio min(XWorld/XVp, YWorld/YVp) + Synthesizing shear transform - Put diagonal of parallelogram on x axis, scale y to get right angle, rotate back to axial position, scale to original, do all these in reverse + Communatativity - TT, SS RR RuS (communte) - TR, TS, R, nuS (non commute) - Rotation around z commute with rnZ, uS, rZ (not tX, rX, mY, nuS, tZ) + OA->B - a is a children of B, B is a children of C - to have A in C coord, you go up Ac = AaOa->bOb->c (in row vector) + DOF - rectangle 3d:8, planes 3d:3, infinite line 3d:4 - hemisphere in 3d:6, line segment 2d:4, infinite line 2d:2, sphere 3d:4, - rectangle2d(S), parallegram 2d:6, triangle 2d:6 - half circle 2d:4, brick 3d:9, cylinder 3d:7, infinite cylinder 3d:5 + Clipping - get rid of stuff outside view - bbox above any dynamci node need to be reconstructed in every frame - Cohen-Sutherland * trival accept, if both code = 0 * trival reject, if one bit in common, use AND operation * otherwise, clip one edge at a time * we want to make it such that -w<=x<=w, -w<=y<=w, -w<=z<=O * 1001 1000 1010 000100000010 0101 0100 0110 - Lian Barsky * calculate all the t value at each bound intersect * reject those that is x > 1 or x < 0 * determine if they are entering/exiting on remaing intersect * draw line between max of entering, min of exiting, if max < min, don't draw anything - Sutherland-Hodgman * clip one edge at a time + Martin Newell's - plan normal component has the same realtion as the shadow area - n = [norm, d] = [a, b, c, d] where d = -tanspose(norm) * p mean + Backface Elimination - don't waste effort to render back face - if scalar pordut between face normal and viewing direction is position - should be counter clock wise in order for us to see it + Transform (COLUMN vectors..) - Rigid body, change fo bases, tranlsate translate Rotation Z I 0 0 0 cos(a) sin(a) 0 0 0 I 0 0 -sin(a) cos(a) 0 0 0 0 I 0 0 0 1 0 tx ty tz I 0 0 0 I - mirror on X(yz plane) S(-X, I, I) - shear XZ [x y z I] -> [x+sh*y, y, z+sh*y, I] - it means shear on XZ plane, with y unchange Shear YZ Shear XY Shear XZ I shy shz 0 I 0 0 0 1 0 0 0 0 I 0 0 0 1 0 0 shx l shz O 0 0 1 0 shx shy l O 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 - change of basis (coor B -> coor A), d = B's basis vector in A coord dx dy dz O dx dy dz 0 dx dy dz 0 ox oy oz l - Rotation as Three Shears Rz(a) = SHxz(shx = -tans(a/2), shz = 0) * SHyz(shy = sin(a), shz = 0) * SHxz(shx = -tan( -a/2), shz = 0) - Shear as Scale Roate Scale Rotate I shx O O 0 1 0 0 0 0 1 0 0 0 0 1 a = atan(I/(I+shx)) s = sqrt«I+shx) * (s+shx + shx"2)) b = atan(sqrt«I+shx + shx"2}'(I+shx))) sx = sqrt(I/(I+shx)) sy = sqrt(I/(I+shx+shx"2)) Shearx along y = S(sx, sy, I) * Rz(-b) * S(I, s, I) * Rz(a) + Ridrugyes Formula - Rotation about a arbitary axis with angle b - Q = E"Ab, where A = 0 -az -ay az O -ax -ay ax 0 + Lookat - just Quvn->xyz, where u = upXn / |upXn|, v = nXu, n = (c - vrp) / |c -vrp| + Transform plane - norm = norm * inverse(transpose(Transform)) - transform noral, since we just care about the orientation, we don't need the d. to tranfrom normal, we do the same trick, but this time, we need to know the Det(transform) to figure out the sign. If Det is positive, norm = [a b c]. else -[a b c] + Pipeline - obj > vrc > proj > vp - bounding box culling in projection space - back face culling in proj space - light caluclation in light space - clipping in porj space - proj > bp - homogenize - z buffering and shading + Camera Projection - parallel, * shear xy with ym = (yrnin + ymax) 12, xm = (xmin + xmax) 12, * T(0, 0, -zmax), * S(I/(diffx, diffy, diffz) - perspective, * shear xy with xm, ym, * S(I/xidff, I/ydiff, I), S(-I/zmin), * a = -zmax/zmin, perspective transfrom, map (x,y,z,I) -> (x, y, (z-zmin)/(1 +zmin), -I) * change front plane (zmax) back plane (zmin) => front plane (-a = zrnax/zmin), back plane -I * map eyes to inifnity, F to xy plane, B to n = -I * rays throguth eye become paralle, paralle line converge to vanishing point 1 0 0 0 0 1 0 0 0 0 1/(I+a) -a(l+a) 0 0 -I 0 * size of image depends on distance between camera and orginal * COP=O VP=O 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 l/d 0 0 0 1 d + Vanishing point - rays parallel to imageing planes do not have vanishing points - octahedron has 6 parallel edges, can have 6 vanishing points, 6 point perspective - miniurn number of points when one of triangular faes lies parallel - icosahdron (20 triangles) 15 pairs of parallel edges, 15 vanishing points, 12 is the minium - vanishging plane are the lines form when you have two parallel planes - you can have a vertical vanishing line + Stero Picture - e = 0.5 * eye seperation / comfortable distance - left frustum (e, -vpH, -100) (vpW+e, vpH, -0.1) - right frustum (-vpW-e, vpH, -100) (-e, vpH, -0.1) + Winding number - up -I, down +1 - define the inside of a polygon by the non-zero winding number test. - We "turn on" all the pixels that have a lower left corner that falls inside the polygon contour. - When a pixel fall on the edge of the polygona, we sample points falling on such edges also get turned on with the polygon color. - 180 < x <= 360 are said to be inside (+1) - Finally, if a vertex falls on a sampling point and is shared by many adjoining but not overlapping polygons, then that pixels gets assigned to the polygon that "owns" the region immediately to the right of that point (i.e., in the +x direction). + Scan line algorithm - Create a list of all of the edges in the polygon, sorted by the y-coordinate of their lower ends. This is the edge list - Start at the lower y-coordinate of the viewport. Create an empty list of edges, called the active edge list (AEL). - For each scanline: - Move all edges that begin at or before the current scan line from the edge list to the active edge list. (ymin <= yscan) - Remove all edges that end at or before the current scan line from the active edge list. (yrnax <= yscan) - Initialize or update the x-intercept values and other changing values for the edges in the active edge list. - Sort the active edge list by the x-intercept value with the current scan line. - Color all pixels that are "interior" to the polygon within the current scan line according to the current fill rule. (ceil(xleft) <= x <= ceil(xright)-I) + Lighting - L: vector point from point to light - N: surface normal, V: point to eye, - R: 2(N.L)N - L - ambient light (sky), dierctional light (sun), point light (candle), spot light (stage light) - light paraemters: color, deaddistance, falloff, angularfalloff - surface parameters: color, refleactivity, exponent, metallic - diffuse compoentn, how much L in N direction - specular compoenent, how much R in V direction Idir = Kdiff (N.L) CdiffClight + Kspec(R. V)"Nphong Cspec Ipoint = [Kdiff (N .L) CdiffClight + Kspec (R. V)"Nphong Cspec] / (dO + d) n1 + Lambert surface - flat surface will be uniformly lit - some precentage get reemiteed within some broad distribution - light absortpion fall of with consine of angle between light and normal - when you title a plane, you see more of spot, this is 1/cos(theta) - therefore, brighness is viewer independnet - can be precalucalted once at startup - percentage reemitted depends on surface properties + Metallic property - Cspec = mCDiffClight + (l-m)Clight - The more metallic, the more its surface color - m = 1, surface color same as color for the surface - m = 0, surface color same as color for the light + Phong Model - Surface ahs diffuse and specular property - clube shape around R, falls off with a consine of deviation angle from ideal R direction - sharp club if exponent is big (-10), fat one if small (-2) - even non unifrom brightness can produce hightlight, if surface is partally refective + Brighness Normalization - clip to unit or dectect, scale down on object or whole scene I + Real surface - spreading of light depend on incident angle, different wavelength get absorded, reflected, refracted 1 + Shading - unifrom, lambert + flat surface + uniform illumination ; - just take centroid of suface, apply brightness to all pixels I + Gouraud Shading - non uniform (point light, spot light close to surface, curved surface with incident angle) - interpolate color from comers in scan line algortihm - polyhedral approximation to round object - limitation: concave comers, missing highlights + Phong Shading - Interpolated normals compute brightness from normal at each pixel - limitation, geometry that is not seen from vertices can not be lighten properly, concave comers + Hidden feature removal - ray casting, cause rays from eye to each pixel to see which get hit - painter algorithm, depth sort, paint from back to front, problem when cycle, need to break it apart - horizon line, paint slices through front to back, only new element draw above - z buffer, store depth in z buffer, paint only if greater ., + Object Generation - sweep generator * linear sweep, prismatic shapes, columns * rotational, chess figure, wind glass, tear drop, torus t * piecewise linear curves sweep, mitred prism * ribbons, sculpture, camera motion in movie - object modification * project faces into sphere->domes, fractnal, random triangluar mesh->mountains - procedual assembly (instantiation) * gear wheel (iterative placement) * sierpinksy pyramid, menger sponge (recursive replacement) + Splines - trying to minimie ovreal bening energy - position constraits and tangent constriants + Degree of smoothness - gometic continutiy, targent cont, curvature cont - GO:connected;G I :same targent;G2:same tanget, curvature - parametric continucity, disp, velocity, accerlation - CO:connected;Cl :same velocity vector;C2:same velocity, acceleration + Interpolating slines - passes throUght all data points, Hermite spines + Approximate splines - only corne close to the point, Bspines + Propretis of Bezier curve - cubic polynomia, true space curves - interpolate end points - approximate two control points (1/3 starting velocity) - tangent defined by two control points - convex hull property - invariant under affine transform - start to end symmetry - infintely differentialbe - may have loop, cusps - infinite differentiable -> C"n continucity - cubic -> four control points, three indexes, end points are aaa, bbb - speical type of bspines + Bezier Patch - defined bezier curve in one direction - on those curves (not control points), defined your new control points in the other direction + Construcction - to ensure Gl, need to make sure that two control points for the two surfaces have to be in same line. - to ensure Cl, ned to be equal distance - to ensure G2, need to ensure that they have the same accleration. we can force this by having three points of each curve on a straight line - de castelijau, continue to split in the middle, when you cannot split anymore, then that is your point t = 0.5. do it with other t value - to approximate a smooth curv with a bezie * make curve points about evry queater term * draw tangent line * draw a fake line between pi and p4. cut it into 1/3 from both end * use that point to find p2 and p3 on your tangent line * yield Gl * if you make velocity equal, you get Cl + Cases - A curve is Gland not Cl. just two straight lines, but have different velocity - A curve is Cl and not Gl. two evenly spaced lines meet together and form a V shaped - CO=GO - A bspinelbezier curve that is C2 but not Gl, a cusps, or serveral points stack together + Blossoming - cubic has three indexes (four points) - when all values are equal, it is a point on the cuvrves. - the digit that is different gives you the tick mark. - generalise bezier and bpsines. you can converted between them - decasteljau is a specail case of blossoming - only defined when all nth curves overlap - does not matter what the order is, just sort it + Bspines - picewise cubic polynomial (4th order) - does not interploate contro points - convex hull property - need to have 4 basis function to be defined - invariant affine transformation - start to end symmetry - twice differentaiblee at joints (c2) when put togehter - infinitely differentaible evrytwhere - may have ecusps, thus may not be G2 everywhere + Stacking Bspines - if we resuse the last three control points, wec can get C2 j for free - the point at t = 0 is defined by A/6 + 4B/6 + C/6 - the point at t = 1 is defined by B/6 + 4C/6 + D/6 i + Antialising - different spectual frequency humps produced by sampling. must not overlap - if sampling is lower, mean repeition in frequency domain move closer - overlap humps, -> image distoration - neccessary sampling density is defined by nyquist limit, which is at least twice as high as the highest spatail frequency present - over sampling and combining samples with weights - if we cannot increase sampling density, we can have a lowpass filter the input. This cut frequency response, humps do not overlap + Texture Mapping - Texture resolution not low enough compare to screen resolution - perspective projection is nonlinear operation, patten would appear warped + Ray Casting - shoot rays from eye thrOUgth all pixels of the scrrent into the scen - what rays does this intersect - determine first interaction and color of the pixel should be assignd - send rays from this point to all light source to chck visibility - hidden feature elimination method, like sweep line - image space algorthm - parallel execution of multiprocessor - no clipping + Ray Tracing - send rays into transpaent material, reflect from mirror - image space ] - Geometric model - camera placement - ray casting, visiblity calculation, rasterization - light source probing + Radiosity - object space - geometric model - global illumination (become part of the scene) - camera projection - visilbity calcnation - Rasterization - Display - assum all surface are perfectly diffsue reflectos - apparent brightness of surface is independent of viewer position - break large polygon to patches, assigned color and render the scene from any viewpoint - form factors are used to calculate amount of diffuse illumination that passed from one patch to another - describe how well this patches can see each other - first consider only the light directly emitted by active light sources - then add light from only a single refleciton on any surface from the light - until whole room is stable + Data Structure - use: front to back -ray tracing, back to end -painter algortihm, collision detection, path planning - Regular Grid - Octree, regular, adaptive - kd tree, split box along lonst axis near median, good for in door scene and floor plan - BSP, generaliation for scene with non axis aligned polygons + 3D Space - RGB has 3 intensity value for dispaly on CRT - 6 sided pyramid, HSV - HLS, double hex cone, white black at tip and saturated color on rim at height of 0.5 - Physical Colors, continuosu specturm, infitnite dimension - Percpetual Color, human visula system most sensitive to green, blue the least. - metamers are color that look the same, but different specturm. - add light by superposed color light beam, subtract light by reflecting light from object + Color Wheel - Pigment Wheel: Red, Orange, Yellow, Green, Blue, Purple - Opposite of Pigment Wheel is complementary color - RGB: red, yellow, green, cyan, blue, magenta - Additive Color: Red + Green = Yellow, Green + Blue = Cyan - Subtractive Color: White + Green filter = Magenta subtracted out, White + Cyan filter + Magenta filter: Blue 1 + Grassman law - perceptual space is 3D - metamer add to yield metamers - As physical color is varied continuously, percptual color also varies continuously + CIE ! - a set of basis vector that completely lie outside the range of all visible RGB vlalues - so that the color matching weights for any visible hue become entirely positive - the y(lambda) is defined as luminousity efficiency of human eye which is used as intensity channel. - transfrom RGB matching fucntion to CIE matching fucntion is a linear transform - CIE chromaticity diagram by cutting the plane with x+y+z=1 and project this to xy plane, - color near the center is the white spot. - color lying oopposite of this white spot is called complementary colors - in a tri stimulus 3 color display system that shoot IJK primitive, we would like to make the triangle as big as possible - CRT monitor's primitives is limited by color of phosphor - half of all the colors we can see + Human Visual System - Eyes has three kinds of sensors blue (440), yellow-green (545), orange (580) - tri stimuls theory of color perception, colors can by synthesized from weighted sums of primary colors - some blue green components need a negative wieghted red + Transparency - the freaction of light passes thrognth a surface or body - this fraction is indicated by transmision coefficient kt - opactiy indicate what fraction is held back. kt + a = 1 + Alpha Channel - a forthc channel, alpha, is added to color in addition to RGB - alpha blending, linear combination of contents already in memory based on alpha and RGB value - describe how much RGB value are written to frame buffer - Cout = Csrc * Asrc + (I -Asrc) * Cdst - for this to work, need to render from back to front. + Other Transparnecy implementation - Interpolated Transparency * we have m image, so paint each color as Cr/M and add it all up - Screen Door Transparency * only render a subse of pixels associate with the transparent object * can produce Moire effects - Statistical Sampling * depending on the ratio of t/a, fraction of photons are terminated in foreground or backtround. + Trends in CG - statistical sampling in ray cast. sampling density is addptiave to local spatial frequencies, or the importantce of the sampled feature. - sampling rays can be ad jested to reduce aliasing efefect and achieve motion blur - sample data, voxel (MRI data, 3D scans) - particle system, fire, smoke, fluids, - dyanmic deformed (bending, bouncing) - finite element system, streess, crack propagation, fluid dynamics (shock wave) - fire, smoke, clusd, water, mud, clothes, silk, human skin, faces + Questions - Normalized Device give us device independence Lecture 2 - the affine stuff LOOK UP - read up on affine - On lecture 12, it says for lanar facets, the same thing holds, but their normal vector need extra care - Qwarp<-norm = SHz(-1) * Sz(-zfrontl(1+zfront)) * SHw(-1) * SHz(1) - clipping in 4d - planar geometic projection - give one advantage and disadvant of clipping in homo coord DO NOT FORGET THOSE COLOR FIGURES 9) String, Locator, Dial flO) start to end symmetry, invariant under affine transform 14) Grassman Law 15) Radiosity -I) should knowhow to draw bezier curve. start over with the targent. find the half point -2) know how to put bezier curves together -3) know how to use decasteljau algortihrn subdivision surface color beam shine on color surface, what is beign reflected, what is being refracted 8) why does the consine cancel out? II) acheive curvature with multiple bezier curve 12) case that bezier curve is CI but not GI This bi-linear interpolation of color (and brightness) differs somewhat from the interpolation of z-depth --which we assumed to be a planar function. The shading/illumination function is NOT typically planar ! I) (Why we are using a half-cube, rather than a full cube will become clear when we do perspective). oblique projection because more math need to be done in the prespective transfrom - the vanishign point, vanishing line of lecture 14 - where should the crystal transform go? - difference between rigid body transform and affine plane dof in n space? 3n -6 a line in n dimenstion sapce has dof of 2n - 2