Illumination Modelling

Similar documents
CS5620 Intro to Computer Graphics

Pipeline Operations. CS 4620 Lecture 10

Illumination Models & Shading

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

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

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

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

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

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

Pipeline Operations. CS 4620 Lecture 14

9. Illumination and Shading

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

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

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Complex Shading Algorithms

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

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

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

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

CS3500 Computer Graphics Module: Lighting and Shading

Topics and things to know about them:

Interpolation using scanline algorithm

Lighting and Shading

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Local Reflection Models

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

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

Computer Graphics. Illumination and Shading

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

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

03 RENDERING PART TWO

CS 5625 Lec 2: Shading Models

Introduction to Visualization and Computer Graphics

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

CS 325 Computer Graphics

w Foley, Section16.1 Reading

CHAPTER 1 Graphics Systems and Models 3

Reflection and Shading

The Traditional Graphics Pipeline

Shading. Brian Curless CSE 457 Spring 2017

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

CS 488. More Shading and Illumination. Luc RENAMBOT

Chapter 7 - Light, Materials, Appearance

CPSC GLOBAL ILLUMINATION

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Shading. Brian Curless CSE 557 Autumn 2017

Computer Graphics (CS 543) Lecture 8 (Part 1): Physically-Based Lighting Models

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

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

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

CPSC 314 LIGHTING AND SHADING

Ray Tracing. Brian Curless CSEP 557 Fall 2016

Shadows. COMP 575/770 Spring 2013

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

Deferred Rendering Due: Wednesday November 15 at 10pm

Visual cues to 3D geometry. Light Reflection and Advanced Shading. Shading. Recognizing materials. size (perspective) occlusion shading

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Simple Lighting/Illumination Models

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

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

CPSC / Illumination and Shading

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

Photorealism: Ray Tracing

Illumination and Shading

Computer Graphics I Lecture 11

Illumination Models and Surface-Rendering Methods. Chapter 10

The Traditional Graphics Pipeline

Rendering Light Reflection Models

Shading, Advanced Rendering. Week 7, Wed Feb 28

CS 130 Exam I. Fall 2015

Illumination & Shading: Part 1

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

Ray-Tracing. Misha Kazhdan

Comp 410/510 Computer Graphics. Spring Shading

Ray-tracing Cont. Ray-tracing

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Graphics for VEs. Ruth Aylett

CEng 477 Introduction to Computer Graphics Fall 2007

Lab 9 - Metal and Glass

CSE 681 Illumination and Phong Shading

Computer Graphics. Illumination and Shading

CS Illumination and Shading. Slide 1

Illumination. Illumination CMSC 435/634

CEng 477 Introduction to Computer Graphics Fall

Local vs. Global Illumination & Radiosity

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

SEOUL NATIONAL UNIVERSITY

Computer Graphics. Bing-Yu Chen National Taiwan University

University of Victoria CSC 305 Shading. Brian Wyvill 2016

Graphics Hardware and Display Devices

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

3D Rasterization II COS 426

Review for Ray-tracing Algorithm and Hardware

Real-Time Non- Photorealistic Rendering

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Transcription:

Illumination Modelling 1 Specular term 2 Local shading analysis: interaction between one light source, the viewer and a single point on the object surface. how do we model specular term? a = angle between V & R E = ambient + specular + diffuse. perfect mirror dir n ambient = I a K a 0 empirical approximation : cos n a perfect polished mirror refl. n Æ (delta function) Specular term is Kscos n a 3 4 R = 2 v N ( ˆ N ˆ L ) - ˆ L R V = (2N(N L)) - L) V Problem: computational cost. Solution: an approximation known as the halfway vector H. Instead of asking if V is close to R, ask if N is (almost) halfway between V & L (if so, then R is along V). H = L + V (L + V) N H @ cosa

Ambient + Specular 5 Diffuse Lighting 6 Specular + Diffuse 7 Ambient+Specular+Diffuse 8

