3D Rasterization II3D Rendering Pipeline (for direct illumination)RasterizationRasterizationShadingRay CastingPolygon ShadingPolygon Shading AlgorithmsPolygon Shading AlgorithmsFlat ShadingFlat ShadingFlat ShadingPolygon Shading AlgorithmsGouraud ShadingGouraud ShadingGouraud ShadingGouraud ShadingGouraud ShadingPolygon Shading AlgorithmsPhong ShadingPhong ShadingPhong ShadingPolygon Shading AlgorithmsShading IssuesRasterizationTexturesSurface TexturesSurface Textures3D Rendering Pipeline (for direct illumination)Texture Mapping OverviewTexture MappingTexture MappingTexture MappingTexture MappingTexture MappingTexture Mapping OverviewTexture FilteringTexture FilteringTexture FilteringTexture FilteringMip MapsSummed-area tablesTexture Mapping OverviewParameterizationOption: Varieties of projectionsOption: unfold the surfaceOption: make an atlasTexture Mapping OverviewModulation texturesIllumination MappingBump MappingBump MappingEnvironment MappingImage-Based RenderingSolid texturesTexture Mapping SummaryRasterizationVisible Surface DeterminationDepth sort3D Rendering PipelineZ-BufferZ-BufferHidden Surface Removal AlgorithmsRasterization SummaryGPU ArchitectureActually …Trend …3D Rasterization IICOS 4263D Rendering Pipeline (for direct illumination)3D PrimitivesModelingTransformationProjectionTransformationClippingLightingImageViewportTransformationScanConversionViewingTransformationRasterization• Scan conversion Determine which pixels to fill• Shading Determine a color for each filled pixel• Texture mapping Describe shading variation within polygon interiors• Visible surface determination Figure out which surface is front-most at every pixelRasterization• Scan conversion (last time) Determine which pixels to fill Shading Determine a color for each filled pixel• Texture mapping Describe shading variation within polygon interiors• Visible surface determination Figure out which surface is front-most at every pixelShading• How do we choose a color for each filled pixel? Emphasis on methods that can be implemented in hardware P1P2P3Ray Casting• Simplest shading approach is to perform independent lighting calculation for every pixel))()((∑•+•++=iiniSiiDALAEIRVKILNKIKIIPolygon Shading• Can take advantage of spatial coherence Illumination calculations for pixels covered by same primitive are related to each other))()((∑•+•++=iiniSiiDALAEIRVKILNKIKIIPolygon Shading Algorithms• Flat Shading• Gouraud Shading• Phong ShadingPolygon Shading Algorithms• Flat Shading• Gouraud Shading• Phong ShadingFlat Shading• What if a faceted object is illuminated only by directional light sources and is either diffuse or viewed from infinitely far away))()((∑•+•++=iiniSiiDALAEIRVKILNKIKIIFlat Shading• One illumination calculation per polygon Assign all pixels inside each polygon the same colorNFlat Shading• Objects look like they are composed of polygons OK for polyhedral objects Not so good for smooth surfacesPolygon Shading Algorithms• Flat Shading• Gouraud Shading•Phong ShadingGouraud Shading• What if smooth surface is represented by polygonal mesh with a normal at each vertex?))()((∑•+•++=iiniSiiDALAEIRVKILNKIKIIWatt Plate 7Gouraud Shading• Method 1: One lighting calculation per vertex Assign pixels inside polygon by interpolating colors computed at verticesGouraud Shading• Bilinearly interpolate colors at verticesdown and across scan linesGouraud Shading• Smooth shading over adjacent polygons Curved surfaces Illumination highlights Soft shadowsMesh with shared normals at verticesWatt Plate 7Gouraud Shading• Produces smoothly shaded polygonal mesh Piecewise linear approximation Need fine mesh to capture subtle lighting effectsGouraud ShadingFlat ShadingPolygon Shading Algorithms• Flat Shading• Gouraud Shading• Phong ShadingPhong Shading• What if polygonal mesh is too coarse to capture illumination effects in polygon interiors?))()((∑•+•++=iiniSiiDALAEIRVKILNKIKIIPhong Shading• One lighting calculation per pixel Approximate surface normals for points inside polygons by bilinear interpolation of normals from verticesPhong Shading• Bilinearly interpolate surface normals at vertices down and across scan linesPolygon Shading AlgorithmsGouraud PhongWireframe FlatWatt Plate 7Shading Issues• Problems with interpolated shading: Polygonal silhouettes Perspective distortion Orientation dependence (due to bilinear interpolation) Problems computing shared vertex normals Problems at T-verticesRasterization• Scan conversion Determine which pixels to fill• Shading Determine a color for each filled pixel Texture mapping Describe shading variation within polygon interiors• Visible surface determination Figure out which surface is front-most at every pixelSurfaceImageTextureTextures• Describe color variation in interior of 3D polygon When scan converting a polygon, vary pixel colors according to values fetched from a texture imageAngel Figure 9.3Surface Textures• Add visual detail to surfaces of 3D objectsPolygonal modelWith surface textureSurface Textures• Add visual detail to surfaces of 3D objects[Daren Horley]3D Rendering Pipeline (for direct illumination)3D PrimitivesModelingTransformationProjectionTransformationClippingLightingImageViewportTransformationScanConversion2D Image Coordinates3D Modeling Coordinates3D World Coordinates3D Camera Coordinates2D Screen Coordinates2D Screen CoordinatesViewingTransformation3D World Coordinates2D Image CoordinatesTexture mappingTexture Mapping Overview• Texture mapping methods Mapping Filtering Parameterization• Texture mapping applications Modulation textures Illumination mapping Bump mapping Environment mapping Image-based rendering Non-photorealistic renderingTexture Mapping• Steps: Define texture Specify mapping from texture to surface Lookup texture values during scan conversion(0,0)(1,0)(0,1)uvxyModelingCoordinateSystemImageCoordinateSystemstTextureCoordinateSystemTexture Mapping• When scan convert, map from … image coordinate system (x,y) to modeling coordinate system (u,v) to texture image (t,s)(0,0)(1,0)(1,1)(0,1)uvxyModelingCoordinateSystemImageCoordinateSystemstTextureCoordinateSystemTexture Mapping[Allison Klein]• Texture mapping is a 2D projective transformation texture coordinate system: (t,s) to
View Full Document