• No results found

CSE 5542 - Real Time Rendering Week 2

N/A
N/A
Protected

Academic year: 2021

Share "CSE 5542 - Real Time Rendering Week 2"

Copied!
91
0
0

Loading.... (view fulltext now)

Full text

(1)CSE 5542 - Real Time Rendering Week 2.

(2) Graphics Processing. 2.

(3) Physical Approaches. 3.

(4) Projection-Based. 4.

(5) Projection 3D objects -> 2D image – Perspective – Parallel/Orthographic. 5.

(6) The Hardware. 6.

(7) More 2 come ….

(8) The API/System. 8.

(9) The Graphics Pipeline. 9.

(10) Object & Primitive & Vertex. http://www.3dcadbrowser.com/download.aspx?3dmodel=27814. 10.

(11) Object & Triangles & Vertices. http://www.mathworks.com/matlabcentral/fileexchange/37004-uniform-sampling-of-a-sphere.

(12) Primitives. 12.

(13) Example (old style) type of object location of vertex glBegin(GL_POLYGON) glVertex3f(0.0, 0.0, 0.0); glVertex3f(0.0, 1.0, 0.0); glVertex3f(0.0, 0.0, 1.0); glEnd( ); end of object definition 13.

(14) Example (GPU based) • Put geometric data in an array vec3 points[3]; points[0] = vec3(0.0, 0.0, 0.0); points[1] = vec3(0.0, 1.0, 0.0); points[2] = vec3(0.0, 0.0, 1.0);. • Send array to GPU • Tell GPU to render as triangle. 14.

(15) Camera Specification • Six degrees of freedom – Position of center of lens – Orientation. • Lens • Film size • Orientation of film plane. 15.

(16) Materials Optical properties – Absorption/Reflection: color Scattering • Diffuse • Specular • Transparent. – Texture –…. 16.

(17) Lights Types – – – –. Point sources vs distributed sources Spot lights Near and far sources Color properties. 17.

(18) Vertex Processing. Polygon Soup.

(19) Vertex Processing • Define object representations from one coordinate system to another – – – –. Object coordinates World Coordinates Camera (eye) coordinates Screen coordinates. • Enter Linear algebra – Transformations • Material properties. 19.

(20) World.

(21) Primitive Assembly Vertices collected into geometric objects – Line segments – Polygons – Curves and surfaces. 21.

(22) Clipping.

(23) Rasterization • Output are fragments • Fragments == potential pixels – Location in frame buffer – Color and depth attributes at vertices – Hidden surface removal ? • Vertex attributes are interpolated over objects. 23.

(24) Fragment Processing. 24.

(25) The Graphics Pipeline.

(26) What is Missing ?.

(27)

(28)

(29) Not Quite ?.

(30) Next ?.

(31) Computer Graphics Hardware: An Overview. Many Thanks to Prof. Han-wei Shen,.

(32) Graphics System. Monitor. Input devices. CPU/Memory. GPU.

(33) Raster Graphics System x y. video controller. A DAC Frame buffer.

(34) To Note . Raster: An array of picture elements. . Based on raster-scan TV technology. . The screen & rendering consists of discrete pixels. . Each pixel has a small display area.

(35) The Frame Buffer x y. video controller. A DAC Frame buffer.

(36) Frame Buffer • Low-latency memory to hold pixel attributes – color, alpha, depth, stencil mask, whoknows-what • Performance depends on – Size: screen resolution – Depth: color level – Speed: refresh speed.

(37) Depth. + bit/pixel: black and white + 8 bits/pixel: 256 levels of gray or color pallet index + 24 bits/pixel: 16 million colors.

(38) Image Digitization Recap. Sampling: Resolution Quantization: Measured Value.

(39) Image Digitization-Recap. Sampling. Quantization.

(40) The Architecture.

(41) (A way too) Simple Graphik System Frame buffer is part of main memory Scan Controller. CPU. Main Memory. System bus. Problem?. Frame buffer.

(42) Dedicated memory Video memory: On-board frame buffer: much faster to access Scan Controller. CPU. Main Memory. System bus. Frame buffer.

(43) Graphics Accelerator A dedicated processor for graphics processing Graphics Memory/ Frame buffer Graphics Processor. CPU. Main Memory. System bus. Scan Controller.

(44) Graphics Bus Interface PCI based technology. Graphics Memory/ Frame buffer Graphics Processor. Other Peripherals. Scan Controller. PCIe (8 GB/s) System Bus CPU. Main Memory.

(45)

(46) Graphics Accelerators.

(47) (Massively) Parallel Processors.

(48) Stream Processing.

(49) A Roadmap.

(50) The Main Drivers.

(51) GPU = General Purpose Units !.

(52) My Own nVidia.

(53) The Existentialist GPU. http://www.anandtech.com/show/4225/the-ipad-2review/5.

(54) Multi-Core Galore.

(55) argest Chip on Mother Boar.

(56)

(57) nVidia G80 GPU (2006) 128 streaming floating point processors @1.5Ghz ► 1.5 Gb Shared RAM with 86Gb/s bandwidth ► 500 Gflop on one chip (single precision) ►.

