3d computer graphics in a nutshell guillaume caumon, january 2002

17
3D Computer 3D Computer Graphics in a Graphics in a Nutshell Nutshell Guillaume Caumon, January Guillaume Caumon, January 2002 2002

Upload: ellen-freeman

Post on 05-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

3D Computer 3D Computer Graphics in a Graphics in a

NutshellNutshellGuillaume Caumon, January Guillaume Caumon, January

20022002

Page 2: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

IntroductionIntroduction

Computer graphics is concerned Computer graphics is concerned with all the aspects of “drawing” on with all the aspects of “drawing” on computerscomputers

Performance is criticalPerformance is critical 3D Computer Graphics deals with 3D Computer Graphics deals with

the generation images from 3D the generation images from 3D objects.objects.

Page 3: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

The Rendering PipelineThe Rendering Pipeline

ApplicationApplication GeometryGeometry RasterizationRasterization

Pipeline = Linear succession of operationsPipeline = Linear succession of operations

Rendering speed = speed of the slowest step (bottleneck)Rendering speed = speed of the slowest step (bottleneck)

Page 4: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

ApplicationApplication

Software-based processing / modificationsSoftware-based processing / modifications

3D Model3D Model Rendering Rendering primitivesprimitives

meshingmeshing

decimationdecimation

animationanimation

collision detectioncollision detection

……

Page 5: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

GeometryGeometry

TransformsTransforms LightningLightning ProjectionProjection ClippingClipping

Page 6: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Geometry : TransformsGeometry : Transforms

Model CoordinatesModel Coordinates World CoordinatesWorld CoordinatesModel TransformModel Transform

Scaling, etc.Scaling, etc.

View TransformView Transform

Viewing CoordinatesViewing Coordinates

Page 7: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Geometry: lighting and Geometry: lighting and shadingshading

Simulate interaction of light with matter:Simulate interaction of light with matter:- Emission- Emission- Absorption- Absorption- Reflection- Reflection

Page 8: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Geometry: A Lightning Geometry: A Lightning EquationEquation

NN

LL

αα

ββ IIRR(())

νν : r, g or b : r, g or b

Ambient light coefficientAmbient light coefficientEx: (.1, .1, .1)Ex: (.1, .1, .1)

Material colorMaterial colorEx: (1, 0, 0)Ex: (1, 0, 0)

Shininess (s > 1) Shininess (s > 1)

Specular CoeficientSpecular CoeficientEx: (1, 1, 1)Ex: (1, 1, 1)

Page 9: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Geometry: ShadingGeometry: ShadingFlat shadingFlat shading: each triangle has : each triangle has the same colorthe same color

Gouraud shadingGouraud shading: colors are : colors are interpolated between verticesinterpolated between vertices

Phong shadingPhong shading: normal are : normal are interpolated and colors computedinterpolated and colors computedfor each pixelfor each pixel

Page 10: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Geometry: ProjectionGeometry: Projection

Virtual Device CoordinatesVirtual Device CoordinatesViewing CoordinatesViewing Coordinatesnormalizationnormalization

Perspective/Perspective/parallelparallel

Page 11: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Geometry: ClippingGeometry: Clipping

Page 12: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Geometry: Device Geometry: Device CoordinatesCoordinates

My WindowMy Window

Unit CubeUnit Cube

Page 13: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

RasterizationRasterization

Per-pixel operations: ray-tracingPer-pixel operations: ray-tracing Screen = matrixScreen = matrix

TexturingTexturing

Aliasing / antialiasingAliasing / antialiasing

Scan conversion of lines: Scan conversion of lines: naive versionnaive versionBresenham algorithmBresenham algorithm

Scan conversion of polygons Scan conversion of polygons

Page 14: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Graphics HardwareGraphics Hardware

Quickly evolvingQuickly evolving

Main principle: use of Main principle: use of buffersbuffers

Color buffer : Color buffer : 1 byte per pixel (256) + lookup tables1 byte per pixel (256) + lookup tables2 bytes per pixel (65 536) “high color”2 bytes per pixel (65 536) “high color”3+1 bytes per pixel bpp (16 millions) “true color” + alpha channel3+1 bytes per pixel bpp (16 millions) “true color” + alpha channel

Depth buffer : Depth buffer : 16 to 32 bit per pixel16 to 32 bit per pixel

Page 15: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

Graphics Hardware (II)Graphics Hardware (II)

Double buffering : Double buffering : • show the front buffer while rasterizing the show the front buffer while rasterizing the back bufferback buffer• swap buffers in synchronization with the swap buffers in synchronization with the screen refreshscreen refreshto get the new frameto get the new frameStencil buffer : Stencil buffer :

allows high-level operations (antialiasing, filtering, etc.) allows high-level operations (antialiasing, filtering, etc.)

See OpenGL programmer’s reference for more detailsSee OpenGL programmer’s reference for more details

Page 16: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

ConclusionConclusion

3D Graphics require intensive computations3D Graphics require intensive computations

Yet, 3D Graphics are time-critical Yet, 3D Graphics are time-critical BottlenecksBottlenecksDisplay listsDisplay lists

Only low-level graphics have been described.Only low-level graphics have been described.

Scene GraphsScene GraphsSelection and Selection and toolstools

}}See OpenInventor, VTK, etc.See OpenInventor, VTK, etc.

Page 17: 3D Computer Graphics in a Nutshell Guillaume Caumon, January 2002

References and further References and further readingreading

Foley, van Dam, Feiner, Hughes,Foley, van Dam, Feiner, Hughes, Computer Graphics Computer Graphics Principle and practice,Principle and practice, 22ndnd edition edition. Addisson Wesley, . Addisson Wesley, 19971997

Moller, Haines,Moller, Haines, Real-Time Rendering. Real-Time Rendering. AK Peters, 1999 AK Peters, 1999 ((http://www.realtimerendering.comhttp://www.realtimerendering.com))

The The Graphic GemsGraphic Gems series, Academic Press. series, Academic Press. Neider, Davis, Woo, Neider, Davis, Woo, OpenGL Programming GuideOpenGL Programming Guide. .

Addisson Wesley, 1993Addisson Wesley, 1993 Wernecke, Wernecke, The Inventor Mentor, release 2, The Inventor Mentor, release 2, Addisson Addisson

Wesley,1994 Wesley,1994 Schroeder, Martin, Lorensen, Schroeder, Martin, Lorensen, The Visualization The Visualization

Toolkit, 2Toolkit, 2ndnd edition. edition. Prenctice Hall, 1998Prenctice Hall, 1998 Proceedings of Siggraph, Visualization, Eurographics, Proceedings of Siggraph, Visualization, Eurographics,

etc.etc.