Computer Graphics Chapter 9 Rendering.

Slides:



Advertisements
Similar presentations
Computer Graphics - Shading -
Advertisements

Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
3D Graphics Rendering and Terrain Modeling
1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
1 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
Computer Graphics - Class 10
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10: Computer Graphics Computer Science: An Overview Tenth Edition.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Chapter 10: Computer Graphics
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Illumination and Shading How to shade surfaces based on the position,orientation,characteristics of the surfaces and the light sources illuminating them.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Illumination and Shading
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics.
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Chapter 10: Computer Graphics
Computer Graphics Implementation II
© University of Wisconsin, CS559 Spring 2004
3D Graphics Rendering PPT By Ricardo Veguilla.
Unit-7 Lighting and Shading
Chapter 10: Computer Graphics
Chapter 14 Shading Models.
CSC461: Lecture 23 Shading Computation
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Lighting.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
Illumination and Shading
Fundamentals of Computer Graphics Part 6 Shading
Isaac Gang University of Mary Hardin-Baylor
Chapter IX Lighting.
CS5500 Computer Graphics May 29, 2006
Illumination and Shading
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Game Programming Algorithms and Techniques
Chapter 14 Shading Models.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
CS 480/680 Computer Graphics Shading.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

Computer Graphics Chapter 9 Rendering

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. RM

Computing Surface Normal V1 = P2P1 = (x2x1, y2y1, z2z1). V2 = P3P1 = (x3x1, y3y1, z3z1). N = V1  V2. Surface Normal: RM

Components of Surface Normal Nx = (y2y1) (z3z1)  (y3y1) (z2z1) Ny = (z2z1) (x3x1)  (z3z1) (x2x1) Nz = (x2x1) (y3y1)  (x3x1) (y2y1) OR Nx = y1(z2-z3)+ y2(z3-z1)+ y3(z1-z2) Ny = z1(x2-x3)+ z2(x3-x1)+ z3(x1-x2) Nz = x1(y2-y3)+ x2(y3-y1)+ x3(y1-y2) RM

Back-Face Culling Nz < 0  The polygon is hidden RM

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. RM

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

Back-Face Culling (Example) RM

Back-Face Culling (OpenGL) RM

Painter’s Algorithm RM

Painters Algorithm Basic Steps: Sort polygons in the ascending order of z-coordinates Fill polygons in the sorted order. RM

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. RM

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

Painters Algorithm Failure Conditions (2) Polygons with cyclic overlap. RM

Painter’s Algorithm Illustration of failure conditions Correct Wrong RM

Depth-Buffer Algorithm Z Minimum Depth Value Color Value RM Frame Buffer Depth Buffer

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. RM

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. RM

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. RM

Shading Models Vectors RM

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 RM

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 RM

Surface Properties 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. RM

Illumination Models Point Source Ambient Light Ambient Light Surface Element RM

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 Ia. Ambient light reflection from a surface is constant along all visible directions, and does not depend on the surface orientation. RM

Illumination Models Point Light Source Defined in terms of both the position of the source, and the intensity of the source Is. 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. RM

Light Perceived by the Viewer Diffuse Reflection Point Source  Id = Is diff cos Since diffuse scattering is uniform in all directions, the orientation of the polygon relative to the viewer is not significant. RM

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

Light Perceived by the Viewer Specular Reflection 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. RM

Light Perceived by the Viewer Ambient Reflection Ambient reflection is independent of surface orientation. Ambient reflection is independent of viewers position. The ambient light Ia is uniformly reflected with intensity Ia amb. This is denoted as the ambient reflection Iamb. Iamb = Ia amb RM

Computation of Total Reflected Light Total light intensity perceived by the user = Iamb+ Isp + Id = (Ia amb) + (Is spec cos f  ) + Is diff cos RM

Shading (OpenGL) RM

Flat and Smooth Shading Flat Shading Gouraud 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 RM

Gouraud Shading The color at P1 is obtained by linearly interpolating the colors C1 and C2. Similarly, the color at P2 is found by linearly interpolating the colors C3 and C4. Having found P1 and P2, the algorithm then fills along the scan line by linearly interpolating between P1 and P2 to determine the color at an intermediate pixel Q. RM

Flat and Smooth Shading (OpenGL) RM

Flat and Smooth Shading Flat Shading Gouraud Shading Gouraud shading provides a much smoother appearance of surfaces. RM

Texture Mapping (Examples) RM

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. RM

Texture Mapping Texture Space RM

Texture Mapping (OpenGL) RM

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