Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Similar documents
Color in OpenGL Polygonal Shading Light Source in OpenGL Material Properties Normal Vectors Phong model

Scan Conversion & Shading

Scan Conversion & Shading

Lighting. Dr. Scott Schaefer

Global Illumination and Radiosity

Illumination & Shading

Global Illumination and Radiosity

Global Illumination and Radiosity

Shading I Computer Graphics I, Fall 2008

Comp 410/510 Computer Graphics. Spring Shading

Global Illumination: Radiosity

Surface Mapping One. CS7GV3 Real-time Rendering

Real-time. Shading of Folded Surfaces

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

R s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes

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

Physics 132 4/24/17. April 24, 2017 Physics 132 Prof. E. F. Redish. Outline

Introduction to Computer Graphics 7. Shading

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

Some Tutorial about the Project. Computer Graphics

Simple Lighting/Illumination Models

Discussion. History and Outline. Smoothness of Indirect Lighting. Irradiance Caching. Irradiance Calculation. Advanced Computer Graphics (Fall 2009)

Computer graphics III Light reflection, BRDF. Jaroslav Křivánek, MFF UK

University of Victoria CSC 305 Shading. Brian Wyvill 2016

Discussion. History and Outline. Smoothness of Indirect Lighting. Irradiance Calculation. Irradiance Caching. Advanced Computer Graphics (Fall 2009)

Diffuse and specular interreflections with classical, deterministic ray tracing

Monte Carlo Rendering

Introduction to Radiosity

Global Illumination. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/26/07 1

Interactive Rendering of Translucent Objects

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

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

CSE 681 Illumination and Phong Shading

Illumination in Computer Graphics

CS3500 Computer Graphics Module: Lighting and Shading

Illumination and Shading

Monte Carlo 1: Integration

Reflection and Shading

DIFFRACTION SHADING MODELS FOR IRIDESCENT SURFACES

PBRT core. Announcements. pbrt. pbrt plug-ins

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

Monte Carlo 1: Integration

Form-factors Josef Pelikán CGG MFF UK Praha.

REFRACTION. a. To study the refraction of light from plane surfaces. b. To determine the index of refraction for Acrylic and Water.

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

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

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

Complex Shading Algorithms

2.2 Photometric Image Formation

PHYS 219 Spring semester Lecture 20: Reflection of Electromagnetic Radiation: Mirrors and Images Formed by Mirrors

CS Illumination and Shading. Slide 1

Plane Sampling for Light Paths from the Environment Map

Lecture 15: Shading-I. CITS3003 Graphics & Animation

3D vector computer graphics

Why we need shading?

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

Fast, Arbitrary BRDF Shading for Low-Frequency Lighting Using Spherical Harmonics

Electrical analysis of light-weight, triangular weave reflector antennas

SLAM Summer School 2006 Practical 2: SLAM using Monocular Vision

2D Raster Graphics. Integer grid Sequential (left-right, top-down) scan. Computer Graphics

Illumination. The slides combine material from Andy van Dam, Spike Hughes, Travis Webb and Lyn Fong

Topic 13: Radiometry. The Basic Light Transport Path

w Foley, Section16.1 Reading

Monte Carlo Integration

Range images. Range image registration. Examples of sampling patterns. Range images and range surfaces

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

CS452/552; EE465/505. Intro to Lighting

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

1. Answer the following. a. A beam of vertically polarized light of intensity W/m2 encounters two polarizing filters as shown below.

Computer Graphics: 3-Local Illumination Models

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

An efficient method to build panoramic image mosaics

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

Reading. 14. Subdivision curves. Recommended:

CS 325 Computer Graphics

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

Interactive Virtual Relighting of Real Scenes

Slide 1 SPH3UW: OPTICS I. Slide 2. Slide 3. Introduction to Mirrors. Light incident on an object

CS 4600 Fall Utah School of Computing

Surface Rendering Methods

Shape Representation Robust to the Sketching Order Using Distance Map and Direction Histogram

Consistent Illumination within Optical See-Through Augmented Environments

Computer Graphics. Illumination and Shading

Surface Integrators. Digital Image Synthesis Yung-Yu Chuang 12/20/2007

CPSC 314 LIGHTING AND SHADING

Realistic Rendering. Traditional Computer Graphics. Traditional Computer Graphics. Production Pipeline. Appearance in the Real World

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

AVO Modeling of Monochromatic Spherical Waves: Comparison to Band-Limited Waves

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

Short Papers. Toward Accurate Recovery of Shape from Shading Under Diffuse Lighting 1 INTRODUCTION 2 PROBLEM FORMULATION

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65

CS 534: Computer Vision Model Fitting

CS5620 Intro to Computer Graphics

Einführung in Visual Computing

Dynamic wetting property investigation of AFM tips in micro/nanoscale

