Computer Vision Systems. Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations

Similar documents
w Foley, Section16.1 Reading

Introduction to Visualization and Computer Graphics

Visualisatie BMT. Rendering. Arjan Kok

Rendering Light Reflection Models

Illumination and Shading

Computer Graphics. Illumination and Shading

Illumination. Illumination CMSC 435/634

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Local Reflection Models

CPSC / Illumination and Shading

Comp 410/510 Computer Graphics. Spring Shading

Pipeline Operations. CS 4620 Lecture 10

Reflection models and radiometry Advanced Graphics

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

University of Victoria CSC 305 Shading. Brian Wyvill 2016

CS Illumination and Shading. Slide 1

Introduction to Computer Graphics 7. Shading

CS5620 Intro to Computer Graphics

Illumination Modelling

Illumination and Shading

CPSC 314 LIGHTING AND SHADING

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

Illumination & Shading: Part 1

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

9. Illumination and Shading

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

CSE 681 Illumination and Phong Shading

Illumination & Shading

Shading. Brian Curless CSE 457 Spring 2017

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Simple Lighting/Illumination Models

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Illumination in Computer Graphics

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

Illumination and Shading - II

CS770/870 Spring 2017 Color and Shading

Shading I Computer Graphics I, Fall 2008

Shading. Brian Curless CSE 557 Autumn 2017

Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces

Reflection and Shading

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF

Shading. Why we need shading. Scattering. Shading. Objectives

CS 5625 Lec 2: Shading Models

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

03 RENDERING PART TWO

Illumination Models & Shading

Chapter 2 A top-down approach - How to make shaded images?

Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 557 Fall Required: Shirley, Chapter 10

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

The Viewing Pipeline Coordinate Systems

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

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Pipeline Operations. CS 4620 Lecture 14

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Computer Graphics: 3-Local Illumination Models

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

Game Technology. Lecture Physically Based Rendering. Dipl-Inform. Robert Konrad Polona Caserman, M.Sc.

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

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

Lecture 4: Reflection Models

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

Computer Graphics. Illumination and Shading

Surface Reflection Models

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

Complex Shading Algorithms

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

Computer Graphics 7: Viewing in 3-D

CS452/552; EE465/505. Intro to Lighting

Lab 9 - Metal and Glass

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

CS 130 Final. Fall 2015

Rasterization Overview

Lighting and Shading

Computer Graphics and GPGPU Programming

Graphics The Rasterization Pipeline Projection, Visibility, & Shading

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

The Rasterizer Stage. Texturing, Lighting, Testing and Blending

BRDF Computer Graphics (Spring 2008)

Sung-Eui Yoon ( 윤성의 )

CEng 477 Introduction to Computer Graphics Fall

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading.

Graphics Hardware and Display Devices

CS 325 Computer Graphics

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

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

Level of Details in Computer Rendering

Light Reflection Models

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

dq dt I = Irradiance or Light Intensity is Flux Φ per area A (W/m 2 ) Φ =

Ray-Tracing. Misha Kazhdan

How do we draw a picture?

Models and Architectures

Illumination and Shading

Supplement to Lecture 16

Transcription:

Computer Vision Systems Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations

Viewing Systems Viewing Transformation Projective Transformation 2D Computer Graphics Devices

Viewing System Example view volume View (reference) point

Viewing System Example 2 vectors + 1 point 1 view plane distance (near plane) + 1 far plane distance A view volume A view window A (perspective) projection

View Volume The truncated pyramid in view space against which the polygons that make up the scene are clipped. x y z z v v v v hz ± d hz ± d d f v v 2h: view plane window dimension d: view plane distance & near plane distance f: far plane distance

Viewing Plane Projection Define a 3D screen space and a point: Requirements: [ xs, ys, zs,1] 1) Normalize z s maximize precision 2) Transform lines in view space into screen space. 3) Transform planes in view space into screen space.

Viewing Plane Projection (cont.) z s A + B/z v Constraints of choosing A and B B < : z v increases z s increases too depth Normalize z s : z v [d, f] [, 1] z s

