Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.

Similar presentations


Presentation on theme: "Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology."— Presentation transcript:

1 Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

2 2 Today’s Topics Introduction Graphics Rendering Pipeline

3 3 Introduction Game Engine  Graphics side Graphics Engine  Physics side Physics Engine  A library that encapsulates the implementation of the low-level physics and provides high-level API for those applications that require enforcement of physical laws.

4 4 Introduction Core System Low-level system -Basic data structure -File Handling -Memory Management -Etc. Mathematics system -Basic Mathematics functions -Vector & Matrix Algebra -Quaternions -Etc. Object Management Interface to System

5 5 Physics EngineGraphics Engine Introduction Core System - Rendering system -Collision Detection -Physics system -Etc. Game Engine

6 6 Applications Physics EngineGraphics Engine Introduction Core System

7 7 Taken from the course notes by Tomas Akenine-Möller, Chalmers University of Technology State-of-the-Art Real-Time Rendering 2001

8 8 Taken from the course notes by Tomas Akenine-Möller, Chalmers University of Technology

9 9 Which one is a real photo, and which one is CG? Taken from the course notes by Tomas Akenine-Möller, Chalmers University of Technology

10 10 Complexity: 8 million triangles… Taken from the course notes by Tomas Akenine-Möller, Chalmers University of Technology

11 11 Photo-realistic Rendering… Taken from the course notes by Tomas Akenine-Möller, Chalmers University of Technology

12 12 Graphics Rendering Pipeline The main function of the pipeline render  Generate, or render, a two-dimensional image. Given a virtual camera, three-dimensional objects, light sources, lighting models, textures and more. The pipeline is the underlying tool for real time rendering.

13 13 Graphics Rendering Pipeline Example

14 14 Graphics Rendering Pipeline Architecture  Three conceptual stages – the engine of the rendering pipeline Each of these stages is usually a pipeline in itself.

15 15 Graphics Rendering Pipeline Architecture  Conceptual stages Application, geometry and rasterizer  Functional stages Has a certain task to perform But does not specify the way that task is executed in the pipeline  Pipeline stages It is executed simultaneously with all the other pipeline stages.

16 16 Graphics Rendering Pipeline Architecture  Example The geometry stage may be divided into five functional stages. But it is the implementation of a graphics system that determines its division into pipeline stages.  A given implementation may combine two functional stages into one pipeline stage.  While it divides another, more time-consuming, functional stage into several pipeline stages or parallelizes it.

17 17 Graphics Rendering Pipeline Architecture  Determination of the rendering speed: the update speed of the images, fps (frames per second) The slowest of the pipeline stages

18 18 Graphics Rendering Pipeline Application Stage (executed on CPU)  Driven by the application and therefore implemented in software. Collision detection, acceleration algorithms, animations, force feedback, etc.  The developer has full control over what happens in the application stage.  At the end of the application stage, the geometry to be rendered is fed to the next stage. Rendering primitives, i.e., points, lines, triangles, etc.

19 19 Graphics Rendering Pipeline Application Stage (executed on CPU)  Rendering Primitives.  Most important task is to send rendering primitives (e.g. triangles) to the graphics hardware

20 20 Graphics Rendering Pipeline Geometry stage  Computes what is to be drawn, how it should be drawn and where it should be drawn.  Is responsible for the majority of the per- polygon operations or per-vertex operations.  Implemented either in software or in hardware. Transforms, projections, lightings, etc.

21 21 Graphics Rendering Pipeline Geometry stage  Functional stages: They form a single pipeline stage.  It performs a very demanding task. Model and view transform, lighting and shading, projection, clipping, screen mapping

22 22 Graphics Rendering Pipeline Geometry stage  Model and view transform Model coordinates -> model transform -> world coordinate or world space  The world space is unique. All models exist in the same space. Only the models that a camera sees are rendered.  The camera has a location in world space and a direction.

23 23 Graphics Rendering Pipeline Geometry stage  Model and view transform View transform : To facilitate projection and clipping, the camera and all the models are transformed with the view transform.  This transform makes the clipping and projection operations simpler and faster.

24 24 Graphics Rendering Pipeline Geometry stage  Model and view transform