Our objects so far have mostly looked as if they plan to stay home and watch

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

Rendering of Complex Materials for Driving Simulators

3D Shape of Specular Surface Measurement Using Five Degrees of Freedom Camera System

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

Transcription:

Computer Graphcs Jeng-Sheng Yeh 葉正聖 Mng Chuan Unversty (modfed from Bng-Yu Chen s sldes)

llumnaton and Shadng llumnaton Models Shadng Models for Polygons Surface Detal Shadows Transparency Global llumnaton Recursve Ray Tracng Radosty The Renderng Ppelne

Why We Need Shadng? Suppose we buld a model of a sphere usng many polygons and color t wth only one color. We get somethng lke But we want

Shadng Why does the mage of a real sphere look lke Lght-materal nteractons cause each pont to have a dfferent color or shade Need to consder Lght sources Materal propertes Locaton of vewer Surface orentaton

Lght Sources General lght sources are dffcult to work wth because we must ntegrate lght comng from all ponts on the source

Smple Lght Sources Pont source Model wth poston and color Dstant source = nfnte dstance away (parallel) Spotlght Restrct lght from deal pont source Ambent lght Same amount of lght everywhere n scene Can model contrbuton of many sources and reflectng surfaces

Surface Types The smoother a surface, the more reflected lght s concentrated n the drecton a perfect mrror would reflected the lght A very rough surface scatters lght n all drectons smooth surface rough surface

llumnaton Models Ambent Lght: a : ntensty of the ambent lght k a = a k a : ambent-reflecton coeffcent: 0 ~ Dffuse Reflecton: p : pont lght source s ntensty k d : dffuse-reflecton coeffcent: 0 ~ θ : angle: 0 ~ 90 = p k d cosθ

Dffuse Reflecton drecton to the lght source L N surface normal θ = p k d ( N L)

Examples 0.4 0.55 0.7 0.85.0 dffuse-reflecton model wth dfferent k d 0.0 0.5 0.3 0.45 0.6 ambent and dffuse-reflecton model wth dfferent ka and = =.0, k 0. 4 a p d =

Lght-Source Attenuaton = att a k a + f att p d ( N L) f : lght-source attenuaton factor f the lght s a pont source fatt = 2 d d L L k where s the dstance the lght travels from the pont source to the surface fatt = mn(,) 2 c + c d + c d 2 L 3 L

Examples d 2 L d L

Colored Lghts and Surfaces f an object s dffuse color s O = d ( OdR, OdG, OdB) then where for the red component R ar a dr pr however, t should be λ = k = aλka λ O O dλ + + dr ( = where s the wavelength f f att att pλ k k d d O O dλ ( N N ( R, G, B) L) L)

Specular Reflecton L N R V θ θ α drecton of reflecton drecton to the vewpont

Specular Surfaces Most surfaces are nether deal dffusers nor perfectly specular (deal refectors) Smooth surfaces show specular hghlghts due to ncomng lght beng reflected n drectons concentrated close to the drecton of a perfect reflecton specular hghlght

The Phong llumnaton Model A smple model that can be computed rapdly Has three components Dffuse Specular Ambent Uses four vectors To source To vewer Normal Perfect reflector

The Phong llumnaton Model = k O + f k O cosθ + W W ( θ ) = k: specular-reflecton coeffcent:0~ so, the Eq. can be rewrtten as λ λ = aλ aλ k a a s O dλ dλ + att pλ consder the object s specular color λ = aλ O sλ k a O dλ + att : specular color f f att pλ pλ[ d dλ [ kdodλ ( N L) + ks [ kdodλ ( N L) + ksosλ ( θ )cos ( R ( R n α] V ) n V ) n ] ]

The Phong llumnaton Model 0 0 cosα 90 0 0 cos 2 α 90 0 0 cos 8 64 α 90 0 0 cos α 90

k s Examples 0..25 0.5 n = 3.0 n = 5. 0 n =0. 0 n = 27. 0 n = 200. 0

Calculatng the Reflecton Vector L S N S N cosθ θ θ R R = = = = N cosθ + S N cosθ + N cosθ 2N cosθ L 2N( N L) L L

The Halfway Vector L N H R β θ θ α V L + V H = L + V cosα N H

