Presentation is loading. Please wait.

Presentation is loading. Please wait.

Game Programming 06 The Rendering Engine

Similar presentations


Presentation on theme: "Game Programming 06 The Rendering Engine"— Presentation transcript:

1 Game Programming 06 The Rendering Engine
2010년 2학기 디지털콘텐츠전공

2 Rendering in Video Games
Depth-Buffered Triangle Rasterization Virtual Scene Virtual Camera Various Light Sources Visual Properties Solving the Rendering Equation (Shading Equation)

3 Rendering in Video Games
Purpose of the rendering: Photorealism Stylized look (cartoon, sketch, watercolor and so on)

4 Describing a Scene Scene is composed of objects: Opaque (solid) object
Surfaces (triangles) define its shape Don’t care about inside Transparent object

5 Representing object (surface)
Surface: a two-dimensional sheet composed of an infinite number of points in 3D Representation Analytical form (parametric surface equation) Collection of Patches Triangle mesh

6 Representing object (surface)
Analytical form (parametric surface equation) Ex.) Sphere equation

7 Representing object (surface)
Collection of Patches Patch: a simple rectangular surfaces Similar to a quilting Ex.) NURBS, Bezier Surfaces, Subdivision Surface Quilt NURBS surface NURBS modeling

8 Representing object (surface)
Triangle mesh A piece-wise linear approximation to the surface Piece-wise linear approximation to a function Piece-wise linear approximation to a surface

9 Representing object (surface)
Triangle mesh Using a triangle because: It is the simplest type of polygon It is always planar It still remains a triangle after transformations such as affine (projective) transformation All graphics card support a hardware acceleration to draw it

10 Triangle Mesh Tessellation LOD (Level-of-detail)
A process of dividing a surface up into a collection of triangles LOD (Level-of-detail)

11 Triangle Mesh Winding Order
How to define the front/back face direction Counterclockwise (CCW) / Clockwise(CW) Counterclockwise winding order Computing normal direction

12 Triangle Mesh Representation of mesh Triangle list : 점의 좌표

13 Triangle Mesh Representation of mesh Indexed Triangle List : 점의 좌표 1 2
1 2 3 4 5 6 7 Vertex list: Indexed triangle list:

14 Triangle Mesh Other representation of mesh Triangle strip Triangle fan
Vertex list: Triangle strip Triangle fan

15 Model space Positions of a triangle mesh’s vertices are usually specified relative to a local coordinate system. (front/left/up) left up front

16 World space and mesh instance
Individual meshes are located in a scene (world) Mesh instance: Any one mesh might appear many times in a scene Representation: Reference mesh, and its transformation matrix red: model coord. black: world coord.

17 Visual properties of a surface
Information needed to define a final color in the rendered image: Direction of surface normal Diffuse color Shininess/reflectivity Roughness Texture Opacity or transparency Other optical properties : How light should interact with the surface

18 Introduction to Light What we see is a result of complex interactions of light with matter. Four main interactions of light Absorption Reflection Transmission / refraction (bent) Diffraction

19 Introduction to Light Absorbed by a surface Why does red look red?

20 Introduction to Light Reflected by a surface

21 Introduction to Light Transmitted through a media
Partially absorbed or refracted

22 Color model Color model: how to represent a color
RGB (Red-Green-Blue): RGB888 (8 bit for each channel: 0~255 integer) – 24 bit RGB565 (5 bit for red, and blue, 6 bit for green) – 16 bit HSV (Hue-Saturation-Value) LDR (Low Dynamic Range) vs. HDR (High Dynamic Range) HDR: RGB in a higher precision (float value)

23 Color model LDR with various exposes and tone mapping

24 Alpha channel Representing opacity
A fourth channel to RGB  RGBA or ARGB RGBA8888 – 32 bit per pixel RGBA5551 – 16 bit per pixel

25 Vertex Attributes Position vector (x, y, z) Vertex normal (nx, ny, nz)
Diffuse color (dr, dg, db) Specular color (sr, sg, sb) Texture coordinates (u, v) Skinning weights (w1, w2, …)

26 Attribute interpolation
Flat shading and Gouraud shading Gouraud Shading: Inside color is interpolated from the vertex colors

27 Texture maps To overcome the per-vertex attribute, using image to fill-in the polygons

28 Texture maps To overcome the per-vertex attribute, using image to fill-in the polygons + =

29 Texture maps Texture coordinates:
2D coordinate system defined on an image Denoted as (u,v): uv-coordinate u u v v

30 Types of textures Types of textures Diffuse map Bump map Normal map
Gloss map Environment map

31 Types of textures Diffuse map describing diffuse surface color

32 Types of textures Bump map (similarly displacement map)
Describes small perturbations in height A sphere without bump mapping (left). A bump map to be applied to the sphere (middle). The sphere with the bump map applied (right)

33 Types of textures Normal map: encodes normal vectors Low vs. high res.
Low res. + diffuse map Low res. + diffuse + normal

34 Types of textures Gloss map (similarly specular map)
encoding how shiny a surface should be

35 Types of textures Environment map
containing a picture of surrounding environment for reflection

36 Mipmapping Different resolution of the texture with respect to the distance between an object and a camera

37 OGRE::Mesh in action Get the sample file at our home page
Create your own cylinder mesh from scratch.


Download ppt "Game Programming 06 The Rendering Engine"

Similar presentations


Ads by Google