Today Rendering Algorithms Course overview Organization Introduction to ray tracing Spring 2009 Matthias Zwicker Universität Bern Rendering algorithms Problem statement Given computer representation of 3D scene, generate image of the scene that would be captured by a virtual camera at a given location Applications Movies, games, design, architecture, virtual reality, visualization, tele-collaboration Rendering algorithms Challenges Efficiency Photo-realism Goal of the class Learn theory and practice of rendering algorithms Have fun improving your programming skills Ray tracing Ray tracing Soft shadows Caustics Global illum. 1
2
What you should know Basic background in 3D graphics (Vorlesung Computergrafik ) Programming experience in Java or C++ Linear algebra Vectors, matrices, coordinate transformations (Shirley, Chapters 1-6) What you should know Mathematics Vectors in 3D (dot product, vector product) Matrix algebra (addition, multiplication, inverse, determinant, transpose, orthogonal matrices) Coordinate systems (homogeneous coordinates, change of coordinates) Transformation matrices (scaling, rotation, translation, shearing) Plane equations Systems of linear equations (matrix representation, elementary solution procedures) Graphics Color Scene representation (triangle meshes, scene graphs) Viewing (perspective projection, rasterization) Syllabus Part 1: Basics of ray tracing Ray tracing algorithm Camera model Ray-geometry intersection techniques Shading Acceleration structures Textures, environments maps, bump maps Syllabus Part 2: The physics of light transport and how to simulate it The rendering equation Monte carlo ray tracing Photon mapping Radiosity Syllabus Part 3: Advanced topics Sampling and anti-aliasing Realistic camera models High dynamic range imaging Advanced geometry Subsurface scattering and participating media Programming assignments Individual projects Build your own ray tracer 1. Basic ray tracer 2 A l ti t t 2. Acceleration structures 3. Global illumination 4. Advanced topics 3
from UCSD classes from UCSD classes Josh, 2003 Craig, 2003 from UCSD classes from UCSD classes Arash, 2003 Wojciech, 2004 from UCSD classes from UCSD classes Alex, 2005 Will, 2005 4
Today Course overview Organization Introduction to ray tracing Organization Course webpage http://cgg.unibe.ch/teaching/courses/fruhlingssemester-2009/rendering-algorithms/ Webboard Ilias, group IAM Rendering Algorithms Passwort renderingalgorithms https://ilias.unibe.ch/ilias3/repository.php?ref_id=66993&cmd=render Teaching assistant Claude Knaus, knaus@iam.unibe.ch Lab IAM room 102 (CGG pool) Organization Lectures Fridays 13:15-15:00 Exercise session Fridays, 15:15 16:00 Organization Grading Assignments: 10% each, 40% total Final exam: 60% Today Course overview Organization Introduction to ray tracing Introduction Two fundamentally different algorithms for image generation (rendering) Z-buffering, rasterization Ray tracing Ray tracing In both cases, most popular object representation are triangle meshes 5
Z-buffering Rendering pipeline Input data (geometry etc.) Transformation, projection Rasterization Shading Object order algorithm, paint one object after an other Z-buffering Implemented in graphics hardware (ATI, NVidia GPUs) Standardized APIs (OpenGL, Direct3D) Interactive ti rendering, games Limited photo-realism Display Ray tracing Ray tracing vs. rasterization Imager Primary rays Find first intersection Shading Output image Scene representation Image order algorithm, paint one pixel after an other Rasterization Desirable memory access pattern ( streaming, data locality, avoids random scene access) Suitable for real time rendering (OpenGL, DirectX) Popular for production rendering (Pixar RenderMan), where scenes often do not fit in RAM Full global illumination not possible with purely object order algorithm Ray tracing Undesirable memory access pattern (random scene access) Requires sophisticaed data structures for fast scene access Full global illumination possible Most popular for photo-realistic image synthesis Ray tracing pseudocode raytrace() { construct scene representation for each pixel ray = computeprimary() hit = first intersection with scene color = shade( hit ) set pixel color } Computing primary rays Primary rays sometimes called camera rays Define camera coordinate system and viewing frustum Given an image pixel Determine ray in camera coordinates Transform ray to world coordinates (sometimes also called canonic coordinates) 6
Camera coordinate system Camera coordinate system Camera coordinates World coordinates Scene object World coordinates Scene object Camera coordinate system Given Viewing frustum Vertical field-of-view θ Aspect ratio width/height aspect Image plane at w=-1 Viewing frustum Computing primary rays Caution: origin in homogeneous coordinates 7
Computing primary rays Vertical field-of-view θ Aspect ratio width/height aspect Image coordinates u, v Computing primary rays Image resolution m n pixels Pixel Pixel Pixel Computing primary rays Primary ray in camera coordinates Transformation to world coords. World coordinates sometimes also called canonic coordinates Column vectors Transformation matrix Multiply matrices from the left Transforming Normal Vectors Normal is perpendicular to tangent Exercise session Implementing a basic ray tracer Under transformation, find normal transformation ti that t satisfies normal constraint 8