Assignment #2. (Due date: 11/6/2012)

Similar documents
HW2. October 24, CSE 252A Computer Vision I Fall Assignment 2

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Lecture 22: Basic Image Formation CAP 5415

Photometric Stereo. Lighting and Photometric Stereo. Computer Vision I. Last lecture in a nutshell BRDF. CSE252A Lecture 7

Capturing light. Source: A. Efros

Lights, Surfaces, and Cameras. Light sources emit photons Surfaces reflect & absorb photons Cameras measure photons

Ligh%ng and Reflectance

Announcement. Lighting and Photometric Stereo. Computer Vision I. Surface Reflectance Models. Lambertian (Diffuse) Surface.

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Image Formation: Light and Shading. Introduction to Computer Vision CSE 152 Lecture 3

Lighting affects appearance

Shading I Computer Graphics I, Fall 2008

Illumination & Shading

CS5620 Intro to Computer Graphics

Photometric Stereo.

Radiance. Pixels measure radiance. This pixel Measures radiance along this ray

And if that 120MP Camera was cool

Other approaches to obtaining 3D structure

Announcements. Image Formation: Light and Shading. Photometric image formation. Geometric image formation

CS4670/5760: Computer Vision Kavita Bala Scott Wehrwein. Lecture 23: Photometric Stereo

Announcements. Photometric Stereo. Shading reveals 3-D surface geometry. Photometric Stereo Rigs: One viewpoint, changing lighting

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

Comp 410/510 Computer Graphics. Spring Shading

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

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

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

Illumination in Computer Graphics

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

Understanding Variability

Objectives. Shading II. Distance Terms. The Phong Reflection Model

Introduction to Computer Graphics 7. Shading

Radiometry. Reflectance & Lighting. Solid Angle. Radiance. Radiance Power is energy per unit time

Announcements. Radiometry and Sources, Shadows, and Shading

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

Module 5: Video Modeling Lecture 28: Illumination model. The Lecture Contains: Diffuse and Specular Reflection. Objectives_template

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Shading Models. Welcome!

A Survey of Light Source Detection Methods

EE Light & Image Formation

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

Lighting affects appearance

Introduction to Computer Vision. Introduction CMPSCI 591A/691A CMPSCI 570/670. Image Formation

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

Illumination & Shading: Part 1

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

6. Illumination, Lighting

Lambertian model of reflectance I: shape from shading and photometric stereo. Ronen Basri Weizmann Institute of Science

Radiance. Radiance properties. Radiance properties. Computer Graphics (Fall 2008)

Interactive Real-Time Raycasting

Raytracing. COSC 4328/5327 Scott A. King

Sung-Eui Yoon ( 윤성의 )

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

Photometric Stereo. Photometric Stereo. Shading reveals 3-D surface geometry BRDF. HW3 is assigned. An example of photometric stereo

CPSC / Texture Mapping

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

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

Radiometry and reflectance

Illumination. Illumination CMSC 435/634

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

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

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

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

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

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

CS6670: Computer Vision

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

Using a Raster Display Device for Photometric Stereo

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

CS452/552; EE465/505. Intro to Lighting

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

CS 130 Final. Fall 2015

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

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

Overview. Radiometry and Photometry. Foundations of Computer Graphics (Spring 2012)

Homework 4 Computer Vision CS 4731, Fall 2011 Due Date: Nov. 15, 2011 Total Points: 40

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

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

CS 4600 Fall Utah School of Computing

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

Computer Graphics. Illumination and Shading

Announcement. Photometric Stereo. Computer Vision I. Shading reveals 3-D surface geometry. Shape-from-X. CSE252A Lecture 8

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

CPSC 314 LIGHTING AND SHADING

CS384G Midterm Examination Spring 2008

Announcements. Lighting. Camera s sensor. HW1 has been posted See links on web page for readings on color. Intro Computer Vision.

CS4670/5760: Computer Vision

Illumination and Shading

Illumination Models & Shading

Shading. Brian Curless CSE 557 Autumn 2017

TDA361/DIT220 Computer Graphics, January 15 th 2016

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

Illumination & Shading

CS201 Computer Vision Lect 4 - Image Formation

w Foley, Section16.1 Reading

Shape from shading. Surface brightness and Surface Orientation --> Reflectance map READING: Nalwa Chapter 5. BKP Horn, Chapter 10.

Lighting. Figure 10.1

The feature set you are required to implement in your ray tracer is as follows (by order from easy to hard):

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

Simple Lighting/Illumination Models

Transcription:

