DOC PREVIEW
GT ECE 4893 - 3D Rendering Pipeline (III)
School name Georgia Tech
Pages 13

This preview shows page 1-2-3-4 out of 13 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 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 13 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 13 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 13 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

9/12/09 1 3D Rendering Pipeline (III) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology 2 Rasterization: Shading a Triangle • Converting geometry to a raster image (i.e., pixels) • Paint each pixel’s color (by calculating light intensity) on your display (Typically object-based) • Gouraud Shading: Intensity Interpolation of vertices RGB(255,0,0) RGB(0,255,0) RGB(0,0,255) 3 Gouraud Shading RGB(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 algorithm Scan line 4 Comparison 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 hardware Flat shading Gouraud shading Phong shading Source: Michal Necasek9/12/09 2 5 Double 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 surface2 Front Buffer Back Buffer surface2 surface1 swap 6 Z-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) • Granularity matters – 8-bit never used – 16-bit z value could generate artifacts z1 z2 z3 7 Z-Buffer Bandwidth Could Be an Issue • Perform Z test before drawing a pixel • How much bandwidth needed for RZ+WZ+RC+WC+TR per pixel? • Overdrawn rate is about 3 out of 4 – One every 4 pixels drawn is for clearing the Z-buffer • Some cards perform Z-compression to alleviate bandwidth issues 8 Aliasing • Jagged line (or staircase) • Can be improved by increasing resolution (i.e. more pixels)9/12/09 3 9 Anti-Aliasing by Multisampling (Example: Supersampling) • GPU samples multiple locations for a pixel • Several different methods – e.g., grid (as shown), random, GeForce’s quincunx • Downside – Blurry image – Increased memory (e.g., z-buffer) storage for subpixel information Actual Screen Pixels 3x3 Virtual Pixels (Bartlett window) (255, 159, 159) Example 1 1 1 1 2 2 2 2 4 (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) 10 Anti-Aliasing Example No MSAA With MSAA Ideal 11 Visualizing Anti-Aliasing Example No MSAA With MSAA 12 Texture 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 surface9/12/09 4 13 Texture 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 corner 14 Texture Mapping Texture: hunk.jpg (0,0) (1,1) v0 v1 v2 v3 v7 v8 (0,1) (1,0) {v1.x, v1.y, v1.z, …, 1, 0}, {v2.x, v2.y, v2.z, …, 1, 1}, {v0.x, v0.y, v0.z, …, 0, 0}, {v3.x, v3.y, v3.z, …, 0, 1}, u v 15 Texture Mapping Texture 2 (0,0) (1,1) v0 v1 v2 v3 v7 v8 Texture 1 (0,0) (1,1) (0,1) (1,0) 16 Texture Mapping (0,0) (1,1) {v1.x, v1.y, v1.z, …, 0, 0}, {v2.x, v2.y, v2.z, …, 5, 0}, {v0.x, v0.y, v0.z, …, 5, 3}, {v3.x, v3.y, v3.z, …, 0, 3}, u v (1,0) (0,1) v1 v2 v0 v39/12/09 5 17 Texture Mapping {v1.x, v1.y, v1.z, …, 0, 0}, {v2.x, v2.y, v2.z, …, 6, 0}, {v0.x, v0.y, v0.z, …, 6, 6}, {v3.x, v3.y, v3.z, …, 0, 6}, u v 18 Magnification • Texel and pixel mapping is rarely 1-to-1 • Mapped triangle is very close to the camera • One texel maps to multiple pixels Pixels on screen Texels 19 Nearest Point Sampling (for Magnification) • Choose the texel nearest the pixel’s center Pixels on screen Texels 20 Bi-linear Filtering (for Magnification) • Average for the 2x2 texels surrounding a given pixel Texels R=102 G=102 B=51 R=255 G=204 B=102 R=253 G=230 B=145 R=247 G=237 B=141 Pixels on screen R=214 G=193 B=1109/12/09 6 21 Bi-linear Filtering (for Magnification) • Or take the weighted color values for the 2x2 texels surrounding a given pixel 1-x x y 1-y : pixel enclosed by 4 texels * (1-x) * (1-y) * (1-x) * y * x * (1-y) * x * y + ) Final Color 22 Minification • Texel and pixel mapping is rarely 1-to-1 • Multiple texels map to one pixel Pixels on screen Texels Color? 23 Nearest Point Sampling (for Minification) • Choose the texel nearest the pixel’s center Pixels on screen 24 Bi-linear Filtering (for Minification) • Average for the 2x2 texels surrounding a given pixel Pixels on screen R=135 G=119 B=23 R=252 G=219 B=96 R=0 G=0 B=0 R=234 G=189 B=0 R=155 G=132 B=309/12/09 7 25 Mip-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 maps 26 Mip-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 interpolate 27 Tri-linear Filtering using Mip maps • Interpolate between mipmaps Lower Res. Mip Map Screen Pixel R=155 G=132 B=30 R=229 G=208 B=119 R=233 G=227 B=143 R=178 G=179 B=90 R=199 G=187 B=96 Higher Res. Mip Map R=147 G=114 B=117 R=58 G=0 B=0 R=66 G=0 B=0 R=106 G=80 B=74 R=94 G=49 B=48 ⊗ R=147 G=118 B=72 28 Anisotropic Filtering • Not isotropic • Preserving details for oblique viewing angles (non-uniform surface) • AF calculates the “shape” of the surface before mapping • The number of pixels sampled depends on the distance and view angles relative to the screen •


View Full Document

GT ECE 4893 - 3D Rendering Pipeline (III)

Documents in this Course
Load more
Download 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 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 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?