Graphics Pipeline: Projective Last Time Shadows cast ra to light stop after first intersection Reflection & Refraction compute direction of recursive ra Recursive Ra Tracing maimum number of bounces OR contribution < error threshhold Epsilon Does Ra Tracing Simulate Phsics? Correct Transparent Shadow Ra Tracing is full of dirt tricks For eample, shadows of transparent objects: opaque? multipl b transparenc color? (ignores refraction & does not produce caustics) Animation b Henrik Wann Jensen Using advanced refraction technique (refraction for illumination is usuall not handled that well) Refraction and the Lifeguard Problem Does Ra Tracing Simulate Phsics? Running is faster than swimming Water Beach Lifeguard Photons go from the light to the ee, not the other wa What we do is backward ra tracing Run Person in trouble Swim
Forward Ra Tracing Start from the light source But low probabilit to reach the ee What can we do about it? Alwas send a ra to the ee. still not efficient The Rendering Equation Clean mathematical framework for lighttransport simulation At each point, outgoing light in one direction is the integral of incoming light in all directions multiplied b reflectance propert We ll see this later Questions? Toda Ra Casting / Tracing vs. advantages & disadvantages when is each appropriate? The Graphics Pipeline Projective Introduction to Ra Casting / Tracing Advantages? Smooth variation of normal, silhouettes Generalit: can render anthing that can be intersected with a ra Atomic operation, allows recursion Disadvantages? Time compleit (N objects, R piels) Usuall too slow for interactive applications Hard to implement in hardware (lacks computation coherence, must fit entire scene in memor) How Do We Render Interactivel? Use graphics hardware (the graphics pipeline), via OpenGL, MesaGL, or DirectX assignment 3 assignment 4 Most global effects available in ra tracing will be sacrificed, but some can be approimated
Given a primitive's vertices & the illumination at each verte: Figure out which piels to "turn on" to render the primitive Interpolate the illumination values to "fill in" the primitive At each piel, keep track of the closest primitive (- buffer) glbegin(gl_triangles) glnormal3f(...) glverte3f(...) glverte3f(...) glverte3f(...) glend(); Limitations of Restricted to scan- convertible primitives Object polgoniation Faceting, shading artifacts Effective resolution is hardware dependent No handling of shadows, reflection, transparenc Problem of overdraw (high depth compleit) What if there are man more triangles than piels? scan conversion flat shading ra tracing scan conversion gouraud shading Ra Casting vs. Rendering Pipeline Ra Casting vs. Rendering Pipeline Ra Casting For each piel For each object Send piels to the scene Discretie first Rendering Pipeline For each triangle For each piel Project scene to the piels Discretie last Ra Casting For each piel For each object Whole scene must be in memor Depth compleit: no computation for hidden parts Atomic computation More general, more fleible Primitives, lighting effects, adaptive antialiasing Rendering Pipeline For each triangle For each piel Primitives processed one at a time Coherence: geometric transforms for vertices onl Earl stages involve analtic processing Computation increases with depth of the pipeline Good bandwidth/computation ratio Sampling occurs late in the pipeline Minimal state required Movies both pipeline and ra tracing Games pipeline
Simulation pipeline (painter for a long time) CAD-CAM & Design pipeline during design, anthing for final image Architecture ra-tracing, pipeline with preprocessing for comple lighting Virtual Realit pipeline Visualiation mostl pipeline, ra-tracing for high-qualit ee cand, interactive ra-tracing is starting Medical Imaging same as visualiation
Questions? Toda Ra Casting / Tracing vs. The Graphics Pipeline Projective Introduction to The Graphics Pipeline The Graphics Pipeline Primitives are processed in a series of stages Each stage forwards its result on to the net stage The pipeline can be drawn and implemented in different was Some stages ma be in hardware, others in software Optimiations & additional programmabilit are available at some stages 3D models defined in their own coordinate sstem (object space) transforms orient the models within a common coordinate frame (world space) (Lighting) Vertices lit (shaded) according to material properties, surface properties (normal) and light sources Local lighting model (Diffuse, Ambient, Phong, etc.) Object space World space
Maps world space to ee space Viewing position is transformed to origin & direction is oriented along some ais (usuall ) Transform to Normalied Device Coordinates (NDC) World space Ee space Ee space Portions of the object outside the view volume (view frustum) are removed NDC The objects are projected to the 2D image place (screen space) Rasteries objects into piels Interpolate values as we go (color, depth, etc.) NDC Screen Space Common Coordinate Sstems Each piel remembers the closest object (depth buffer) Almost ever step in the graphics pipeline involves a change of coordinate sstem. are central to understanding 3D computer graphics. Object space local to each object World space common to all objects Ee space / Camera space derived from view frustum Clip space / Normalied Device Coordinates (NDC) [-,-,-] [,,] Screen space indeed according to hardware attributes
Coordinate Sstems in the Pipeline Questions? Object space World space Ee Space / Camera Space Clip Space (NDC) Screen Space Toda Ra Casting / Tracing vs. The Graphics Pipeline Projective & Homogeneous Coordinates Orthographic & Perspective s Coordinate Sstems & s in the Pipeline Canonical View Volume Introduction to Remember? Projective Affine Similitudes Linear Rigid / Euclidean Scaling Identit Translation Isotropic Scaling Reflection Rotation Shear Perspective Homogeneous Coordinates Most of the time w, and we can ignore it ' ' ' a e i b f j c g k d h l Homogeneous Visualiation Divide b w to normalie (homogenie) W? Point at infinit (direction) If we multipl a homogeneous coordinate b an affine matri, w is unchanged (,, ) (,, 2) (7,, ) (4, 2, 2) (4, 5, ) (8,, 2) w w 2
Orthographic vs. Perspective Orthographic Simple Orthographic Project all points along the ais to the plane Perspective Simple Perspective Project all points to the d plane, eepoint at the origin: Alternate Perspective Project all points to the plane, eepoint at the (,,-d): homogenie homogenie * d / * d / d / d /d * d / ( + d) * d / ( + d) ( + d)/ d /d In the limit, as d Where are projections in the pipeline? this perspective projection matri... /d...is simpl an orthographic projection Ee Space / Camera Space Clip Space (NDC) Screen Space
World Space Ee Space Change of Orthonormal Basis Positioning the camera u v n u v n u v n u v n Translation + Change of orthonormal basis Given: coordinate frames & uvn, and point p (,,) Find: p (u,v,n) v p v u u v p v u u where: u. u u. u etc. Normalied Device Coordinates Canonical Orthographic is more efficient in a rectangular, ais- aligned volume: (-,-,- ) (,,) OR (,,) (,,) Canonical Perspective Questions?
Toda Ra Casting / Tracing vs. The Graphics Pipeline Projective Introduction to Projecting to the Image Plane Wh Clip? Strategies What if the p is > ee? (ee, ee, ee ) ais + image plane What if the p is < ee? What if the p ee? (ee, ee, ee ) ais + (ee, ee, ee ) ais + image plane??? image plane "clip" geometr to view frustum (ee, ee, ee ) image plane ais + Eliminate portions of objects outside the viewing frustum View Frustum boundaries of the image plane projected in 3D left a near & far clipping plane User ma define additional clipping near planes far top right bottom
Wh Clip? Avoid degeneracies Don t draw stuff behind the ee Avoid division b and overflow Efficienc Don t waste time on objects outside the image boundar Other graphics applications (often non-conve) Hidden- surface removal, Shadows, Picking, Binning, CSG (Boolean) operations (2D & 3D) Strategies Don t clip (and hope for the best) Clip on-the-fl during rasteriation Analtical clipping: alter input geometr Net Time: & Line Rasteriation