Ray Tracing / Casting 9 Ray Tracing / Casting (cont d) 10 Generate the image by tracing rays coming out of the observer s eye (COP) thru each pixel up to first object intersection. Leads IMMEDIATELY to approach to visible surface determination. Just draw (color) intersections. Method for shading. Compute N ˆ pixels. Shadows: & apply I.M. just at intersection Pixels (pts on objs) not seen by any (some) sources. v For each intersection pt p, fire a ray at (each) source. It obstructed, then it is in shadow. leads to hard shadows (no pnumbra) Thus, for each light source pt is seen (illuminated) or in shadow. In shadow, it is effectively zero. Define S = 0 or 1 I = I a K a + SI K d (N L) + K s (R V) n Other specialized shadow algs exist. [ ] O dl S i i O dl O sl RAY TRACING 11 RAY TRACING 12 Each ray intersects some object w 1 d 2 I = K a I a + SI p f att (K a (N - L) + (K s (N - H) 2 ) Primary ray from eye leads to secondary rays due to reflection (specular) & refraction (transparency). I = K a I a +  S i f i I pi (K d (N L) + K s (N H) n ) i Œ sources + K s I r + K t I t specularly reflected daughter ray transmitted daughter ray

+ transparency 13 Computing Rays 14 Consider : COP = v p o (X o, Y o,z o ) pixel on window v p 1 rays are v p (t) = p v o + t( p v 1 - p v o ) = p v o + td v Example problem : Find intersection of ray v r (l) = a v + lb v with sphere f( x v ) = x v x v -1 = 0 (detail expl) This also answers the side question: why so many spheres in ray-traced images? Computing Rays (cont d) Sol' n : Find l s.t. f( v r (l)) = 0 f( v r (l)) = r r = 1 = (a + bl)(a + bl) -1 = (b b)l 2 + 2(a b)l + (a a) -1 = Al 2 + 2Bl + C where A = b b B = (a b) C = a a -1 quadratic in l l = -2B± 4B2-4AC 2A Real sol' n for D 0 = -B A ± D A D = B 2 - AC D < 0 ray misses sphere, D = 0 graze, D > 0 pierce sol' n : both in front of eye both < 0,both behind 15 Computing Rays (cont d) With sphere, normal N for shading is simply: centre: C = (a,b,c) r(l) == (x, y,z) ˆ x - a,y - b,z - c) N = r Specific similar methods exist for many other types of surface. Read Sec. 10.2 Assigmnent problem: do it for --- superquadrics or some such. To make more efficient, use bounding volumes (boxes). Alternative: spatial partioning (top-down bdding volumes). only consider objs that intersect relevant boxes FOR AFFINE DEF OBJS, CAN INV X-FORM RAYS & USE METHOD SUITABLE TO UN-DEF OBJ. 16

Ray Tracing Refinements 17 Ray Tracing Refinements (cont d) 18 Observe: computational burden of recursive RT is substantial. For each ray: must do intersections with every object. (And face culling doesn t work since some rays can come from behind.) Ë Light buffer: organize objects about each light source Ë Tree depth control: avoid expanding ray tree for branches that have a small contribution. Ë Area sampling: replace thin rays by cones (cone tracing). How many rays? È (2 n -1) nodes in ray tree (N pixels) Í Î Í + m(2 n -1) shadow rays i.e. lots of incentive to make this efficient Ray Tracing 19 Visible Surface Determination (15.2) 20 not camera! Follow rays from eye (through pixels) into scene. 15.1: Idea of coherence: if you have an answer someplace, it will probably apply nearby @ incremental algorithm BASIC STEP RECURSION Where they hit the 1st object: compute reflectance, from light source(s). Follow specular bounces & transparency rays to account for inter-object effects. Leads to ray tree. RT is core of global illumination. Omits effect of other objects on diffuse reflectance term! Conclusion: obj. coherence - bounding box - flat shading face edge coherence - edges only change when they cross faces/edges etc. computation precedes proj n or depth info lost. Typically after normalizing xform. Face culling already discussed. Bounding volumes & spatial partitioning.

Roberts Algorithm 15.3.1 21 Appel s Algorithm 15.3.2 22 Discuss Roberts thesis. - Edge detection - Labelling - Back-projection Alg: All edges on faces of convex polyhedron. 1) Face culling. 2) Test each remaining edge against each (convex) polyhedron. a) Via bounding box. b) Test line against relevant faces. Exploits object coherence - it s a form of incremental algorithm. Idea: Define index of number of faces hiding a line - quantitative invisibility : QI When moving behind a fron-facing polygon, increment QI, when coming out, decrement QI. QI changes at either: - open polygon edges. - edges between fron & back facing polygons. these are contour lines Other edges do not change visibility. Contour vs. line occlusion determined by looking at triangle formed by line & eye wrt contour line. Cook & Torrance Model Vs Phong: a physically-based model of specular reflection -Based on incident energy instead of intensity -Specular term is physically-based -Color change of highlight based on physics Key aspect is the role of the microfacet distribution in the specular reflection - re the physical micro-texture of the material. Assume surface is made of small perfectly specular fragments. The ones aligned with the halfway vector reflect. P s = F l p DG (N V)(N L) D is fraction of aligned microfacets. D can be based on Beckmann distribution. M = 0 : mirror small M : shiny lg M : dull 1 4m 2 cos 4 b e - [(tan e M] 2 b =< NH M Æ RMS microfacet slope Can combine several D s for multi-scale roughness. 23 Cook & Torrance Model G: Geometrical attenuation factor Mutual shadowing, V-shaped grooves (shadowed rays lead to diffuse energy) also masking (interference) F l : 2( N ˆ H ˆ )( N ˆ V ˆ ) ( V ˆ H ˆ ) Fresnel term describes reflection phenomenon on smooth (planar) side of each microfacet describes color shift & intensity Key diff. w. Phong is off-specular peak & larger specular term & sharp angles 24

Constant (flat) shading Shading areas of an image For each face, use N to compute IM. Color the face a uniform color. If we only know vertex locations, derive N for face. Result: obvious artefacts due to number of faces used. 25 Interpolated Shading 16.2.4 a.k.a. Gouraud Shading I a at V 1 = spec + diffuse + ambient I a (along a) Compute normal at each vertex. Compute vertex intensity I. Interpolate intensity along each edge. = I - (I 1 - I 2 ) t te [ 0,1] = I 1 - (I 1 - I 2 ) Y 1 - Y s Y 1 - Y 2 I p = I b ( ˆ Y ) - (I b ( ˆ Y ) - I a ( ˆ Y )) X b ( Y ˆ ) - X p X b ( Y ˆ ) - X a ( Y ˆ ) 26 Phong Shading Interpolate normals instead of I. Compute I at each point. 27 Phong Now we have a different N at each point: Thus, can have a highlight in the middle of a facet. 28 1) Use IM (illumination model) to compute I at vertices (Gouraud) Phong ÆN is given at vertices 2) Compute N along edges by interpolation between vertex valves (do this for I/Gouraud) 3) Walk up each polygon face raster-line by raster-line. Along each line, compute N at each point by interpolation between end points. Compute I(N). SHADING Flat shading Gouraud Phong IM const ambient Phong: am + dif + spec Phys: Cooke & Torrance

Hidden surface removal summary Z buffer: No constraint on object types of compactness. Z values ust be high-res: (16/32 bits pp). Uses much space. Precision problems. Scan conversion can lead to List priority: Sort faces. Painters algo. typ fails furthest z per face 29 1) Surface detail polygons Adding Surface Cues 16.3 @ paint 2) Texture mapping Like morphing but map (V,V) space of texture image onto 3D surface, then project. Can use inverse mapping. pixel Æ surface Æ texture map combine appropriate texels from map Can involve weighting 3) Bump mapping perturb suface normal Points P displaced: Point spdisplaced : P 1 = P + B N N NoteN = P s Pt P s Fails at silhouette edges Don t actually move data points! READ IT 30