Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.

Similar presentations


Presentation on theme: "1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object."— Presentation transcript:

1 1 Computer Graphics Chapter 9 Rendering

2 [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object model appear more realistic on the display screen. These processes include  The elimination of surfaces (polygonal segments) on the object that are not visible with respect to the user’s view direction.  Incorporating shading and shadowing effects.

3 [9]-3RM Computing Surface Normal V 1 = P 2  P 1 = (x 2  x 1, y 2  y 1, z 2  z 1 ). V 2 = P 3  P 1 = (x 3  x 1, y 3  y 1, z 3  z 1 ). N = V 1  V 2. Surface Normal:

4 [9]-4RM Components of Surface Normal N x = (y 2  y 1 ) (z 3  z 1 )  (y 3  y 1 ) (z 2  z 1 ) N y = (z 2  z 1 ) (x 3  x 1 )  (z 3  z 1 ) (x 2  x 1 ) N z = (x 2  x 1 ) (y 3  y 1 )  (x 3  x 1 ) (y 2  y 1 ) N x = y 1 (z 2 -z 3 )+ y 2 (z 3 -z 1 )+ y 3 (z 1 -z 2 ) N y = z 1 (x 2 -x 3 )+ z 2 (x 3 -x 1 )+ z 3 (x 1 -x 2 ) N z = x 1 (y 2 -y 3 )+ x 2 (y 3 -y 1 )+ x 3 (y 1 -y 2 ) OR

5 [9]-5RM Back-Face Culling N z < 0  The polygon is hidden

6 [9]-6RM Back-Face Culling - Limitations Requires specific ordering of the vertices in the polygon table to determine the outward normal direction. The algorithm will work only with convex objects. A polygon is either completely displayed, or totally eliminated from the display.

7 [9]-7RM Back-Face Culling (General Case) V.N > 0  The polygon is hidden

8 [9]-8RM Back-Face Culling (Example)

9 [9]-9RM Back-Face Culling (OpenGL)

10 [9]-10RM Painter’s Algorithm

11 [9]-11RM Painters Algorithm Basic Steps:  Sort polygons in the ascending order of z-coordinates  Fill polygons in the sorted order.

12 [9]-12RM Painters Algorithm - Limitations Requires sorting of polygons. All polygons must be necessarily filled. May lead to erroneous images if a failure condition (see below) occurs.

13 [9]-13RM Polygons with depth and region overlap. Z (1) (2) Polygons having both depth-overlap and region overlap may require re-sequencing of the polygons in the sorted list. Painters Algorithm Failure Conditions (1)

14 [9]-14RM Polygons with cyclic overlap. Painters Algorithm Failure Conditions (2)

15 [9]-15RM Painter’s Algorithm Illustration of failure conditions Wrong Correct

16 [9]-16RM Z Depth-Buffer Algorithm Frame BufferDepth Buffer Color Value Minimum Depth Value

17 [9]-17RM Depth-Buffer Algorithm For each pixel (i, j), a line passing through the pixel and the viewer is considered, and the depths of the polygons on this line are computed. The value d(i, j) in the depth buffer contains the pseudo-depth of the closest polygon encountered at pixel (i, j). The value p(i, j) in the frame buffer (the color of the pixel) is the color of the closest polygon.

18 [9]-18RM Depth-Buffer Algorithm Limitations:  The algorithm requires a large amount of additional memory to store the pseudo depth at each pixel value.  Since the analysis is based on a point by point test, the algorithm is time consuming.

19 [9]-19RM Shading Models A shading model dictates how light is scattered or reflected from a surface. A surface is shaded by adjusting the color intensity value of each polygon according to the shading algorithm. Main components:  Light source vector, surface normal vector, viewer direction.  Material characteristics of the surface  The illumination model.

20 [9]-20RM Shading Models Vectors

21 [9]-21RM Shading Models Surface Properties (1)  abs (Coeff. of absorption): Specifies how much of the incident light is absorbed. If all of the incident light is absorbed, the object appears black.  spec (Coeff. of specular reflection) Specifies how much of the incident light is specularly reflected in one direction. For a highly reflective surface such as a mirror, the value is close to 1.0

22 [9]-22RM Shading Models Surface Properties (2)  diff (Coeff. of diffuse reflection): Diffuse scattering occurs when the incident light is re-radiated uniformly in all directions. For a rough non-reflective surface, the value is close to 1.0.  amb (Coeff. of ambient reflection): Specifies how much of the ambient light is reflected by the surface. Often this is same as the diffuse reflection coefficient  diff.  abs +  spec +  diff = 1.0

23 [9]-23RM I If I is the incident light intensity, then I  abs is absorbed by the surface. I  spec is specularly reflected. I  diff is diffusely reflected. Surface Properties

24 [9]-24RM Surface Element Ambient Light Ambient Light Point Source Illumination Models

25 [9]-25RM Illumination Models Ambient Light Produces uniform illumination (also known as background light). Has no spatial or directional characteristics. Assumed to be incident from all directions with constant intensity I a. Ambient light reflection from a surface is constant along all visible directions, and does not depend on the surface orientation.

26 [9]-26RM Illumination Models Point Light Source Defined in terms of both the position of the source, and the intensity of the source I s. The reflection from a point light source depends on the surface orientation, and varies with respect to the view direction. Light source reflection consists of both specular reflection and diffuse reflection.

27 [9]-27RM Light Perceived by the Viewer Diffuse Reflection Point Source  I d = I s  diff cos  Since diffuse scattering is uniform in all directions, the orientation of the polygon relative to the viewer is not significant.

28 [9]-28RM Light Perceived by the Viewer Specular Reflection The vector h = s + v is known as the half-way vector. f is an experimentally determined constant I sp = (I s  spec cos f  )

29 [9]-29RM Light Perceived by the Viewer Specular Reflection is specular reflection parameter determine type of surface. (in OpenGL the value range 0 to 128). A very shiny surface is modeled with a large value, and smaller value (down to 0) are used for dull object. f is specular reflection parameter determine type of surface. (in OpenGL the value range 0 to 128). A very shiny surface is modeled with a large value, and smaller value (down to 0) are used for dull object.

30 [9]-30RM Light Perceived by the Viewer Ambient Reflection Ambient reflection is independent of surface orientation. Ambient reflection is independent of viewers position. The ambient light I a is uniformly reflected with intensity I a  amb. This is denoted as the ambient reflection I amb. I amb = I a  amb

31 [9]-31RM Computation of Total Reflected Light Total light intensity perceived by the user = I amb + I sp + I d = (I a  amb ) + (I s  spec cos f  ) + I s  diff cos 

32 [9]-32RM Shading (OpenGL)

33 [9]-33RM Flat and Smooth Shading The entire polygon is drawn with the same shade or color. The shades at the vertices are interpolated to determine the shade at an interior point Flat Shading Gouraud Shading

34 [9]-34RM Gouraud Shading The color at P 1 is obtained by linearly interpolating the colors C 1 and C 2. Similarly, the color at P 2 is found by linearly interpolating the colors C 3 and C 4. Having found P 1 and P 2, the algorithm then fills along the scan line by linearly interpolating between P 1 and P 2 to determine the color at an intermediate pixel Q.

35 [9]-35RM Flat and Smooth Shading (OpenGL)

36 [9]-36RM Flat and Smooth Shading Gouraud shading provides a much smoother appearance of surfaces. Flat Shading Gouraud Shading

37 [9]-37RM Texture Mapping (Examples)

38 [9]-38RM Texture Mapping The basic techniques begin with some texture functions, texture(s,t),in texture space which is traditionally marked off by parameters named s and t. The function texture(s,t) produces a color or intensity value for each value of s and t between 0 and 1. Texture mapping is the process of mapping a region in the 2D texture space to a region in the 3D space defined by the boundary points.

39 [9]-39RM Texture Mapping Texture Space

40 [9]-40RM Texture Mapping (OpenGL)

41 [9]-41RM Texture types Bitmap Textures: Often formed from bitmap representations of images. Defined by a mathematical function or procedure.


Download ppt "1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object."

Similar presentations


Ads by Google