Computer Vision I CSE 252a, Fall 2012 David Kriegman Assignment #2 (Due date: 11/6/2012) Name: Student ID: Email: Problem 1 [1 pts] Calculate the number of steradians contained in a spherical wedge with radius r = 1, defined by θ = π 6, ψ = π 6 centered around vector ( 2 2, 2 2, 0). Problem 2 [3 pts] Consider a rectangular surface with vertices (1, 3, 3), (1, 3, 3), (1, 3, 3), and (1, 3, 3). If the radiance on the surface is L (z 2 + y 2 + 1) (with L constant) what is the irradiance arriving at position (0, 0, 0) with normal vector (1, 0, 0)? Figure 1: Problem 2 Setup Problem 3 [3 pts] a. Consider a cylinder with radius r and height h whose base is centered at z = 0 along the xy-plane. If the walls of the cylinder have constant radiance L and the top of the cylinder has constant radiance 7L, what is the irradiance E at the point (0, 0, 0) assuming that the surface at (0, 0, 0) has a normal vector of (0, 0, 1)? b. What is the irradiance if the radiance of the top is now Ld 3 where d is the distance to the center of the top (d [0, r])? Problem 4 [2 pts] A Lambertian surface is one that appears equally bright from all viewing direction. Say in other words, the emitted radiance from a Lambertian surface is not a function of outgoing direction. Assume that we have an ideal Lambertian surface which also reflects all incident lights (absorbing none), the BRDF f(θ i n, ψ i n, θ o ut, ψ o ut) of such a surface will be a constant. What is that constant? 1

Figure 2: Problem 3 Setup Hint: If we integrate the radiance of the surface over all directions, the total emitted energy is equal to the incoming energy. Problem 5 - Photometric Stereo [5 pts] The goal of this part of the assignment is to implement a couple of different algorithms that reconstruct a surface using the concept of photometric stereo. The majority of this problem should be done in MATLAB. There may also be sections in which you need to derive mathematical equations. Lambertian Reconstruction Photometric stereo is a technique to render depth of objects and surfaces from images of the same view with different lighting conditions. Figure 3: Synthetic Data Implement the photometric stereo technique described in Forsyth and Ponce section 2.2 and the lecture notes. a. Write a function that estimates the surface normals and albedo map using the included images and the known light directions. b. Write a program that reconstructs the depth map from the normals. You can first try the naive scanlinebased shape by integration method described in the book. If this does not work well on real images, you can use the MATLAB implementation of the Horn integration technique on the course website. c. Use these functions in a program that reads in the images and corresponding light source directions, calculates the normal and albedo map, and reconstructs the depth map. Calculating Light Direction Often times the light direction is unknown, in these cases it is required to estimate the light direction using a highly specular ball. Derive the equations to find the light direction L, using the center of the ball, C = (x, y) T, and the brightest point in the image B = (x, y) T. You may find this equation useful: L = 2N(R N) R 2

where R is the reflection direction and N is the surface normal. d. Write a function that calculates the light direction in a given image using your derivation. e. Write a program that calculates the light direction of all 8 spheres and uses these to reconstruct the depth map of the bottle using the functions you created in parts a, b, c and d. Do you notice any errors in this depth map? Why? Hertzmann and Seitz Reconstruction Using the surface normals with known light direction is not the only way to create 3D reconstructions. In this section, we look at a method proposed by Hertzmann and Seitz that uses the known BRDF of a material to obtain depth information. f. Implement the photometric stereo algorithm described in section 2 of Shape and Materials by Example: A Photometric Stereo Approach by Hertzmann and Seitz (can be found on the course website). g. Use the algorithm to reconstruct the 3D shape of the bottle using the set of corresponding bottle and sphere images. You may find it useful to use an algorithm to speedup the nearest-neighbor search, such as a kd-tree. What to turn in for Problem 5: Submit a hardcopy of your figures and code on the due date with the following: Your code for: Lambertian reconstruction (normals, albedo and depth). Figures of your normals, albedo and reconstruction of the synthetic data. Your code and derivation for calculating light direction as well as the output of this function on the first three sphere images, include your xy coordinates that you used for C and B. Figures of your reconstruction of the bottle with the lambertian reconstruction. Your code for: Hertzmann-Seitz implementation Figures of your reconstruction of the bottle with the Hertzmann-Seitz reconstruction. Problem 6 - Surface Rendering [5 pts] In this portion of the assignment we will be exploring different methods of approximating local illumination of objects in a scene. As discovered in the photometeric stereo portion of this homework, we know that some light models work better with different view, illumination sources and materials. Now, we will be exploring these systems from the opposite approach. In this section of the homework, you will be asked to calculate the images intensity of a 3D object with known geometry, but with various light sources, different materials, and using a number of illumination models. Lambertian Illumination One of the simplest models available to render 3D objections with illumination is the Lambertian model. This model finds the apparent brightness to an observer using the direction of the light source L and the normal vector on the surface of the object N. The brightness intensity at a given point on an object s surface, I d, with a single light source is found using the following relationship: I d = L N(I l C) where, C and I l are the the color and intensity of the light source respectively. 3

