old news old news reminder for h4
play

Old News Old News Reminder for H4 CPSC 314 Computer Graphics - PowerPoint PPT Presentation

University of British Columbia Old News Old News Reminder for H4 CPSC 314 Computer Graphics extra TA office hours in lab for hw/project project 4 grading slots signup For any answer involving calculation, Jan-Apr 2007 Q&A


  1. University of British Columbia Old News Old News Reminder for H4 CPSC 314 Computer Graphics • extra TA office hours in lab for hw/project • project 4 grading slots signup • For any answer involving calculation, Jan-Apr 2007 Q&A although it's fine to show your work in • Wed Apr 18 10-12 analytical form, the final answer should be Tamara Munzner • next week: Thu 4-6, Fri 10-2 • Wed Apr 18 4-6 expressed as a number to two decimal • last week of classes: • Fri Apr 20 10-1 places. Curves • Mon 2-5, Tue 4-6, Wed 2-4, Thu 4-6, Fri 9-6 • final review Q&A session Week 12, Wed Apr 4 • Mon Apr 16 10-12 • reminder: no lecture/labs Fri 4/6, Mon 4/9 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007 2 3 4 News Review: Compositing Correction/Review: Premultiplying Colors Review: Rendering Pipeline • specify opacity with alpha channel: (r,g,b, α ) • so far rendering pipeline as a specific set of stages • regraded homeworks/exams handed back • α =1: opaque, α =.5: translucent, α =0: transparent with fixed functionality • midterm handed back (scores are scaled) • A over B • modern graphics hardware more flexible • C = α A + (1- α ) B • programmable “vertex shaders” replace several geometry processing stages • but what if B is also partially transparent ? Midterm 2 Scaled Grades • C = α A + (1- α ) β B = β B + α A + β B - α β B • programmable “fragment/pixel shaders” replace 14 • γ = β + (1- β ) α = β + α – αβ texture mapping stage • 3 multiplies, different equations for alpha vs. RGB 12 • hardware with these features now called Graphics 10 • premultiplying by alpha Processing Unit (GPU) 8 • C’ = γ C, B’ = β B, A’ = α A • program shading hardware with assembly language 6 • C’ = B’ + A’ - α B’ analog, or high level shading language 4 • γ = β + α – αβ 2 • 1 multiply to find C, same equations for alpha and RGB 0 F:0-49 D:50-54 C:55-67 B:68-79 A:80-89 A+:90-100 5 6 7 8 Review: Vertex Shaders Review: Skinning Vertex Shader Review: Fragment Shaders Review: GPGPU Programming • replace model/view transformation, lighting, • arm example: • fragment shaders operate on fragments in place of • General Purpose GPU perspective projection texturing hardware • M1: matrix for upper arm • use graphics card as SIMD parallel processor • a little assembly-style program is executed on every • after rasterization • M2: matrix for lower arm • textures as arrays individual vertex independently • before any fragment tests or blending • it sees: • computation: render large quadrilateral • input: fragment, with screen position, depth, color, Upper arm: Upper arm: • vertex attributes that change per vertex: and set of texture coordinates • multiple rendering passes weight for M1=1 weight for M1=1 • position, color, texture coordinates… weight for M2=0 weight for M2=0 • access to textures, some constant data, registers Lower arm: Lower arm: • registers that are constant for all vertices (changes • compute RGBA values for fragment, and depth weight for M1=0 weight for M1=0 are expensive): weight for M2=1 weight for M2=1 • can also kill a fragment (throw it away) • matrices, light position and color, … • temporary registers Transition zone: Transition zone: • output registers for position, color, tex coords… weight for M1 between 0..1 weight for M1 between 0..1 weight for M2 between 0..1 weight for M2 between 0..1 9 10 11 12 Reading Parametric Curves Splines • FCG Chap 13 Curves • parametric form for a line: • a spline is a parametric curve defined by control points x x t ( 1 t ) x = + − 0 1 • term “spline” dates from engineering drawing, y y t ( 1 t ) y = + − 0 1 where a spline was a piece of flexible wood Curves z z t ( 1 t ) z = + − 0 1 used to draw smooth curves • x, y and z are each given by an equation that involves: • control points are adjusted by the user to • parameter t control shape of curve • some user specified control points, x 0 and x 1 • this is an example of a parametric curve 13 14 15 16

  2. Splines - History Hermite Spline Basis Functions Sample Hermite Curves • draftsman used ‘ducks’ and • a point on a Hermite curve is obtained by multiplying each • hermite spline is curve for which user control point by some function and summing strips of wood (splines) to • functions are called basis functions draw curves provides: • wood splines have second- • endpoints of curve order continuity, pass • parametric derivatives of curve at endpoints through the control points 1.2 a duck (weight) • parametric derivatives are dx/dt, dy/dt, dz/dt 1 0.8 x1 0.6 x0 • more derivatives would be required for higher 0.4 x'1 x'0 0.2 order curves 0 -0.2 -0.4 ducks trace out curve 17 18 19 20 Bézier Curves Bézier Curves Bézier Blending Functions Bézier Blending Functions • similar to Hermite, but more intuitive • look at blending functions definition of endpoint derivatives • derivative values of Bezier curve at knots • every point on curve is linear dependent on adjacent points combination of control points • four control points, two of which are knots • family of polynomials called • weights of combination are all order-3 Bernstein polynomials positive • C(3, k) t k (1-t) 3-k ; 0<= k <= 3 • sum of weights is 1 • all positive in interval [0,1] • therefore, curve is a convex • sum is equal to 1 combination of the control points 21 22 23 24 Bézier Curves Bézier Curves Comparing Hermite and Bézier Rendering Bezier Curves: Simple • interpolate between first, last control points Bézier Hermite • curve will always remain within convex hull • evaluate curve at fixed set of parameter values, join • 1 st point’s tangent along line joining 1 st , 2 nd pts 1.2 1.2 points with straight lines (bounding region) defined by control points 1 1 • 4 th point’s tangent along line joining 3 rd , 4 th pts • advantage: very simple 0.8 0.8 B0 x1 0.6 B1 x0 0.6 • disadvantages: 0.4 B2 x'1 B3 0.2 x'0 0.4 • expensive to evaluate the curve at many points 0 0.2 • no easy way of knowing how fine to sample points, -0.2 0 -0.4 and maybe sampling rate must be different along curve • no easy way to adapt: hard to measure deviation of line segment from exact curve 25 26 27 28 Rendering Beziers: Subdivision Sub-Dividing Bezier Curves Sub-Dividing Bezier Curves Sub-Dividing Bezier Curves • step 1: find the midpoints of the lines joining • step 2: find the midpoints of the lines joining • step 3: find the midpoint of the line joining • a cubic Bezier curve can be broken into two the original control vertices. call them M 01 , M 01 , M 12 and M 12 , M 23 . call them M 012 , M 123 M 012 , M 123 . call it M 0123 shorter cubic Bezier curves that exactly cover M 12 , M 23 original curve • suggests a rendering algorithm: M 12 M 12 M 12 P 1 P 1 P 1 P 2 P 2 P 2 • keep breaking curve into sub-curves M 012 M 012 M 0123 M 123 M 123 • stop when control points of each sub-curve M 01 are nearly collinear M 01 M 01 M 23 M 23 M 23 • draw the control polygon: polygon formed by control points P 0 P 0 P 0 P 3 P 3 P 3 29 30 31 32

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend