Illumination and Shading

Similar documents
Given: scene specification (object positions, optical properties p of the surface, viewer position, viewing direction, )

Illumination Models and Surface-Rendering Methods. Chapter 10

Illumination and Shading

CS5620 Intro to Computer Graphics

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

Illumination Models & Shading

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

CPSC 314 LIGHTING AND SHADING

Comp 410/510 Computer Graphics. Spring Shading

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

Introduction to Computer Graphics 7. Shading

Illumination. Courtesy of Adam Finkelstein, Princeton University

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

Lighting and Shading

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

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

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

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

Illumination and Shading

Virtual Reality for Human Computer Interaction

Lighting and Reflectance COS 426

CEng 477 Introduction to Computer Graphics Fall

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

Reflection and Shading

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

w Foley, Section16.1 Reading

CS 325 Computer Graphics

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

EECS 487: Interactive Computer Graphics

Ray-Tracing. Misha Kazhdan

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

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

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

Shading I Computer Graphics I, Fall 2008

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

CS770/870 Spring 2017 Color and Shading

Distribution Ray-Tracing. Programação 3D Simulação e Jogos

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

Computer Graphics. Illumination and Shading

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

Today we will start to look at illumination models in computer graphics

Illumination & Shading

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

Visualisatie BMT. Rendering. Arjan Kok

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

Illumination & Shading: Part 1

Shading. Brian Curless CSE 557 Autumn 2017

Specular reflection. Lighting II. Snell s Law. Refraction at boundary of media

9. Illumination and Shading

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

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

COMP371 COMPUTER GRAPHICS

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

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

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

Lighting Models. CS116B Chris Pollett Mar 21, 2004.

CS3500 Computer Graphics Module: Lighting and Shading

03 RENDERING PART TWO

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

Sung-Eui Yoon ( 윤성의 )

University of Victoria CSC 305 Shading. Brian Wyvill 2016

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

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

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

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

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

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

Photorealism: Ray Tracing

Distributed Ray Tracing

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Illumination and Shading

Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies" Ø The Hall illumination model. Ø Original ray tracing paper

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Lighting. Figure 10.1

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Surface Rendering Methods

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

CS452/552; EE465/505. Intro to Lighting

Computer Graphics I Lecture 11

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

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

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

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

Simple Lighting/Illumination Models

Ray Tracing: Special Topics CSCI 4239/5239 Advanced Computer Graphics Spring 2018

Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting

Illumination and Shading

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

CS Illumination and Shading. Slide 1

Computer Graphics. Illumination and Shading

Ray Tracing. Johns Hopkins Department of Computer Science Course : Rendering Techniques, Professor: Jonathan Cohen

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

Raytracing. COSC 4328/5327 Scott A. King

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

Transcription:

llumination and Shading llumination and Shading Given: scene specification (object positions, optical properties of the surface, viewer position, viewing direction, ) Find: intensity for each pixel viewer image plane light

llumination Models (lighting model, shading model) Photorealism in computer graphics involves Accurate representations of surface properties, and Good physical descriptions of the lighting effects Rendering needs a model for how light interacts with objects. Physically more correct model: the intensity reflected from every point depends on the intensity from every other points global illumination Simplistic model: the intensity depends only on the direct illumination due to light sources local illumination Light Sources Point light sources Emitting radiant energy at a single point Specified with its position and the color of the emitted light nfinitely distant light sources A large light source, such as sun, that is very far from a scene Little variation in its directional effects Specified with its color value and a fixed direction for the light rays Arjan Ko

Light Sources Directional light sources Produces a directional beam of light Spotlight effects Area light sources Light Sources Radial intensity attenuation As radiant energy travels, its amplitude is attenuated by the 2 factor 1/ d Sometimes, more realistic attenuation effects can be obtained with an inverse quadratic function of distance f = a 1.0 1 + a d + a 2 0 1 2d if source is local The intensity attenuation is not applied to light sources at infinity because all points in the scene are at a nearly equal distance from a far-off source if source is at infinity

