cs559: computer graphics lecture 36: animation li zhang spring 2008 slides from brian curless at u...

Download CS559: Computer Graphics Lecture 36: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington

If you can't read please download the document

Upload: erika-lewis

Post on 13-Dec-2015

214 views

Category:

Documents


2 download

TRANSCRIPT

  • Slide 1

CS559: Computer Graphics Lecture 36: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington Slide 2 Today Particle Systems, Cartoon animation, ray tracing Reading (Optional) John Lasseter. Principles of traditional animation applied to 3D computer animation. Proceedings of SIGGRAPH (Computer Graphics) 21(4): 35-44, July 1987. http://portal.acm.org/citation.cfm?id=37407 (Optional) WILLIAM T. REEVES, ACM Transactions on Graphics, Vol. 2, No. 2, April 1983 http://portal.acm.org/citation.cfm?id=357320 Slide 3 Particle system diff. eq. solver We can solve the evolution of a particle system again using the Euler method: void EulerStep(ParticleSystem p, float DeltaT){ ParticleDeriv(p,temp1); /* get deriv */ ScaleVector(temp1,DeltaT) /* scale it */ ParticleGetState(p,temp2); /* get state */ AddVectors(temp1,temp2,temp2); /* add -> temp2 */ ParticleSetState(p,temp2); /* update state */ p->t += DeltaT; /* update time */ } void EulerStep(ParticleSystem p, float DeltaT){ ParticleDeriv(p,temp1); /* get deriv */ ScaleVector(temp1,DeltaT) /* scale it */ ParticleGetState(p,temp2); /* get state */ AddVectors(temp1,temp2,temp2); /* add -> temp2 */ ParticleSetState(p,temp2); /* update state */ p->t += DeltaT; /* update time */ } Slide 4 Bouncing off the walls Handling collisions is a useful add-on for a particle simulator. For now, well just consider simple point-plane collisions. A plane is fully specified by any point P on the plane and its normal N. N P v x Slide 5 Collision Detection How do you decide when youve made exact contact with the plane? N P v x Slide 6 Normal and tangential velocity To compute the collision response, we need to consider the normal and tangential components of a particles velocity. N P v x v Slide 7 Collision Response before after vv The response to collision is then to immediately replace the current velocity with a new velocity: The particle will then move according to this velocity in the next timestep. v Slide 8 Collision without contact In general, we dont sample moments in time when particles are in exact contact with the surface. There are a variety of ways to deal with this problem. A simple alternative is to determine if a collision must have occurred in the past, and then pretend that youre currently in exact contact. Slide 9 Very simple collision response How do you decide when youve had a collision? A problem with this approach is that particles will disappear under the surface. Also, the response may not be enough to bring a particle to the other side of a wall. N P v1v1 x1x1 x2x2 x3x3 v2v2 v3v3 Slide 10 More complicated collision response Another solution is to modify the update scheme to: detect the future time and point of collision reflect the particle within the time-step N P v x Slide 11 Generate Particles Particle Attributes initial position, initial velocity (both speed and direction), initial size, initial color, initial transparency, shape, lifetime. WILLIAM T. REEVES, ACM Transactions on Graphics, Vol. 2, No. 2, April 1983 Slide 12 Generate Particles Particle Attributes initial position, initial velocity (both speed and direction), initial size, initial color, initial transparency, shape, lifetime. WILLIAM T. REEVES, ACM Transactions on Graphics, Vol. 2, No. 2, April 1983 Slide 13 Generate Particles Particle Attributes initial position, initial velocity (both speed and direction), initial size, initial color, initial transparency, shape, lifetime. WILLIAM T. REEVES, ACM Transactions on Graphics, Vol. 2, No. 2, April 1983 Slide 14 Generate Particles Initial Particle Distribution Particle hierarchy, for example Skyrocket : firework Clouds : water drops Slide 15 Throwing a ball from a robot arm Lets say we had our robot arm example and we wanted to launch particles from its tip. How would we calculate initial speed? Q=R(theta)*T1*R(phi)*T2*R(psi)*P We want dQ/dt Slide 16 Principles of Animation John Lasseter. Principles of traditional animation applied to 3D computer animation. Proceedings of SIGGRAPH (Computer Graphics) 21(4): 35-44, July 1987. Goal : make characters that move in a convincing way to communicate personality and mood. Walt Disney developed a number of principles. ~1930 Computer graphics animators have adapted them to 3D animation. Slide 17 Principles of Animation The following are a set of principles to keep in mind: 1. Squash and stretch 2. Staging 3. Timing 4. Anticipation 5. Follow through 6. Secondary action 7. Straight-ahead vs. pose-to-pose vs. blocking 8. Arcs 9. Slow in, slow out 10. Exaggeration 11. Appeal Slide 18 Squash and stretch Squash: flatten an object or character by pressure or by its own power. Stretch: used to increase the sense of speed and emphasize the squash by contrast. Note: keep volume constant! http://www.siggraph.org/education/materials/HyperGraph/animation/character_ animation/principles/squash_and_stretch.htm http://www.siggraph.org/education/materials/HyperGraph/animation/character_ animation/principles/squash_and_stretch.htm http://www.siggraph.org/education/materials/HyperGraph/animation/character_ animation/principles/bouncing_ball_example_of_slow_in_out.htm http://www.siggraph.org/education/materials/HyperGraph/animation/character_ animation/principles/bouncing_ball_example_of_slow_in_out.htm Slide 19 Squash and stretch (contd) Slide 20 Slide 21 Anticipation An action has three parts: anticipation, action, reaction. Anatomical motivation: a muscle must extend before it can contract. Watch: bugs-bunny.virtualdub.new.mpg Prepares audience for action so they know what to expect. Directs audience's attention. Slide 22 Anticipation (contd) Amount of anticipation (combined with timing) can affect perception of speed or weight. Slide 23 Arcs Avoid straight lines since most things in nature move in arcs. Slide 24 Slow in and slow out An extreme pose can be emphasized by slowing down as you get to it (and as you leave it). In practice, many things do not move abruptly but start and stop gradually. Slide 25 Exaggeration Get to the heart of the idea and emphasize it so the audience can see it. Slide 26 Exaggeration Get to the heart of the idea and emphasize it so the audience can see it. Slide 27 Appeal The character must interest the viewer. It doesn't have to be cute and cuddly. Design, simplicity, behavior all affect appeal. Example: Luxo, Jr. is made to appear childlike. http://www.youtube.com/watch?v=HDuRXvtImQ0&feature=related Slide 28 Appeal (contd) Note: avoid perfect symmetries. Slide 29 Appeal (contd) Note: avoid perfect symmetries. Slide 30 Ray Tracing Slides are from Ravi Ramamoorthis graphics class at Columbia U Reading: Shirley Ch 10.1 --- 10.8 Slide 31 Effects needed for Realism Reflections (Mirrors and Glossy) Transparency (Water, Glass) Interreflections (Color Bleeding) (Soft) Shadows Complex Illumination (Natural, Area Light) Realistic Materials (Velvet, Paints, Glass) And many more Image courtesy Paul Heckbert 1983 Slide 32 Ray Tracing Different Approach to Image Synthesis as compared to Hardware pipeline (OpenGL) OpenGL : Object by Object Ray Tracing : Pixel by Pixel Advantage: Easy to compute shadows/transparency/etc Disadvantage: Slow (in early days) Slide 33 Basic Version: Ray Casting Virtual Viewpoint Virtual ScreenObjects Ray misses all objects: Pixel colored blackRay intersects object: shade using color, lights, materialsMultiple intersections: Use closest one (as does OpenGL) Slide 34 Ray Casting Produce same images as with OpenGL Visibility per pixel instead of Z-buffer Find nearest object by shooting rays into scene Shade it as in standard OpenGL Section 10.1-10.2 in text (we show visually, omitting math) Slide 35 Comparison to hardware scan-line Per-pixel evaluation, per-pixel rays (not scan-convert each object). On face of it, costly But good for walkthroughs of extremely large models (amortize preprocessing, low complexity) More complex shading, lighting effects possible Slide 36 Shadows Virtual Viewpoint Virtual ScreenObjects 10.5 in textbook Light Source Shadow ray to light is unblocked: object visibleShadow ray to light is blocked: object in shadow Slide 37 Shadows: Numerical Issues Numerical inaccuracy may cause intersection to be below surface (effect exaggerated in figure) Causing surface to incorrectly shadow itself Move a little towards light before shooting shadow ray Slide 38 Mirror Reflections/Refractions Virtual Viewpoint Virtual ScreenObjects 10.6 in textbook Generate reflected ray in mirror direction, Get reflections and refractions of objects Slide 39 Recursive Ray Tracing (Core Idea) For each pixel Trace Primary Eye Ray, find intersection Trace Secondary Shadow Ray(s) to all light(s) Color = Visible ? Illumination Model : 0 ; Trace Reflected Ray Color += reflectivity * Color of reflected ray Trace Refracted Ray Color += transparency * Color of refracted ray Also see section 10.4 in text Recursive function Calls Slide 40 Problems with Recursion Reflection rays may be traced forever Generally, set maximum recursion depth Slide 41 Turner Whitted 1980 Slide 42 Effects needed for Realism (Soft) Shadows Reflections (Mirrors and Glossy) Transparency (Water, Glass) Interreflections (Color Bleeding) Complex Illumination (Natural, Area Light) Realistic Materials (Velvet, Paints, Glass) Discussed in this lecture Not discussed so far but possible with distribution ray tracing (10.11) Hard (but not impossible) with ray tracing; radiosity methods Slide 43 How to implement? Ray parameterization Ray-Surface Intersection Slide 44 Ray/Object Intersections Heart of Ray Tracer One of the main initial research areas Optimized routines for wide variety of primitives Various types of info Shadow rays: Intersection/No Intersection Primary rays: Point of intersection, material, normals Texture coordinates Section 10.3 Slide 45 Example Sphere How to decide there is an intersection? Triangle How to decide the intersection is inside? Polygon How to decide the intersection is inside? How about an ellipsoid? Slide 46 Ray-Tracing Transformed Objects We have an optimized ray-sphere test But we want to ray trace an ellipsoid Solution: Ellipsoid transforms sphere Apply inverse transform to ray, use ray-sphere Section 10.8 of text Slide 47 Acceleration Testing each object for each ray is slow Faster Intersections Optimized Ray-Object Intersections Fewer Intersections Section 10.9 goes into more detail Slide 48 Acceleration Structures Bounding boxes (possibly hierarchical) If no intersection bounding box, neednt check objects Bounding Box Ray Spatial Hierarchies (Oct-trees, kd trees, BSP trees) Slide 49 Octtree Slide 50 K-d tree Slide 51 Acceleration Structures: Grids Slide 52 Slide 53 Raytracing on Graphics Hardware Modern Programmable Hardware general streaming architecture Can map various elements of ray tracing Kernels like eye rays, intersect etc. In vertex or fragment programs Convergence between hardware, ray tracing [Purcell et al. 2002, 2003] http://graphics.stanford.edu/papers/photongfx Slide 54 Slide 55 Outline History Basic Ray Casting (instead of rasterization) Comparison to hardware scan conversion Shadows / Reflections (core algorithm) Ray-Surface Intersection Optimizations Current Research Section 10 in text Slide 56 Ray Tracing: History Appel 68 Whitted 80 [recursive ray tracing] Landmark in computer graphics Lots of work on various geometric primitives Lots of work on accelerations Current Research Real-Time raytracing (historically, slow technique) Ray tracing architecture Slide 57 Outline History Basic Ray Casting (instead of rasterization) Comparison to hardware scan conversion Shadows / Reflections (core algorithm) Ray-Surface Intersection Optimizations Current Research Slide 58 Outline History Basic Ray Casting (instead of rasterization) Comparison to hardware scan conversion Shadows / Reflections (core algorithm) Ray-Surface Intersection Optimizations Current Research Slide 59 Outline History Basic Ray Casting (instead of rasterization) Comparison to hardware scan conversion Shadows / Reflections (core algorithm) Ray-Surface Intersection Optimizations Current Research Slide 60 Outline History Basic Ray Casting (instead of rasterization) Comparison to hardware scan conversion Shadows / Reflections (core algorithm) Ray-Surface Intersection Optimizations Current Research Slide 61 Interactive Raytracing Ray tracing historically slow Now viable alternative for complex scenes Key is sublinear complexity with acceleration; need not process all triangles in scene Allows many effects hard in hardware OpenRT project real-time ray tracing (http://www.openrt.de)