(58) nVidia G80 GPU Application. Application Data Assembler. Setup / Rstr / ZCull. Vtx Thread Issue. Prim Thread Issue. Vertex assembly. Frag Thread Issue. SP. SP. TF. SP. SP. TF. L1. SP. SP. TF. L1. SP. SP. SP. SP. TF. TF. L1. SP. TF. L1. L1. SP. SP. SP. TF. L1. SP. SP. TF. L1. Thread Processor. Vertex operations Primitive assembly Primitive operations. L1. Rasterization. L2 FB. L2 FB. L2 FB. L2 FB. L2 FB. L2 FB. Fragment operations Framebuffer.

(59) nVidia Fermi GPU (2009).

(60) nVidia Fermi GPU (2009).

(61) nVidia Kepler GK110 (2012).

(62) CPU/GPU Performance Gap.

(63) Why are GPUs Fast ?.

(64) Moore’s Law ++.

(65) Modern GPU has more ALU’ s.

(66) Stream Processing.

(67) Single Chip Design.

(68) The Scourge.

(69) Pros Und Cons ! • Very Efficient For – Fast Parallel Floating Point Processing – Single Instruction Multiple Data Operations – High Computation per Memory Access. • Not As Efficient For – – – –. Double Precision Logical Operations on Integer Data Branching-Intensive Operations Random Access, Memory-Intensive Operations.

(70) The Graphics Pipeline.

(71) Eine modern GPU Input from CPU. Host interface. Vertex processing. Triangle setup. Pixel processing. Memory Interface 64bits to memory. 64bits to memory. 64bits to memory. 64bits to memory.

(72) The Rendering Pipeline • Three conceptual stages. • A stage is pipeline & runs in parallel. Application. • Performance set by slowest stage • Modern graphics systems: – Software – hardware. Geometry Rasteriazer. Image.

(73) Hardware Rendering Pipeline. host interface. vertex processing. triangle setup. pixel processing. memory interface.

(74) Host Interface host interface. vertex processing. triangle setup. pixel processing. memory interface.  Communication bridge between CPU & GPU  Input: Commands from CPU; geometry information from memory  Output: Stream of vertices in object space with associated information - normals, texture coordinates, per vertex color etc..

(75) Transform Spaces. Object Space.

(76) Vertex Processing host interface. vertex processing. triangle setup. pixel processing. memory interface.  Input: Vertices from host interface in object space  Output: Vertices in screen space - No new vertices; no vertices are discarded  Operations: Simple linear transformation, or a complex operation morphing effects  What: Normals, texcoords etc are also transformed.

(77) Transform Spaces Object Space. Screen Space.

(78) Triangle Setup host interface. vertex processing. triangle setup. pixel processing. memory interface.  Input: Screen space geometry  Output: Raster/Pixels or Fragments  Operation: Each fragment has attributes computed with perspective-correct interpolation of triangle vertices.

(79) Transform Spaces Screen Space. Raster/Fragm ent.

(80) Triangle Setup Optimizations host interface. vertex processing. triangle setup. pixel processing.  O 1: Cull back-facing or outside viewing frustum  O 2: Hidden Surface Removal  O 3: Fragment is generated if and only if its center is inside the triangle. memory interface.

(81) Fragment Processing host interface. vertex processing. triangle setup. pixel processing. memory interface.  Input: Fragments & attributes - position, normal texcoord etc.  Output: Final color for pixel.  Operations: Texture mapping & math operations  Caveat: Bottleneck(s).

(82) Memory Interface host interface. vertex processing. triangle setup. pixel processing.  Input: Fragment  Output: framebuffer operations. memory interface.

(83) Programmability  Vertex, fragment processing, triangle set-up programmable  Programs executed for every vertex and every fragment.  Fully customizable geometry and shading effects. host interface. vertex processing. triangle setup. pixel processing. memory interface.

(84) Recap- The Graphics Pipeline.

(85) Advanced Musings.

(86) (courtesy: nvidia).

(87) (courtesy: nvidia).

(88) (courtesy: nvidia).

(89) (courtesy: nvidia).

(90) (courtesy: nvidia).

(91) The Holy Grail - Realism. (courtesy: nvidia).

(92)

References

Related documents

– Translate relative to lower arm and rotate about joint connecting to lower arm... Upper arm attached to

• Given a point light source and a polygon, the vertices of the shadow polygon are the projections of the original polygon’s vertices from a point source onto a surface...

• Given a point light source and a polygon, the vertices of the shadow polygon are the projections of the original polygon’s vertices from a point source onto a surface...

• Ideally perturb normal across surface of object and compute a new color at each interior point... Rougher Version n’

• Most state variables, attributes and related pre 3.1 OpenGL functions have

• Shader based OpenGL is based less on a state machine model than a data flow model.. • Most state variables, attributes and related pre 3.1 OpenGL functions have

Varying Length & Density • Vary overall length of hair by expanding shells • Vary density with noise texture as described • Both settings can be controlled per-pixel using

glPolygonOffset • Depth buffer contains “window space” depth values – Post-perspective divide means non-linear distribution – glPolygonOffset is guaranteed to be a window