Light Sources Angular intensity attenuation For a directional light, we can attenuate the light intensity angularly as well as radially f ( α) = cos n α Surface Lighting Effects An illumination model computes the lighting effects for a surface using the various optical properties Degree of transparency, color reflectance, surface texture The reflection model describes the way incident light reflects from an opaque surface Diffuse, ambient, specular reflections Simple approximation of actual physical models This model is nown as: shading model lighting model light reflection model local illumination model Phong illumination model reflectance model

Ambient Light Multiple reflection of nearby objects (light-reflecting sources) yields a uniform illumination Ambient light is independent of light sources and viewer position Ambient illumination is constant for an object, without regard to directions of faces a a = aa : the incident ambient intensity : ambient reflection coefficient, the proportion reflected away from the surface ndirect illumination can be computed much better: e.g. radiosity a Wavelength dependence and are function over all wavelengths. a deally, we need ( λ) = a( λ) a( λ) λ Calculate RGB component separately: = red a,red green=a,green blue = a,blue a,red a,green a,blue

Diffuse Reflection Matte (dull) surfaces diffuse incident light uniformly to every direction (light intensity is independent of angle of reflection) Such surfaces are called ideal diffuse reflectors (also referred to as Lambertian reflectors) Diffuse Reflection Light intensity depends on angle of incidence Light intensity is independent of angle of reflection

Diffuse Reflection Light intensity depends on angle of incidence Light intensity is independent of angle of reflection = dl cosθ = dl( N L) l : the intensity of the light source d : diffuse reflection coefficient, N L : the surface normal (unit vector) : the direction of light source, (unit vector) Ambient + Diffuse = a a + d a l a ( N L) if if N N L L > 0 0

Specular Reflection Perfect reflector (mirror) reflects all lights to the direction where angle of reflection is identical to the angle of incidence t accounts for the highlight Near total reflector reflects most of light over a range of positions close to the direction Specular Reflection Phong specular-reflection model Note that N, L, and R are coplanar, but V may not be coplanar to the others n n = sl cos φ = sl ( R V ) l s n : intensity of the incident light : color-independent specular-reflection coefficient : the gloss of the surface

Specular Reflection Glossiness of surfaces n n = sl cos φ = sl ( R V ) Specular Reflection n n = sl cos φ = sl ( R V ) Specular-reflection coefficient is a material property s For some material, varies depending on θ s 1 s 0.5 metal glass 0 0 90 Calculating the reflection vector R θ R + L = ( 2L N) N R = (2L N) N L