Phong Illumination One major drawback of Lambertian illumination is that it only considers the diffuse light in its calculation of brightness intensity. One other major component to illumination rendering is the specular component. The specular reflectance is the component of light that is reflected in a single direction, as opposed to all directions, which is the case in diffuse reflectance. One of the most used models to compute surface brightness with specular components is the Phong illumination model. This model combines ambient lighting, diffused reflectance as well as specular reflectance to find the brightness on a surface. Phong shading also considers the material in the scene which is characterized by four values: the ambient reflection constant (k a ), the diffuse reflection constant (k d ), the specular reflection constant (k s ) and α the Phong constant, which is the shininess of an object. Furthermore, since the specular component produces rays, only some of which would be observed by a single observer, the observer s viewing direction (V) must also be known. For some scene with known material parameters with M light sources the light intensity I phong on a surface with normal vector N seen from viewing direction V can be computed by: I phong = k a I a + m M { kd (L m N)I m,d + k s (R m V) α I m,s }. R m = 2N(L m N) L m where I a, is the color and intensity of the ambient lighting, I m,d and I m,s are the color values for the diffuse and specular light of the m th light source. Blinn-Phong Illumination One shader that is commonly used in graphics rendering today is a modification to the Phong model called the Blinn-Phong model. This model is the same in many respects to Phong s original model except it uses the halfway vectors to calculate the specular reflectance intensity. The halfway vectors are calculated as follows: H = L + V L + V We use this halfway vector to replace R V with N H. Rendering In this part of the assignment you will be asked to write and use the illumination model programs that you learned about in previous sections. You will be finding the light intensity using all three modeling technique for a torus shape with various lighting and material conditions. The equation of a torus in cartesian coordinates is as follows: or in parametric coordinates: T (x, y, z) = ( r 1 x 2 + y 2 ) 2 + z 2 r 2 2. x(u, v) = (r 1 + r 2 cos v) cos u y(u, v) = (r 1 + r 2 cos v) sin u z(u, v) = r 2 sin v where r 1 and r 2 represent the outer and inner radii respectively. 4

Figure 4: Depiction of a torus a. Write a function that calculates the Lambertian light intensity given the light direction L with color and intensity C and I l, and normal vector N. Then use this function in a program that calculates and displays the torus using each of the two lighting sources found in Table 1. Note: You do not need to worry about material coefficients in this model. b. Write a function that calculates the Phong light intensity given the material constants (k a, k d, k s, α), V, N and some number of M light sources. Then use this function in a program that calculates and displays the torus using each of the sets of coefficients found in Table 2 with each light source individually, and both light sources combined. c. Write a function that calculates the Blinn-Phong light intensity given the material constants (k a, k d, k s, α), V, N and some number of M light sources. Then use this function in a program that calculates and displays the torus using each of the sets of coefficients found in Table 2 with each light source individually, and both light sources combined. Hint: To avoid artifacts due to shadows, ensure that any negative intensities found are set to zero. Table 1: Light Sources m Location Color (RGB) 1 ( 1 3, 1 3, 1 3 )T (1, 1, 1) 2 (1, 0, 0) T (1,.5,.5) Table 2: Material Coefficients Mat. k a k d k s α 1 0 0.1 0.75 5 2 0 0.5 0.1 5 3 0 0.5 0.5 10 4 0 0.1 0.75 10 Table 3: Other Parameters r 1 50px r 2 100px ˆV (0, 0, 1) T What to turn in for Problem 6: Submit a hardcopy of your figures and code on the due date with the following: Your code for: Lambertian Model, Phong Model, Blinn-Phong Model Your code for: The program(s) that used to calculate and display the toruses. Figure of all your renderings for the toruses under the different lighting conditions and materials using all 3 models. Please keep in mind that there are a number of plots, so take care to make them readable. In addition, please email to jmerkow@ucsd.edu a copy of your code and figures for problems 5 and 6. Please send as a zip or tar file with [CSE252AHW2] in the subject line. 5