Viewing Plane Projection (cont.) d f z d f z hz y d y hz x d x v s v v s v v s ) / (1 Note: h insures that xs and ys falls in the range of [-1, 1] over the square screen. v v v v z w d f df d f fz Z y h d Y x h d X ) /( ) /( pers v v v T z y x w Z Y X ] 1 [ ] [

Viewing Plane Projection (cont.) pers2 pers1 pers T T d) fd(f d) f(f d/h d/h d) fd(f d) f(f d/h d/h T 1 1 1 1 1 1

T pers1 T pers2

Illumination Model Reflection: the interaction of light with a surface, in terms of the properties of the surface and the nature of the incident light. Illumination: nature of the light emanating from a surface the geometry of its intensity distribution and so on.

Direct and Indirect Illumination

Point v.s. Ambient Light Source Point light source Ambient light source

World Coordinate Space Screen Space Reflection model: light intensity at a point Reflection model: shading a pixel

Light-Object Interaction Light incident at a surface light reflected + light scattered + light absorbed + light transmitted

Bidirectional Reflectivity Function (BDRF) R ( λ, φ, θ, φ, θ ) bd i i v v I v ( φi, θi, φv, θv ) E ( φ, θ ) i i i

Bidirectional Reflectivity Function (BDRF) cont. E ( φ, θ ) I i i i v ( φ, θ ) cosθ dω i i i i

Multiple Reflections Diffuse reflections

Three Components of BDRF Specular Directional Diffuse Perfect Diffuse

Material, Wavelength, Angle a. Roughed aluminum; θ i 1, 45, 75 ; λ2μm b. Roughed aluminum; θ i 1, 3, 45, 6, 75 ; λ.5μm b. Roughed magnesium oxide; θ i 1, 45, 6, 75 ; λ.5μm

Phong s Shading First order approximation of photorealism, i.e., a linear combination of the three illumination components diffuse, specular and ambient.

Diffuse component Phong s Shading I I d d I I i i k k d d cosθ ( L N ) θ 2π I i : intensity of a point light source Θ: angle between light direction (L) and surface normal (N) kd: wavelength-dependent (empirical) reflectance coefficient For more than one light source: Id k d Ii, n ( Ln N ) n

Specular component Phong s Shading I s I I i i k k s s cos n ( R V Ω ) n n: surface roughness index

Surface Roughness Index Large n (glossy surface) small n (rough surface)

Specular + Diffuse Phong s Shading

Specular + Diffuse (rendered version) Phong s Shading

Phong s Shading Specular + Diffuse + Ambient Ambient illumination a i g k I I ) ) ( ) ( ( n s d i a a k k k V R N L I I I + + ) ) /( ) ( ) ( ( k r k k k n s d i a a + + + V R N L I I I where (r+k) is the distance consideration.

Phong s Shading Geometric Considerations Let H (L+V)/2 I I k + I ( k ( L N ) + k ( N H ) ) /( r + k) a a i d s n

Phong s Shading Geometric Considerations Comparison of using (a) R.V and (b) N.H.

Summary of Phong Model 1. Point light sources. 2. No geometry except surface normal is considered (i.e., lights and viewers are located at infinity.) 3. Diffuse and specular terms are modeled as local components. 4. Surface roughness is modeled by the decrease of specular term around reflection vector. 5. Color of specular reflection is assumed to be of light source (i.e., highlights are always white regardless of the material.) 6. Assume constant global (ambient) light.

A Defect of Phong Model Inaccurate in the specular term for illumination at low incidence angles.

Cook and Torrance Model Based on incident energy instead of intensity. Using a physical microfacet model to determine the specular term. Using Fresnel s law and material characteristics to determine color changes within the highlights.

Cook and Torrance Model BDRF sr s + dr d where s + d 1 Global ambient term I a R a f Similar to Phong s Shading: + + n s a n i n n i a a s d d f ) ( ) (,, R R L N I R I I ω

Cook and Torrance Model (cont.) The reflection vector, R, is physically modeled based on the microfacet descript of the surface. N, average surface normal Microfacet model of a reflection surface.

Cook and Torrance Model (cont.) FDGsRF: NVNLπ ( )( ) the Fresnel term theoretical reflection coefficient (tangent plane approximation) D: distribution function for the microfacets G: attenuation factor caused by microfacet shadowing effect

Cook and Torrance Model (cont.) D: distribution function for microfacets k exp[ ( α / m) k: a constant α: angle of microfacet with respect to (mean) surface normal (i.e., angle between N and H) 2 ] Beckmann-Spizzichino distribution:d m: root mean square slope the microfacetd1 2 exp[ (tan α / 2 )] m cos m 2 4 α

Cook and Torrance Model (cont.) F, the Fresnel term, tangent plane approximation

Cook and Torrance Model (cont.) F, the Fresnel term 1 2 sin sin 2 2 2 ( φfθ ) tan ( φ θ ) + 2 ( φ + θ ) tan ( φ + θ ) φ: angle of incidence θ: angle of refraction sinθ sinψ/η and η: refractive index of material

Cook and Torrance Model (cont.) F, the Fresnel term (cont.) 2 2 1 1 1) ( 1) ( FF + + µ η η for φ 1 cos 1) ) ( ( 1) ) ( ( 1 ) ( ) ( 2 1 ) ( tan ) ( tan ) ( sin ) ( sin 2 1 2 2 2 2 2 2 2 2 2 2 2 + + + + + + + + c g c where c g c c g c c g c g η φ θ φ θ φ θ φ θ φhvffη so η is a function of wavelength from (measured) F.

(a) F as a function of wavelength and angle of incidence (b) F(ψ) at r, g, b wavelengths.

Cook and Torrance Model (cont.) (a) Microfacet orientation distributions (b) Gaussian distributions with m.2.8

Cook and Torrance Model (cont.) G: attenuation factor Shadowing: interference in the incident light Masking: interference in the reflected light s 1 l1 / l2 HG2( )( VHN H2( V)( H max(min{1, N Gshadowing Gm NNGmasking G s V, L) ) m G}, )

Interference of attenuation factor: (a) no interference; (b) masking; (c) shadowing.

The degree of masking and shadowing depends on the ratio l 1 /l 2 the proportions of the facets contributing to the reflection.

Cook and Torrance v.s. Phong Phong Model Cook-Torrance Model Note the large lobe in C-T model and the non-coincidence of the lobe center with the reflection vector.

Rendering the Collection of operations necessary to project a view of an object or a scene onto a view surface A computer calculation of the amount of light falling on each visible surface of the objects in the "scene," as seen from the point of view of the computer "camera" (the viewer's eye point). During the rendering process, surface properties of objects are taken into account as are the colors of both the objects and the "lights" shining on them.

A Typical 3D Rendering Pipeline Local coordinate space Object definition Modeling trans. World coordinate space Compose scene View Reference Lighting Cull View trans. View space Clip to 3D view volume 3D screen space Hidden surface removal Rasterization Shading Display space

3D Rendering Example

3D Rendering Example (cont.)

Culling Operations to remove polygons that cannot be seen backface elimination For a scene contains only a single convex object hidden surface removal visibility : N > N p N p : polygon normal N: line of sight vector

Culling Visibility test.

Clipping Test the objects against the viewing frustum: Case 1: completely outside discard Case 2: completely inside transform and render Case 3: intersect with clip then transform and render w X w w Y w Z w Clipping limits

Sutherland-Hodgman Clipper

Four possibilities Sutherland-Hodgman Clipper

Sutherland-Hodgman Clipper ) ) ( ( : ) ( ) ( 1 ) ( ) ( < > + X P N X F N X S N S F S P t and t t t c c c S is outside F is inside Inside/Outside test

Gouraud Shading Restricted to the diffuse component of the reflection model Suffers from Mach banding k ( ) /( r + k) i d light IAssume is at infinity L.N is constant. NLNow calculate intensities at vertices and use bilinear interpolation to get all intensities.

The Vertex Normal -- N A N 1 N A N 4 N 2 N 3

Vertex Normals and Clipping N 1 Clip boundary N 2 Inside Outside N 1 N' 2 N' 2 is interpolated from N 1 and N 2.

Scan Line Interpolations Scan line y s (x a, y s ) I a I 1 I s (x 1, y 1 ) I b (x b, y s ) I 4 (x 4, y 4 ) I 2 (x 2, y 2 ) I 3 (x 3, y 3 )

Scan Line Interpolations (cont.) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) intensity change to - pixel - : pixel along scan line dist. :incremental 1 1 1 1,, 2 1 1 2 4 1 4 1 1 2 2 1 2 1 I x x x x x x I x x x x y y I y y y y y y I y y y y s n s n s a b a b s a s s b a b s s s b s s a + + + + IIIIIIIIIIII

Rasterization (a) Line drawing and (b) polygon filling rasterization.

Rasterization: Polygon Generate pairs of segment points edge list (xs,ys) (xe,ye): start and end points of an edge x xs m (xe xs)/(ye ys) for (y ys; y < ye; y+dy) { output(round(x), y) x + m }

Rasterization: Polygon (cont.)

Hidden Surface Removal Depth of an object (in screen space): z z s v f (1 d / zv ) f d z s f f d ( f fd d) z v Compare depths (in screen space) of all points with the same (x s,y s ) and determine which (parts of) surfaces are invisible (hidden).

Hidden Surface Removal Depth of an object (in screen space): z z s v f (1 d / zv ) f d z s f f d ( fd f d) z v

Z-Buffer Algorithm 1. Store z s values of vertices. 2. For pixels inside a polygon, get the depth of current point, z c, by interpolation. 3. Compare z c with the current z min, if z c is less than z min, write the (interpolated) intensity of current pixel to the frame buffer. Advantages: independent of object representation form; simple, easy to implement Disadvantages: memory hog

Volume Rendering For surfaces: color-opacity model c f : surface color o: surface opacity c b : background colors Total color: c c f o + c b (1 o) For volumes: dense emitter model c c( z)exp ( ) o( ζ ) dζ dz c( z), o( ζ ) :color and opacity of the object at z

Volume Rendering Surfaces Volumes

Volume Rendering

(False) Volume Rendering