Specular Reflection Simplified Phong model using halfway vector H is constant if both viewer and the light source are sufficiently far from the surface L V L V H + + = n s p n s p n s p n s p H N V R ) ( cos ) ( cos = = = α φ Specular reflection / Phong increasing n increasing s

Ambient+Diffuse+Specular Reflections Single light source Multiple light source Emission and attenuation n l s l d a a V R L N ) ( ) ( + + = + + = l n l s l d a a V R L N ) ( ) ( ( ) + + + = l n l s l d atten ang l atten rad l a a emit V R L N f f ) ( ) ( _, _, Parameter Choosing Tips For a RGB color description, each intensity and reflectance specification is a three-element vector The sum of reflectance coefficients is usually smaller than one Try n in the range [0, 100] Use a small a (~0.1) Example Metal: n=90, a=0.1, d=0.2, s=0.5 1 + + s d a n l s l d a a V R L N ) ( ) ( + + =

Only emission and ambient ncluding diffuse reflection

ncluding specular reflection Polygon Rendering Methods We could use an illumination model to determine the surface intensity at every projected pixel position Or, we could apply the illumination model to a few selected points and approximate the intensity at the other surface positions Curved surfaces are often approximated by polygonal surfaces. So, polygonal (piecewise planar) surfaces often need to be rendered as if they are smooth Constant shading, Gouraud shading, Phong shading

Constant Shading (Flat Shading) N L nfinitely distant light source (constant ) result in constant diffuse reflection Constant N L and infinitely distant viewpoint (constant V R ) result in constant specular reflection Abrupt change in surface orientation of adjacent surfaces produce an unrealistic effect Smooth shading Two popular methods: Gouraud shading Phong shading

Normal vector of a vertex Plane Normal Vertex Normal N 2 N ( N = v N + N + N + N 1 + N2 + N3 + N4) 1 2 3 4 N 3 N v N 1 N 4 Gouraud Shading Compute vertex illumination (color) before the projection transformation Shade interior pixels: color interpolation (normals are not needed) C1 for all scanlines Ca = lerp(c1, C2) Cb = lerp(c1, C3) C2 C3 Lerp(Ca, Cb) * lerp: linear interpolation

Gouraud Shading Problem Lighting in the polygon interior can be inaccurate Gouraud Shading Problem - Mach band effect These Mach Bands are not physically there. nstead, they are illusions due to excitation and inhibition in our neural processing. The bright bands at 45 degrees (and 135 degrees) are illusory. The intensity of each square is the same.

Mach band effect Phong Shading Surface normals are interpolated Shades are computed at each point using the interpolated normal vector The shading computed by Phong shading is C 1 continuous. Fix the mach band effect : remove edge discontinuity

Phong Shading Normal interpolation n1 na = lerp(n1, n2) nb = lerp(n1, n3) lerp(na, nb) n2 n3 Slow not supported by OpenGL and most graphics hardware Modern programmable lighting hardware can implement full phong shading (and much more!), but you have to do this yourself. Problems with interpolated shading Polygon silhouette Perspective distortion Orientation dependence A D Shared edges Unrepresentative vertex normals B C P D A P B C

Refractions (Transparent Surfaces) diffuse refraction Partially transparent object (e.g. frosted glass) penetrating light is diffused Decrease light intensity, spread intensity contribution of each point onto a finite area on the refracting surface Expensive, seldom used Specular refraction (Snell s law) N ηi L θi θi R sin θr = ηi sin ηr θi ηi η ηr θr T, r : index of refraction of each material (averaged over wavelengths)

Specular refraction Path shifts are ignored for thin objects From Snell s law, we can obtain the unit transmission vector T in the direction r θ ηi ηi T = ( cosθi cosθr ) N L ηr ηr nterpolated transparency = ( 1 ) t 1 λ1 + t1λ 2 1 2 t1 : transmission coefficient (0 for opaque objects, 1 for totally transparent objects) line of sight

Local vs. Global llumination Models Local illumination models Object illuminations are independent No light scattering between objects No real shadows, reflection, transmission Phong llumination model Global illumination models Ray tracing (highlights, reflection, transmission) Radiosity (Surface inter-reflections) Photon mapping Forward Ray Tracing Rays as paths of photons in world space Follow photon from light sources to viewer Problem: Many rays will not contribute to image

Bacward Ray Tracing Trace rays bacward from viewer to light sources One ray from center of projection through each pixel in image plane Ray casting Simplest form of ray tracing No recursion Bacward Ray Tracing llumination Phong illumination Shadow rays Specular reflection Specular refraction Specular reflection and refraction are recursive

Binary Ray-Tracing Tree Shadow Rays f the ray hits an object, we want to now if that point on the object is in a shadow. So, when the ray hits an object, a secondary ray, called a "shadow" ray, is shot towards the light sources. f this shadow ray hits another object before it hits a light source, then the first intersection point is in the shadow of the second object. For a simple illumination model this means that we only apply the ambient term for that light source http://www.siggraph.org/education/materials/hypergraph/raytrace

How do we see the world? object film n computer graphics, we assumed that rays are projected onto the image plane How do we see the world? object film n physics, that is not true Rays are scattered in all directions

Pinhole camera object barrier film Add a barrier to bloc off most of the rays This reduces blurring The opening nown as the aperture How does this transform the image? Slide by Steve Seitz Pinhole camera model Pinhole model: Captures pencil of rays all rays through a single point The point is called Center of Projection (COP) The image is formed on the mage Plane Effective focal length f is distance from COP to mage Plane Slide by Steve Seitz

Shrining the aperture Why not mae the aperture as small as possible? Less light gets through Diffraction effects Slide by Steve Seitz The reason for lenses Slide by Steve Seitz

Small vs. Large Pinholes Pinhole vs. Lens

mage Formation using Lenses deal Lens: Same projection as pinhole but gathers more light! i o P P Lens Formula: 1 + i 1 o f 1 = f f is the focal length of the lens determines the lens s ability to bend (refract) light Aperture

Shutter Focus and Defocus object lens film circle of confusion A lens focuses light onto the film There is a specific distance at which objects are in focus Other points project to a circle of confusion in the image

Depth of Field http://www.cambridgeincolour.com/tutorials/depth-of-field.htm Aperture controls Depth of Field Changing the aperture size affects depth of field A smaller aperture increases the range in which the object is approximately in focus But small aperture reduces amount of light need to increase exposure

Depth-of-Field Scale Typical prime lens design Varying the aperture

Varying the aperture Nice Depth of Field effect

Antialising Super sampling Antialiasing Oversampling rays in each pixel Regular vs. jittered sampling Distributed Ray Tracing Stochastic sampling that randomly distribute rays according to the various parameters Monte Carlo evaluation of the multiple integrals that occur in an accurate physical description of surface lighting

Distributed Ray Tracing Depth of Field Distributing rays over the circle of confusion Distributed Ray Tracing Motion blur Distributing rays over time

Halftoning Simulate the loo of a continuous tone image with limited colors How to mae gray using tiny dots of blac in Halftoning for displaying intensity levels more than display device capability (clustered-dot ordered dither) intensity n n spatial frequency of pixels or varying dot size 2 Grid n ( above 0) + 1( 0) intensity levels for bilevel display devices symmetrical pixel arrangements are to be avoided multi-level device : increase the number of intensity level spatial resolution vs. # of intensity level tradeoff

Texture Mapping Mapping techniques add realism and interest to computer graphics images. Texture mapping applies a pattern of color to an object - umbrella, bacground, beach ball, beach blanet. Bump mapping alters the surface of an object so that it appears rough, dented or pitted - sand Texture Mapping Texture scanning surface Texture parametrization Object projection Screen space space space Viewing transform T ( u, v ) ( x w, yw, zw ) ( xs, ys) nverse mapping

Non-Parametric Texture Mapping Gives cooie-cutter effect Texture size and orientation fixed, not tied to the size and orientation of the polygon Parametric Texture Mapping Separate texture space and screen space. Texture the polygon as before, but in texture space. Deform the textured polygon into screen space. t v u s

Parametric Texture Mapping Two major difficulties : inventing a suitable surfaces; parameterization and antialiasing Use inverse mapping : find pre-image of the current pixel in the texture domain (Fig. 14-95) 1. tae the four pixel corner points 2. invert the object to screen space transformation 3. invert the surface parameterization Object size decreases pre-image of a pixel in texture space increases : need anti-aliasing Aliasing and Antialiasing pre-image pixel with pixel w/o anti-aliasing anti-aliasing pixel center

Texture Filtering Technique Method : Brute Force Just sum Method : Mip Maps a sequence of textures prefiltered at multiple resolutions Lance Willims, 83 stands for multum in parvo, that is many things in a small place maes distant objects loo better R G R G R G B B B Texture Filtering Technique Method : Summed Area Tables Fran Crow, 1984 Keep sum of everything below and to the left Uses four table looup Requires more memory Can give excessively blurry textures (u,v) vb va = T ( ub, vb ) T ( ua, vb ) T ( ub, va ) + T ( ua, va ) ua ub

Texture Filtering Technique Method V: Stochastic Sampling Gives noisy images, unless enough samples are taen An extremely simple and robust technique Poisson Completely random Add points at random until area is full. Uniform distribution: some neighboring samples close together, some distant Texture Filtering Technique Poisson Disc Poisson distribution, with minimum-distance constraint between samples Add points at random, removing again if they are too close to any previous points Very even-looing distribution Jittered Start with regular grid of samples Perturb each sample slightly in a random direction More clumpy or granular in appearance

Compositing Composite different images possibly rendered using different techniques into one image Overlay where not zero The first image is overlayed onto the second one where the second image is not blac Alpha blending The blending of two colors based on a transparency value. Each pixel of both images contains an alpha value of the image opacity. Compositing Chroma-eying real time video operation overlay when not a predetermined color method e.g., the weather man in front of a flat blue wall