Surface Rendering Methods

Similar documents
Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Shading and Illumination

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

Illumination and Shading

LIGHTING AND SHADING

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

INF3320 Computer Graphics and Discrete Geometry

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

CSCI 4620/8626. Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17)

Illumination Models and Surface-Rendering Methods. Chapter 10

CS5620 Intro to Computer Graphics

Illumination and Shading

Computer Graphics. Illumination and Shading

Light Sources. Spotlight model

Reflection and Shading

CS Surface Rendering

CS 325 Computer Graphics

Interpolation using scanline algorithm

Computer Graphics Lighting

Computer Graphics Lighting. Why Do We Care About Lighting?

Illumination and Shading

Supplement to Lecture 16

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

Why we need shading?

Photorealism: Ray Tracing

Illumination and Shading ECE 567

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Illumination Models & Shading

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

COMP371 COMPUTER GRAPHICS

6. Illumination, Lighting

Illumination & Shading I

Illumination. Courtesy of Adam Finkelstein, Princeton University

hw1-2 review hw 3 questions?

Lighting and Reflectance COS 426

Virtual Reality for Human Computer Interaction

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Lighting and Shading

蔡侑庭 (Yu-Ting Tsai) National Chiao Tung University, Taiwan. Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification

Illumination & Shading: Part 1

Lighting. CSC 7443: Scientific Information Visualization

CEng 477 Introduction to Computer Graphics Fall

Illumination and Shading

Graphics and Visualization

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

Illumination and Reflection in OpenGL CS 460/560. Computer Graphics. Shadows. Photo-Realism: Ray Tracing. Binghamton University.

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Introduction to Radiosity

Introduction to Computer Graphics 7. Shading

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Lights, Colour and Materials In OpenGL

surface: reflectance transparency, opacity, translucency orientation illumination: location intensity wavelength point-source, diffuse source

Shading, Advanced Rendering. Week 7, Wed Feb 28

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Sung-Eui Yoon ( 윤성의 )

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Illumination Models. To calculate the color of an illuminated position on the

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Light Transport Baoquan Chen 2017

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Homework #2. Shading, Ray Tracing, and Texture Mapping

CS770/870 Spring 2017 Color and Shading

Recursive Ray Tracing. Ron Goldman Department of Computer Science Rice University

Indirect Illumination

5.2 Shading in OpenGL

Ray Tracing. Kjetil Babington

Chapter 7 - Light, Materials, Appearance

9. Illumination and Shading

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

Graphics and Interaction Surface rendering and shading

Lecture outline Graphics and Interaction Surface rendering and shading. Shading techniques. Introduction. Surface rendering and shading

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

Introduction to Visualization and Computer Graphics

The Traditional Graphics Pipeline

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Anti-aliasing. Images and Aliasing

The Traditional Graphics Pipeline

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

Comp 410/510 Computer Graphics. Spring Shading

Indirect Illumination

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