Multple Lght Sources f there are lght sources, then + + = m n V R O k L N O k f O k sλ s dλ d pλ att dλ a aλ λ ] ) ( ) ( [ m

Shadng Models for Polygons Constant Shadng Faceted Shadng Flat Shadng Gouraud Shadng ntensty nterpolaton Shadng Color nterpolaton Shadng Phong Shadng Normal-Vector nterpolaton Shadng

Constant Shadng Assumptons The lght source s at nfnty The vewer s at nfnty The polygon represents the actual surface beng modeled and s not an approxmaton to a curved surface

Gouraud Shadng y y y 2 y 3 y s 2 3 a p b Scan lne a b p b a b b p s b s a x x x x y y y y y y y y = = = ) ( ) ( ) ( 3 3 2 2

Gouraud v.s. Phong Shadng Gouraud Phong Gouraud Phong

Phong Shadng N 0 N a N b c N N P0 Pa Pb Pc P

Texture Mappng = Pattern Mappng v y texture map u surface of object x four corners of pxel on screen

Bump Mappng & Dsplacement Mappng Copyrght 2003, Mcrosoft

Shadows + + = m n V R O k L N O k f S O k sλ s dλ d pλ att dλ a aλ λ ] ) ( ) ( [ = pont not blocked at ths s lght f, pont blocked at ths s lght f 0, S

Scan-Lne Generaton of Shadows Lght A Current scan lne a b c d A B Vewer

Shadow Volumes Lght Object C B A shadow polygons

Shadow Volumes x x A A B C B C z V z V

Transparency 2 x nterpolated transparency λ = ( kt) λ + kt λ2 k t : transparency: 0 ~ fltered transparency = + k O λ O tλ λ t λ2 : transparency color tλ z Lne of sght

Scatterng Lght strkes A Some scattered Some absorbed Some of scattered lght strkes B Some scattered Some absorbed Some of ths scattered lght strkes A and so on

Global Effects shadow translucent surface multple reflecton

Global llumnaton ε ( x, x ) x ( x, x ) ρ( x, x, x ) x ( x, x ) x

The Renderng Equaton ( x, x ) = g( x, x ) ε ( x, x ) + ρ( x, x, x ) ( x, x ) dx S ( x, x ) : ntensty passng from x to x ε ( x, x ) : emtted lght ntensty from x to x ρ( x, x, x ) : ntensty of lght reflected from x to x from the surface at x g x, x ) 0, = / r ( 2 r : the dstance between x and x S : all surfaces [ ], f x s nvsble from x f x s vsble from x

Recursve Ray Tracng T 2 R 2 N 2 R T N 3 R 3 N R L T surface normal reflected ray shadow ray transmtted ray L 2 L L 3 N Vewpont Pont lght source

The Ray Tree Vewpont L R T L 2 rλ : ntensty of reflected ray k t : transmsson coeffcent : 0 ~ tλ : ntensty of transmtted ray L 3 λ R 2 = aλkaodλ + m S f R 3 T 2 [ k n att pλ kdodλ ( N L ) + ks( N H ) ] + ks rλ + t tλ

The Radosty Equaton : radosty of patch : rate at whch lght s emtted from patch : reflectvty of patch : form factor (confguraton factor) : area of patch snce thus + = n j j j j A A F B E B ρ B E ρ j F A + = n j j j F B E B ρ j j j F A F A =

The Radosty Equaton rearrangng terms therefore progressve refnement n j j j E F B B = ρ = n n n n n n n n n n n E E E B B B F F F F F F F F F 2 2 2 2 2 2 2 2 2 2 2 ρ ρ ρ ρ ρ ρ ρ ρ ρ

Computng Form Factors da j vsble or nvsble 0 N θ da A r θ j N j df A j ddj F d j j F = = = cosθ cosθ j HjdA 2 j πr cosθ cosθ j HjdAj A 2 j πr cosθ cosθ j H A A A 2 j πr j da da j

Hemsphere A j N N j θ j r θ da

Hemcube A j N da

The Renderng Ppelne Local llumnaton Ppelnes z-buffer and Gouraud shadng z-buffer and Phong shadng lst-prorty algorthm and Phong shadng Global llumnaton Ppelnes radosty ray tracng

Renderng Ppelne for z-buffer & Gouraud shadng db traversal Modelng transformaton Trval accept / reject Lghtng Vewng transformaton Clppng Dvde by W, map to 3D vewport Rasterzaton Dsplay

Renderng Ppelne for z-buffer & Phong shadng db traversal Modelng transformaton Trval accept / reject Vewng transformaton Clppng Dvde by W, map to 3D vewport Rasterzaton (wth lghtng) Dsplay

Renderng Ppelne for lst-prorty algorthm & Phong shadng db traversal Prelmnary vsble-surface determnaton Modelng transformaton New db New db traversal Trval accept / reject Vewng transformaton Clppng Dvde by W, map to 3D vewport Rasterzaton (wth lghtng) Dsplay

Renderng Ppelne for radosty & Gouraud shadng db traversal Vertex ntensty calculaton usng radosty method Modelng transformaton New db New db traversal Trval accept / reject Vewng transformaton Clppng Dvde by W, map to 3D vewport Rasterzaton Dsplay

Renderng Ppelne for ray tracng db traversal Modelng transformaton Ray tracng Dsplay