170 likes | 367 Vues
3D graphics. For client processors it ’ s the big gorilla of compute requirements. Image creation/ reconstruction/ 2 and 3D projection/ animation/ visualization Must be interactive for image creation and smoothly(visually) manage motion and update dynamics. 3D graphics.
E N D
3D graphics • For client processors it’s the big gorilla of compute requirements. • Image creation/ reconstruction/ 2 and 3D projection/ animation/ visualization • Must be interactive for image creation and smoothly(visually) manage motion and update dynamics
3D graphics Some basic requirements: • smooth motion 15 frames/sec • frame size 1260 x 1024 down to 512 x 512 • pixel 24b (3 colors, RGB) + 8b color control sometimes double buffered and z buffered (3D) up to 96b total. • frame size x pixel size = frame buffer • frame buffer also used to refresh video @ 30 or 60 Hz
Operations, simple 2D type • Limited primitives: polygon, line, circle, ellipse • ops: scale, translate, overlay and clip • typical op is S op D =D; op is replace, or, xor, and … applied to blocks of pixels • computations linear, y = mx + b, or quadratic x2 + y2 = R2 ; mostly on index values…needs say 16b, sometimes 32b FP computation
Clipping • Requires finding point at which line (edge) intersects plane or another line then filling included spaces…need to find intersect line • Computation of the form t = NxDP/ D
Video controllers and VRAM • Video controller is responsible for CRT refresh usually 30 or 60 Hz. • Must access the frame buffer for data, can be a significant memory bandwidth limit… the larger the DRAM the worse the problem • Solution is VRAM; two ported DRAM, one is a serial port which reads out all pixels in a scan line in one cycle then buffers and forwards it.
2D transformations • Translate (move), Scale (change size) and Rotate…can be viewed as a matrix, M operating on a point, P(x,y) • M is a 3 x 3 matrix expressing T, S and R parameters… Reducible to 4 mpy and 4 adds per point.
3D transformations • Need now to transform object to a new coordinate system…then do scaling, rotation…then retransform to viewer’s plane • M now a 4 x 4 matrix applied several times • Maybe 25 multiplies and 18 adds per point • Note: not all points need transformation, only vertices
Triangles and polygons • Gather pixels into objects with shared edges then deal only with transforming the vertices and the normal surface vector. • Maybe 100 pixels per triangle or polygon; fine resolution might use 10 pixels/ object • Object may consist of 10,000 triangles, 30k vertices … not 1M pixels
Shading/ lighting • Diffuse ambient light creates no shading... Simplest • Illumination can vary by angle between N (normal to the polygon) and L (the source) • Source of illumination can be a point or a region (expressed as cosng). The larger the n the narrower the beam • Compute N and L across polygon face
Shading • Can interpolate shade across a polygon • Gourand shading interpolates shade across edges, reduces effect of intensity change. • Phong shading (and illumination) interpolates surface normal vector across polygons then interpolates illumination.
Texture • Surface of object polygons perturbed by applying “bump map”; add map values to polygon values.
Shadows and beyond • Can be computationally intensive, project each polygon on light source find projection on other polygons • 3D shadows, transparency, fog and atmospherics all complicate the computation.
Compute requirements Assume a very simple image. • 10k triangles with 100 pixels/ triangles • 1024x1024 RGB display updated 10 frames/sec • diffuse ambient illumination • shading, no shadows • no texture, fog, transparency • no clipping from multiple objects
Compute requirements • Transform/ rotate takes 25 multiplies & 18 adds/vertex … 10k x 3 = 30k vertices • Computing viewer’s projection of the object surface (which triangles are in view) takes 18 multiplies & 14 adds / vertex • Simple lighting 12 mpy & 5 adds/vertex • Clipping 3 divides/ vertix • Plus…
Compute requirements • Net about 2M multiplies &1.4M adds/frame • About 30 Mflops depending on image clipping adds 1M divides/sec • Plus about 50 Maps to the frame buffer. • Refined images (10 pixels/polygon) plus Phong illumination and Gourand shading plus shadows, texture, etc. …100x to 400x • WHEW
Designing for multimedia Must support very high bandwidth arithmetic • pipelined integer and fp • optimized for 8, 16 and 32b operands • instructions set support for sub word concurrency • divide and sqrt can be important as well as trig functions.
Designing for multimedia Must support very high bandwidth memory • structured memory access VRAM • VRAM on chip? • structured L1 D cache • large L2; maybe also structured or bypassed as with vector processor.