Download presentation
Presentation is loading. Please wait.
1
x86 and 3D graphics
2
Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that have the same material properties (AKA Mesh) –Texture – a 2D image that is wrapped on the surface of a Mesh
3
For Each Triangle... Geometry –transform each vertex (FP) Lighting –compute lighting from light sources and surface properties (FP) Rasterization –setup triangle for rasterization (FP) –perform shading & texture mapping during triangle fill (INT)
4
Rendering Process light source objects viewing plane X Y Z incident light perspective projection Mathematical models for light, objects & viewer create a 2D image via a 3D process
5
Coordinate Systems xwxw ywyw zwzw world xoxo yoyo zozo object xvxv yvyv zvzv viewer xlxl ylyl zlzl light
6
Transformation Transformantion change the coordinate system a point lies in Examples –Viewing Transformation - translate objects to viewer coordinate before projection to viewing plane –Shadows - translate objects to light source coordinates to calculate shadows
7
N L R S Lighting Process Surface Diffuse Light scatters in all directions Specular Light reflects in direction of reflection vector R V
8
Rasterization Now that we have transformed and lit polygons… actually, the vertices... And, we know where they appear on the screen… We have to fill their interiors!
9
Textures Image maps to apply surfaces. Gives impression of complex surface properties. Can substitute for lots of polys (eg, tree bitmap on a single rectangle, vs. thousands of leaf polys)
10
Rasterization (again)
11
Flat Fill
12
Some lighting
13
And textures
14
Demo
15
History of 3D Pipeline Partitioning Geometry Lighting Edge Setup Rasterization Application Software 3D Processor Does All First Generation 3D HW Accelerators Rasterization HW Geometry Lighting Edge Setup Application 2 nd Generation HW (1998-99) HW Geometry Lighting Edge Setup Rasterization Application 3 rd Generation HW (1999-2000) HW Geometry Lighting Edge Setup Rasterization Application
16
Memory BW: The problem Frame buffer - ~3MB Z buffer - ~3MB For each object: –Mesh (vertices and triangle connectivity) – 1KB – 1MB –Texture(s) - ~256KB Typical game frame – 8MB – 20MB
17
AGP: the Solution AGP (Accelerated Graphics Port) –Larger BW than PCI –Lower HW cost (less local RAM needed) Frame/Z buffers stored in graphics local memory Texturing from system memory
18
Memory traffic when using AGP
19
How does it work The AGP aperture is mapped as one chunk (1:1 mapping in CPU’s paging HW), both the gfx chip and the CPU reference the same addresses The GART is mapping AGP memory address to the system memory address (like paging HW in the CPU)
20
In the future Multi-texturing: More than one texture for surface, used for details maps, reflections, refractions, lighting tricks, etc.
21
Programmable HW Helps the developer in customizing its transform, lighting and texture operations
22
Programmable vertex machine
23
Programmable HW demos
24
backup
25
Shading Techniques Scan Line A B C LR P Polygon fill is done across the scanline Flat shading Color the whole polygon with one color Does not show highlights inside polygons Gouraud shading If the object surfaces are curved, we can approximate it by polygons Interpolating vertex intensity values along scanline Still does not show highlights inside polygons
26
Texture Mapping 1. Texture coordinates (s,t,q) for each vertex. These are interpolated along polygon edges. 2. Texture coordinate for each point on scanline is interpolated. Linear interpolation, or a quadratic approximation (for perspective correction) is used. 3. The (s,t) value maps into the source texture map. It usually does not fall on the center of a texel. 4. A texture mapping algorithm is applied to the nearest texel, and possibly surrounding texels, to determine the result. Texturing eats CPU MIPS & bandwidth. 20- 70% slower than flat shading. (s 0, t 0, q 0 ) (s 1, t 1, q 1 ) (s 2, t 2, q 2 ) (s i, t i ) 1 2 3 4 s = 0, t = 0s = 1, t = 0 s = 1, t = 1
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.