Illumination. Michael Kazhdan ( /657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

The Traditional Graphics Pipeline

CPSC / Illumination and Shading

Topics and things to know about them:

Computer Graphics. Illumination and Shading

From Graphics to Visualization

Chapter 3. Illumination Models and Surface-Rendering Methods. Department of Computer Science and Engineering

Transcription:

Surface Rendering Methods 6 th Week, 2008 Sun-Jeong Kim Polygon Rendering Methods Determining the surface intensity at every projected pixel position using an illumination model Light-material interactions Polygonal shading Flat shading Gouraud shading Phong shading 2

Flat Shading (1) Constant-intensity surface rendering Assigning the same color to all projected surface positions Determining the intensity (RGB color) at a single surface position (ex. a vertex or the polygon centroid) Fast and simple method One rendering calculation for each polygon 3 Assumptions: Flat Shading (2) The polygon is one face of a polyhedron (not a section of curved surface) All light sources are sufficiently far from the surface N L and attenuation constant Viewing position is sufficiently far from the polygon V R constant Flat Shading Smooth Shading 4

Gouraud Shading (1) Intensity-interpolation surface rendering Linearly interpolating vertex intensity values across the polygon faces Vertex normal vector One rendering calculation for each vertex Averaging the surface normal vectors of all polygons sharing that vertex n N k = 1 k NV = n N N V = N N 1 1 k = 1 + N + N 2 2 k + N + N 3 3 + N + N 4 5 4 Procedures: Gouraud Shading (2) Determine the average unit normal vector at each vertex of the polygon Apply an illumination model at each polygon vertex to obtain the light intensity Linearly interpolate the vertex intensity over the projected area of the polygon y4 y2 y1 y4 I 4 = I1 + I 2 y y y y I p = x x 1 2 1 y 2 x x x 5 p p 4 I 4 + 5 x4 x5 x4 I 5 6

Gouraud Shading (3) Wireframe Flat Shading Gouraud Shading 7 Phong Shading (1) Normal-vector interpolation rendering More accurate interpolation method more realistic One rendering calculation for each pixel More computation than Gouraud method Procedures: Determine the average unit normal vector at each vertex of the polygon Linearly interpolate t the vertex normals over the projected area of the polygon Apply an illumination model at positions along scan lines to calculate pixel intensities 8

Phong Shading (2) Wireframe Flat Gouraud Phong 9 Local vs. Global Rendering Local lighting model cannot handle: Blocking some of the light source from reaching the other spheres Scattering some light among spheres Global Lighting Model Local Lighting Model 10

Global Effects Shadow Translucent Surface Multiple Reflection 11 Ray Tracing Continuing to bounce the pixel ray around in the scene to collect the various intensity contribution Generalization of the basic ray casting procedure Global refection and transmission effects Highly realistic and photo-realistic ti display 12

Basic Ray Tracing Algorithm (1) The coordinate system for ray tracing Collecting the intensity contributions for a particular pixel by tracing a light path backward from the pixel position into the scene 13 Basic Ray Tracing Algorithm (2) Primary rays ray casting Visible surface detection Secondary rays reflection and refraction rays Repeating the ray-processing procedures for the secondary rays 14

Basic Ray Tracing Algorithm (3) Ray tracing tree The list of surfaces intersecting ray for each pixel Left reflection, right refraction Maximum depth a user option Terminating a path in the binary tree for a pixel if any one of the following conditions is satisfied: The ray intersects no surfaces The ray intersects a light source The tree has been generated to its maximum allowable depth 15 Basic Ray Tracing Algorithm (4) Reflection R = u ( 2u N)N Refraction (transparency) T η i ηi u cosθ r cosθi N ηr ηr = i Snell s law: η sin θ = η sin θ r r i i η r η i 16

Basic Ray Tracing Algorithm (5) 17 Radiosity More precisely lighting effects Considering the physical laws governing the radiant- energy transfers Accurately describing diffuse reflections from a surface Radiosity The quantity of radiant flux per unit area that is leaving a surface Radiance The radiant flux or the radiosity per unit solid angle (t (steradian) 18

Basic Radiosity Model Computing radiant-energy intersections between all surfaces in a scene Radiosity equation B k = E k + ρ n k j= 1 B j F jk B k : radisoity of surface k E k : emission of surface k F j A surfk j πr 2 jk = ρ k : reflectivity of surface k surf j F jk : form factor for surfaces j and k 1 cosφ cosφk da da The fractional amount of radiant energy from surface j that reaches surface k k j 19 Progressive Refinement Radiosity (1) Disadvantage of radiosity method Considerable processing time to calculate the form factors Tremendous storage requirements Progressive refinement First, light sources are chosen (the highest h radient energy) Other patches are selected based on the amount of light received from the light sources 20

Progressive Refinement Radiosity (2) 1 iteration 2 iterations 24 iterations 100 iterations 21 Progressive Refinement Radiosity (3) 22

OpenGL Surface-Property Function Material reflectivity properties of a surface glmaterial{if}(glenum face, GLenum name, TYPE value); glmaterial{if}v(glenum face, GLenum name, TYPE *value); face GL_FRONT, GL_BACK, GL_FRONT_AND_BACK name GL_DIFFUSE, GL_SPECLAR, GL_AMBIENT, GL_AMBIENT_AND_DIFFUSE, GL_EMISSION, GL_SHININESS 23 Default Light & Material 24

Result Default Light & Material 25 Specifying Material (1) 26

Result Specifying Material (1) 27 Specifying Material (2) 28

Result Specifying Material (2) 29 Specifying Material (3) 30

Result Specifying Material (3) 31 Exercises (1) 새로운 Material 값들을설정하시오. 각 Parameter 의의미를파악하시오. 자신이만든조명과함께 Rendering 하시오. 어떻게보이는가? 32

Specifying Material (4) 33 Specifying Material (5) 34

Specifying Material (6) 35 Specifying Material (7) 36

What s Happening? 37 Exercises (2) Cone 에자신이만든 Material 을지정해보시오. 반드시 4 개 Object 가다른 Material 을가지고있어야함 38

Color Material (1) Specifying a material by the color referred to by all following calls to glcolor*( ) glenable(gl_color_material); glcolormaterial(glenum face, GLenum name); face GL_FRONT, GL_BACK, GL_FRONT_AND_BACK name GL_DIFFUSE, GL_SPECLAR, GL_AMBIENT, GL_AMBIENT_AND_DIFFUSE, GL_EMISSION 39 Color Material (2) 40

Color Material (3) 41 Result Color Material 42

Shading Model in OpenGL Computing a color for only the first vertex in a polygon glshademodel( GL_FLAT ); Performing the lighting calculation at each vertex and then interpolating i vertex colors across the polygon ( default) glshademodel( GL_SMOOTH ); Enabling automatic normalization Incurring a performance penalty glenable( GL_NORMALIZE ); 43 Flat Shading in OpenGL Constant shading glshademodel(gl_flat); p 1 n p 0 glbegin(gl_triangles); glnormal3fv(n); glvertex3fv(p1); glvertex3fv(p2); glvertex3fv(p3); glend(); glvertex3fv(p3); n = ( p 1 p 0 ) ( p 2 p 0 ) p 2 44

Smooth Shading in OpenGL Gouraud shading default glshademodel(gl_smooth); glbegin(gl_triangles); glnormal3fv(n1); glvertex3fv(p1); glnormal3fv(n2); glvertex3fv(p2); glnormal3fv(n3); glvertex3fv(p3); glend(); n = n n + 1 + n2 + n3 + n4 1 + n2 + n3 + n4 Note silhouette edge 45 Flat Shading 46

Result Flat Shading 47 Exercises (3) 서로다른재질을사용하여모델링하시오. 48