3D RenderingCourse SyllabusWhere Are We Now?The Everyday WorldThe Nature of RealismSlide 6Rendering3D Rendering ExampleOverviewSlide 103D Scene Representation3D PointSlide 133D VectorSlide 15Slide 163D Line SegmentSlide 183D Ray3D Line3D PlaneSlide 223D Polygon3D Sphere3D Geometric PrimitivesSlide 26Camera ModelsCamera ParametersSlide 29Moving the cameraSlide 31Visible Surface DeterminationRay CastingSlide 34Slide 35Rendering AlgorithmsSlide 37Lighting SimulationSlide 39SummaryNext LectureGreg HumphreysCS445: Intro GraphicsUniversity of Virginia, Fall 20033D RenderingGreg HumphreysUniversity of VirginiaCS 445, Fall 2003Course SyllabusI. Image processingII. RenderingIII. ModelingIV. AnimationWhere Are We Now?I. Image processingII. RenderingIII. ModelingIV. AnimationThe Everyday WorldThe Nature of RealismToyota Supra by Kevin HulseyThe Nature of RealismCafé Express by Richard Estes, 1975Rendering•Generate an image from geometric primitivesRenderingGeometric PrimitivesRaster Image3D Rendering ExampleWhat issues must be addressed by a 3D rendering system?Overview•3D scene representation•3D viewer representation•Visible surface determination•Lighting simulationOverview»3D scene representation•3D viewer representation•Visible surface determination•Lighting simulationHow is the 3D scenedescribed in a computer?How is the 3D scenedescribed in a computer?3D Scene Representation•Scene is usually approximated by 3D primitivesPointLine segmentPolygonPolyhedronCurved surfaceSolid object etc.3D Point•Specifies a locationOrigin3D Point•Specifies a locationRepresented by three coordinatesInfinitely smalltypedef struct {Coordinate x;Coordinate y;Coordinate z;} Point;typedef struct {Coordinate x;Coordinate y;Coordinate z;} Point;(x,y,z)Origin3D Vector•Specifies a direction and a magnitude3D Vector•Specifies a direction and a magnitudeRepresented by three coordinatesMagnitude ||V|| = sqrt(dx dx + dy dy + dz dz)Has no locationtypedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;typedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;(dx,dy,dz)3D Vector•Specifies a direction and a magnitudeRepresented by three coordinatesMagnitude ||V|| = sqrt(dx dx + dy dy + dz dz)Has no location•Dot product of two 3D vectorsV1·V2 = dx1dx2 + dy1dy2 + dz1dz2V1·V2 = ||V1 || || V2 || cos()typedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;typedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;(dx1,dy1,dz1)(dx2,dy2 ,dz2)3D Line Segment•Linear path between two pointsOrigin3D Line Segment•Use a linear combination of two pointsParametric representation:»P = P1 + t (P2 - P1), (0 t 1)typedef struct {Point P1;Point P2;} Segment;typedef struct {Point P1;Point P2;} Segment;P1P2Origin3D Ray•Line segment with one endpoint at infinityParametric representation: »P = P1 + t V, (0 <= t < )typedef struct {Point P1;Vector V;} Ray;typedef struct {Point P1;Vector V;} Ray;P1VOrigin3D Line•Line segment with both endpoints at infinityParametric representation: »P = P1 + t V, (- < t < )P1typedef struct {Point P1;Vector V;} Line;typedef struct {Point P1;Vector V;} Line;VOriginOrigin3D Plane•A linear combination of three pointsP1P3P2Origin3D Plane•A linear combination of three pointsImplicit representation: »P·N + d = 0, or»ax + by + cz + d = 0N is the plane “normal”»Unit-length vector»Perpendicular to planetypedef struct {Vector N;Distance d;} Plane;typedef struct {Vector N;Distance d;} Plane;P1N = (a,b,c)dP3P23D Polygon•Area “inside” a sequence of coplanar pointsTriangleQuadrilateralConvexStar-shapedConcaveSelf-intersectingHoles (use > 1 polygon struct)typedef struct {Point *points;int npoints;} Polygon;typedef struct {Point *points;int npoints;} Polygon;Points are in counter-clockwise order3D Sphere•All points at distance “r” from point “(cx, cy, cz)”Implicit representation:»(x - cx)2 + (y - cy)2 + (z - cz)2 = r 2Parametric representation:»x = r cos( ) cos() + cx»y = r cos() sin() + cy»z = r sin() + cztypedef struct {Point center;Distance radius;} Sphere;typedef struct {Point center;Distance radius;} Sphere;rOrigin3D Geometric Primitives•More detail on 3D modeling later in course PointLine segmentPolygonPolyhedronCurved surfaceSolid object etc.H&B Figure 10.46Overview•3D scene representation»3D viewer representation•Visible surface determination•Lighting simulationHow is the viewing devicedescribed in a computer?How is the viewing devicedescribed in a computer?Camera Models•The most common model is pin-hole camera All captured light rays arrive along paths toward focal point without lens distortion (everything is in focus)Sensor response proportional to radianceOther models consider ...Depth of fieldMotion blurLens distortionView planeEye position(focal point)Camera Parameters•What are the parameters of a camera?Camera Parameters•PositionEye position (px, py, pz)•OrientationView direction (dx, dy, dz)Up direction (ux, uy, uz)•ApertureField of view (xfov, yfov)•Film plane “Look at” pointView plane normalrightbackUp directionEye PositionView directionViewPlane“Look at”PointMoving the cameraView FrustumRightBackTowardsUpOverview•3D scene representation•3D viewer representation»Visible surface determination•Lighting simulationHow can the front-most surfacebe found with an algorithm?How can the front-most surfacebe found with an algorithm?Visible Surface Determination•The color of each pixel on the view planedepends on the radiance emanating from visible surfacesView planeEye positionSimplest methodis ray castingSimplest methodis ray castingRays throughview planeRay Casting•For each sample …Construct ray from eye position through view planeFind first surface intersected by ray through pixelCompute color of sample based on surface radianceRay Casting•For each sample …Construct ray from eye position through view planeFind first surface intersected by ray through pixelCompute color of sample based on surface radianceVisible Surface Determination•For each sample …Construct ray from eye position through view planeFind first surface intersected by ray through pixelCompute color of sample based on surface radianceMore efficient algorithmsutilize spatial
View Full Document