DOC PREVIEW
GT ECE 4893 - Lecture 6: 3D Rendering Pipeline (III)
School name Georgia Tech
Pages 35

This preview shows page 1-2-16-17-18-34-35 out of 35 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 35 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 6: 3D Rendering Pipeline (III)Rasterization: Shading a TriangleGouraud ShadingComparison of Shading MethodsDouble BufferingZ-BufferAliasingAnti-Aliasing by MultisamplingAnti-Aliasing ExampleVisualizing Anti-Aliasing ExampleTexture MappingSlide 12Slide 13Slide 14Slide 15Slide 16MagnificationNearest Point Sampling (for Magnification)Bi-linear Filtering (for Magnification)MinificationNearest Point Sampling (for Minification)Bi-linear Filtering (for Minification)Mip-mappingSlide 24Tri-linear Filtering using Mip mapsColor Blending and Alpha BlendingAlpha Blending (Inverse Source form)Another Example Without TransparencyAnother Alpha Blending ExampleAlpha TestMulti-TexturingMulti-Texturing Example: Light MappingStencilingStencil Buffer ExampleApply Fog EffectLecture 6: 3D Rendering Pipeline (III)Prof. Hsien-Hsin Sean LeeSchool of Electrical and Computer EngineeringGeorgia Institute of Technology2Rasterization: Shading a Triangle•Paint each pixel’s color (by calculating light intensity) on your display (Typically object-based)•Gouraud Shading: –Intensity Interpolation of verticesRGB(255,0,0)RGB(0,255,0)RGB(0,0,255)3Gouraud ShadingRGB(255,0,0)RGB(0,255,0)RGB(0,0,255)RGB(127,0,127)RGB(127,127,0)RGB(127,64,64)•Scan conversion algorithmScan line4Comparison of Shading Methods•Phong shading –requires generating per-pixel normals to compute light intensity for each pixel, not efficient for games–Can be done on GPGPU today using Cg or HLSL•Gouraud shading is supported by Graphics hardwareFlat shading Gouraud shading Phong shadingSource: Michal Necasek5Double Buffering•Display refreshes at 60  75 Hz•Rendering could be “faster” than the refresh period•Too fast leads to –Frames not shown•Too slow leads to–New and old frame mixed–Flickering•Solution: –Double or multiple buffering surface1 surface2Front BufferBack Buffersurface2surface1swap6Z-Buffer•Also called depth buffer•Draw the pixel which is nearest to the viewer•Number of the entries corresponding to the screen resolution (e.g. 1024x768 should have a 768k-entry Z-buffer)–Some card perform Z-compression•Perform Z test before drawing a pixelz1z2 z37Aliasing•Jagged line (or staircase)•Can be improved by increasing resolution (i.e. more pixels)8Anti-Aliasing by Multisampling•GPU samples multiple locations for a pixel•Several different methods –e.g. grid, random, GeForce’s quincunx•Downside –Blurry image–Increased memory (e.g. z-buffer) storage for subpixel informationActual Screen Pixels3x3 Virtual Pixels(Bartlett window)(255, 159, 159)Example1 11 1222 24(255,255,255) (255,0,0)(255,255,255)(255,255,255)(255,255,255)(255,255,255)(255,0,0) (255,255,255)(255,0,0)9Anti-Aliasing ExampleNo MSAAWith MSAAIdeal10Visualizing Anti-Aliasing ExampleNo MSAA With MSAA11Texture Mapping•Rendering tiny triangles is slow•Players won’t even look at some certain details–Sky, clouds, walls, terrain, wood patterns, etc.•Simple way to add details and enhance realism•Use 2D images to map polygons •Images are composed of 2D “texels”•Can be used to substitute or blend the lit color of a texture-mapped surface12Texture Mapping•Introduce one more component to geometry –Position coordinates–Normal vector–Color –Texture coordinates•Texture info–(u, v) coordinates for each vertex–Typically range from 0 to 1 •(0,0) from upper left corner13Texture MappingTexture: hunk.jpg(0,0)(1,1)v0v1v2v3v7 v8(0,1)(1,0){v1.x, v0.y, v0.z, …, 1, 0},{v2.x, v1.y, v1.z, …, 1, 1},{v0.x, v2.y, v2.z, …, 0, 0},{v3.x, v3.y, v3.z, …, 0, 1},u v14Texture MappingTexture 2(0,0)(1,1)v0v1v2v3v7 v8(0,0)(1,1)(0,1)(1,0)Texture 115Texture Mapping(0,0)(1,1){v0.x, v0.y, v0.z, …, 0, 0},{v1.x, v1.y, v1.z, …, 5, 0},{v2.x, v2.y, v2.z, …, 5, 3},{v3.x, v3.y, v3.z, …, 0, 3},u v(1,0)(0,1)16Texture Mapping{v0.x, v0.y, v0.z, …, 0, 0},{v1.x, v1.y, v1.z, …, 6, 0},{v2.x, v2.y, v2.z, …, 6, 6},{v3.x, v3.y, v3.z, …, 0, 6},u v17Magnification•Texel and pixel mapping is rarely 1-to-1•Mapped triangle is very close to the camera•One texel maps to multiple pixelsPixels on screenTexels18Nearest Point Sampling (for Magnification)•Choose the texel nearest the pixel’s centerPixels on screenTexels19Bi-linear Filtering (for Magnification)•Average for the 2x2 texels surrounding a given pixelTexelsR=102G=102B=51R=255G=204B=102R=253G=230B=145R=247G=237B=141Pixels on screenR=214G=193B=11020Minification•Texel and pixel mapping is rarely 1-to-1•Multiple texels map to one pixelPixels on screenTexelsColor?21Nearest Point Sampling (for Minification)•Choose the texel nearest the pixel’s centerPixels on screen22Bi-linear Filtering (for Minification)•Average for the 2x2 texels surrounding a given pixelPixels on screenR=135G=119B=23R=252G=219B=96R=0G=0B=0R=234G=189B=0R=155G=132B=3023Mip-mapping•Multiple versions are provided for the same texture •Different versions have different levels of details–E.g., 7 LOD maps: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4 –Choose the closet maps to render a surface•Maps can be automatically generated by 3D API•Accelerate texture mapping for far-away polygons•More space to store texture maps24Mip-mapping•API or Hardware can–Generate (lower resolution) mip maps automatically–Choose the right one for the viewer•Good performance for far triangles•Good LOD for close-by objects–Tri-linearly interpolate25Tri-linear Filtering using Mip maps•Interpolate between mipmapsHigher Res. Mip MapScreenPixelR=155G=132B=30R=229G=208B=119R=233G=227B=143R=178G=179B=90R=199G=187B=96Lower Res. Mip MapR=147G=114B=117R=58G=0B=0R=66G=0B=0R=106G=80B=74R=94G=49B=48R=147G=118B=7226Color Blending and Alpha Blending•Transparency effect (e.g. Water, glasses, etc.)•Source color blended with destination color•Several blending methods–AdditiveC = SrcPixel  (1,1,1,1) + DstPixel  (1,1,1,1) = SrcPixel + DstPixel–SubtractiveC = SrcPixel  (1,1,1,1) ― DstPixel  (1,1,1,1) = SrcPixel ― DstPixel–MultiplicativeC = DstPixel  SrcPixel–Using Alpha value in the color (Alpha Blending)C = SrcPixel  (,,,) + DstPixel  (1-,1-,1-,1-)–And many more in the API …27Alpha Blending (Inverse Source form)No transparencySrc=0.2 (triangle)Dest=0.8 (square)Src=0.5 (triangle)Dest=0.5 (square)Src=0.8 (triangle)Dest=0.2 (square)28Another Example Without Transparency29Another Alpha Blending ExampleSrc=0.3 (rect) Dest=0.7


View Full Document

GT ECE 4893 - Lecture 6: 3D Rendering Pipeline (III)

Documents in this Course
Load more
Download Lecture 6: 3D Rendering Pipeline (III)
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 6: 3D Rendering Pipeline (III) and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 6: 3D Rendering Pipeline (III) 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?