Today Rendering Algorithms Course overview Organization Introduction to ray tracing Spring 2010 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
Recommended books Ray tracing from the ground up, by Kevin Suffern Good intro, with Java code Realistic ray tracing, by Peter Shirley Good intro, with C code Recommended books Realistic image synthesis using photon mapping, by Henrik Wann Jensen Focus on photon mapping Physically based rendering, by Matt Pharr and Greg Humphreys Bible of ray tracing Detailed, useful as reference Includes many advanced concepts With C++ code Advanced global illumination, by Dutré et al. More on the theoretical side Many advanced concepts from UCSD classes from UCSD classes Josh, 2003 Craig, 2003 from UCSD classes from UCSD classes Arash, 2003 Wojciech, 2004 4
from UCSD classes from UCSD classes Alex, 2005 Will, 2005 Today Course overview Organization Introduction to ray tracing Organization Course webpage http://www.cgg.unibe.ch/teaching/courses/rendering-algorithms Webboard Course page on Ilias Password ra2010 Teaching assistant Fabrice Rousselle, fabrice.rousselle@gmail.com Lab IAM room 102 (CGG pool) Organization Lectures Fridays 13:15-15:00 Exercise session Fridays, 15:15 16:00 Organization Testatbedingung 70% of total score of all assignments Grading Assignments: 10% each, 40% total Final exam: 60% 5
Today Course overview Organization Introduction to ray tracing Introduction Two fundamentally different algorithms for image generation (rendering) Z-buffering, rasterization Ray tracing In both cases, most popular object representation are triangle meshes Z-buffering Z-buffering Rendering pipeline Input data (geometry etc.) Transformation, projection Rasterization Shading Object order algorithm, paint one object after an other 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 6
Ray tracing pseudocode raytrace() { construct scene representation for each pixel ray = computeprimary() hit = first intersection with scene color = shade( hit ) set pixel color } 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) 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 7
Viewing frustum Caution: origin in homogeneous coordinates Vertical field-of-view Aspect ratio width/height aspect Image coordinates u, v Image resolution m n pixels Pixel Pixel Pixel Primary ray in camera coordinates Transformation to world coords. World coordinates sometimes also called canonic coordinates Column vectors Transformation matrix (camera to world) Multiply matrices from the left 8
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 9