25 25 Graphics Rendering Pipeline Geometry stage  Lighting and shading In order to lend models a more realistic appearance, the scene can be equipped with one or more light sources. Shading technique – The colors are given at the vertices of a triangle. Interpolation techniques are needed to cover the entire triangle.  Gouraud Shading, Phong Shading, etc.

26 26 Graphics Rendering Pipeline Geometry stage  Lighting and shading blue red green

27 27 Graphics Rendering Pipeline Geometry stage  Projection After lighting, rendering systems perform projection.  It transforms the view volume into a unit cube with its extreme points at (-1,-1,-1) and (1,1,1).  The unit cube is called the canonical view volume. Orthographic projection Perspective projection

28 28 Graphics Rendering Pipeline Geometry stage  Projection

29 29 Graphics Rendering Pipeline Geometry stage  Clipping Only the primitives wholly or partially inside the view volume need to be passed on to the rasterizer stage, which then draws them on the screen. The primitives that are partially inside the view volume require clipping. Due to the projection transformation, the clipping is done against the unit cube.  Consistency

30 30 Graphics Rendering Pipeline Geometry stage  Clipping

31 31 Graphics Rendering Pipeline Geometry stage  Screen Mapping The coordinates of the primitives from the previous stage are still three-dimensional. The x and y coordinates of each primitive are transformed to form screen coordinates.  Window coordinates.

32 32 Graphics Rendering Pipeline Geometry stage  Screen Mapping

33 33 Graphics Rendering Pipeline Rasterizer stage  Draws (renders) an image with use of the data that the previous stage generated. Given the transformed and projected vertices, colors and texture coordinates, the goal of the rasterizer stage is to assign correct colors to the pixels to render an image correctly.  Rasterization or scan conversion.  Per-pixel operations Color buffer.  It is responsible for resolving visibility. Z-buffer (depth buffer) is used.

34 34 Graphics Rendering Pipeline Rasterizer stage Geometric Primitives Rasterized Primitives

35 35 Example OpenGL Rendering Pipeline

36 36 OpenGL Rendering Pipeline Display Lists  All data (geometry or pixels) can be saved in a display list for current or later use. Cf. Immediate mode  When a display list is executed, the retained data is sent from the display list.

37 37 OpenGL Rendering Pipeline

38 38 OpenGL Rendering Pipeline Evaluators  All geometric primitives are eventually described by vertices.  Evaluators provide a method for deriving the vertices used to represent curves or surfaces. Parametric curves and surfaces : evaluate vertices using the control points and basis functions.

39 39 OpenGL Rendering Pipeline

40 40 OpenGL Rendering Pipeline Per-Vertex Operations  They convert the vertices into primitives. Vertex data transformation Texturing Lighting calculation etc. Primitive Assembly  Constructs complete geometric primitives They are transformed and clipped vertices with related color, depth and sometimes texture-coordinate values and guidelines for rasterization.

41 41 OpenGL Rendering Pipeline

42 42 OpenGL Rendering Pipeline Pixel Operations  From system memory Pixels are first unpacked into the proper number of components. Next the data is scaled, biased and processed by a pixel map. The results are clamped and then either written into texture memory or sent to the rasterization step.  From frame buffer If pixel data is read from the frame buffer

43 43 OpenGL Rendering Pipeline Pixel Operations  From frame buffer If pixel data is read from the frame buffer, pixel- transfer operations (scale, bias, mapping and clamping) are performed. Then, the results are packed into an appropriate format and returned to an array in system memory.

44 44 OpenGL Rendering Pipeline

45 45 OpenGL Rendering Pipeline Texture Assembly Rasterization  The conversion of both geometric and pixel data into fragments. Each fragment square corresponds to a pixel in the framebuffer. Anti-aliasing are taken into consideration. Color and depth values are assigned for each fragment square.

46 46 OpenGL Rendering Pipeline

47 47 OpenGL Rendering Pipeline Fragment Operations  1 st Operation: texturing  2 nd Operation: fog calculation  3 rd Operation: blending, dithering, logical operation, masking by a bitmask  4 th Operation: the thoroughly processed fragment is drawn into the appropriate framebuffer.

48 48 Q & A?


Download ppt "Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology."

Similar presentations


Ads by Google