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

Similar documents
Computer Graphics. Introduction. Computer graphics. What is computer graphics? Yung-Yu Chuang

PRODUCT LIFECYCLE MANAGEMENT COMPETENCY CENTRE RENDERING. PLMCC, JSS Academy of Technical Education, Noida Rendering 1 of 16

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

CUBE-MAP DATA STRUCTURE FOR INTERACTIVE GLOBAL ILLUMINATION COMPUTATION IN DYNAMIC DIFFUSE ENVIRONMENTS

INTRODUCTION TO RENDERING TECHNIQUES

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

The Comprehensive PBR Guide by Allegorithmic - vol. 1. Light and Matter : The theory of Physically-Based Rendering and Shading

PHOTON mapping is a practical approach for computing global illumination within complex

CS 431/636 Advanced Rendering Techniques"

CSE168 Computer Graphics II, Rendering. Spring 2006 Matthias Zwicker

Advanced Computer Graphics. Rendering Equation. Matthias Teschner. Computer Science Department University of Freiburg

Thea Omni Light. Thea Spot Light. Light setup & Optimization

Chapter 23. The Reflection of Light: Mirrors

Specular reflection. Dielectrics and Distribution in Ray Tracing. Snell s Law. Ray tracing dielectrics

Dhiren Bhatia Carnegie Mellon University

A Short Introduction to Computer Graphics

Lighting Estimation in Indoor Environments from Low-Quality Images

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

The Lighting Effects Filter

An introduction to Global Illumination. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Overview. What is EMR? Electromagnetic Radiation (EMR) LA502 Special Studies Remote Sensing

path tracing computer graphics path tracing 2009 fabio pellacini 1

Getting Started with iray in 3ds Max 2014

So, you want to make a photo-realistic rendering of the Earth from orbit, eh? And you want it to look just like what astronauts see from the shuttle

Lesson 26: Reflection & Mirror Diagrams

Maya 2014 Still Life Part 1 Texturing & Lighting

Chapter 10. Bidirectional Path Tracing

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Physically-Based Shading Models in Film and Game Production

Monte Carlo Path Tracing

Reflectance Characteristics of Accuflect Light Reflecting Ceramic

Improved predictive modeling of white LEDs with accurate luminescence simulation and practical inputs

Reflectance Measurements of Materials Used in the Solar Industry. Selecting the Appropriate Accessories for UV/Vis/NIR Measurements.

Path Tracing. Michael Doggett Department of Computer Science Lund university Michael Doggett

THERMAL RADIATION (THERM)

Lezione 4: Grafica 3D*(II)

SEMIAUTOMATIC SURFACE REFLECTANCE MEASUREMENT FOR MONITORING OF MATERIAL WEATHERING

REAL-TIME IMAGE BASED LIGHTING FOR OUTDOOR AUGMENTED REALITY UNDER DYNAMICALLY CHANGING ILLUMINATION CONDITIONS

Computer Animation: Art, Science and Criticism

Reflection and Refraction

IT 386: 3D Modeling and Animation. Review Sheet. Notes from Professor Nersesian s IT 386: 3D Modeling and Animation course

Mathematics for Global Illumination

Introduction to Computer Graphics

GRAFICA - A COMPUTER GRAPHICS TEACHING ASSISTANT. Andreas Savva, George Ioannou, Vasso Stylianou, and George Portides, University of Nicosia Cyprus

COMP175: Computer Graphics. Lecture 1 Introduction and Display Technologies

Visualization and Feature Extraction, FLOW Spring School 2016 Prof. Dr. Tino Weinkauf. Flow Visualization. Image-Based Methods (integration-based)

A Proposal for OpenEXR Color Management

Two Research Schools become ONE

Lighting & Rendering in Maya: Lights and Shadows

Making natural looking Volumetric Clouds In Blender 2.48a

Lecture 12: Cameras and Geometry. CAP 5415 Fall 2010

Treasure Hunt. Lecture 2 How does Light Interact with the Environment? EMR Principles and Properties. EMR and Remote Sensing

Solving Simultaneous Equations and Matrices

Rally Sport Racing Game: CodeName Space Racer

Advanced Rendering for Engineering & Styling

Imaging Systems Laboratory II. Laboratory 4: Basic Lens Design in OSLO April 2 & 4, 2002

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

How many PIXELS do you need? by ron gibbs

RAY OPTICS II 7.1 INTRODUCTION

Synthetic Sensing: Proximity / Distance Sensors

521493S Computer Graphics. Exercise 2 & course schedule change

My Materials. In this tutorial, we ll examine the material settings for some simple common materials used in modeling.

3D Math Overview and 3D Graphics Foundations

H.Calculating Normal Vectors

GRADES 7, 8, AND 9 BIG IDEAS

CS 4204 Computer Graphics

Lighting Options for elearning Video (Sep 11)

Shutter & Aperture Research & Demonstrations

The RADIANCE Lighting Simulation and Rendering System

Introduction to acoustic imaging

ADVANCED THEORIES FOR CG LIGHTING

CSE 167: Lecture 13: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Monte Carlo Path Tracing

Common Core Unit Summary Grades 6 to 8

Using HDR Panoramas. Dr Ryan Southall - School of Architecture & Design, University of Brighton.

Graphic Design. Background: The part of an artwork that appears to be farthest from the viewer, or in the distance of the scene.

Motivation. Motivation

2 Absorbing Solar Energy

Spectroscopic Ellipsometry:

Materials in NX Render

Examples of Uniform EM Plane Waves

Curves and Surfaces. Goals. How do we draw surfaces? How do we specify a surface? How do we approximate a surface?

A Language for Shading and Lighting Calculations

PATH TRACING: A NON-BIASED SOLUTION TO THE RENDERING EQUATION

Light Waves and Matter

ABS 731 Lighting Design & Technology. Spring 2006

Diffraction of a Circular Aperture

28 CHAPTER 1. VECTORS AND THE GEOMETRY OF SPACE. v x. u y v z u z v y u y u z. v y v z

Energy Pathways in Earth s Atmosphere

High Dynamic Range and other Fun Shader Tricks. Simon Green

Cartoon-Looking Rendering of 3D-Scenes

Gradient and Curvature from Photometric Stereo Including Local Confidence Estimation

IN previous chapters we assumed that all lighting interactions occurred at surfaces. In particular,

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Technical Report An Analysis on the Use of LED Lighting for Video Conferencing

Photorealistic Rendering Techniques in AutoCAD 3D

Optical Design Tools for Backlight Displays

Instructor. Goals. Image Synthesis Examples. Applications. Computer Graphics. Why Study 3D Computer Graphics?

PHOTOELECTRIC EFFECT AND DUAL NATURE OF MATTER AND RADIATIONS

Transcription:

Reading Required: Shirley, Chapter 10 Shading Brian Curless CSE 557 Fall 2013 1 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D obects in their local coordinate systems into a global (world) coordinate system: Pinhole camera To create an image of a virtual scene, we need to define a camera, and we need to model lighting and shading. For the camera, we use a pinhole camera. M 1 M 2 [Angel, 2011] To synthesize an image of the scene, we also need to add light sources and a viewer/camera: The image is rendered onto an image plane (usually in front of the camera). Viewing rays emanate from the center of proection (COP) at the center of the pinhole. The image of an obect point P is at the intersection of the viewing ray through P and the image plane. 3 4

Shading An abundance of photons Next, we ll need a model to describe how light interacts with surfaces. Such a model is called a shading model. Other names: Lighting model Light reflection model Local illumination model Reflectance model BRDF Given the camera and shading model, properly determining the right color at each pixel is extremely hard. Look around the room. Each light source has different characteristics. Trillions of photons are pouring out every second. These photons can: interact with molecules and particles in the air ( participating media ) strike a surface and be absorbed be reflected (scattered) cause fluorescence or phosphorescence. interact in a wavelength-dependent manner generally bounce around and around 5 6 Our problem Setup We re going to build up to a approximations of reality called the Phong and Blinn-Phong illumination models. They have the following characteristics: not physically correct gives a first-order approximation to physical light reflection very fast widely used In addition, we will assume local illumination, i.e., light goes: light source -> surface -> viewer. No interreflections, no shadows. Given: a point P on a surface visible through pixel p The normal N at P The lighting direction, L, and (color) intensity, I L, at P The viewing direction, V, at P The shading coefficients at P Compute the color, I, of pixel p. Assume that the direction vectors are normalized: N = L = V = 1 7 8

Iteration zero Iteration one The simplest thing you can do is Assign each polygon a single color: where I = k e I is the resulting intensity k e is the emissivity or intrinsic shade associated with the obect Let s make the color at least dependent on the overall quantity of light available in the scene: I = k + k I k a is the ambient reflection coefficient. e really the reflectance of ambient light ambient light is assumed to be equal in all directions I La is the ambient light intensity. This has some special-purpose uses, but not really good for drawing a scene. Physically, what is ambient light? [Note: k e is omitted in Shirley.] [Note: Shirley uses c a instead of I La.] 9 10 Wavelength dependence Diffuse reflection Really, k e, k a, and I La are functions over all wavelengths λ. Ideally, we would do the calculation on these functions. For the ambient shading equation, we would start with: I ( λ) = k ( λ) I ( λ) then we would find good RGB values to represent the spectrum I(λ). Traditionally, though, k a and I La are represented as RGB triples, and the computation is performed on each color channel separately: I a La R R R I = k I = k I G G G I = k I B B B Let s examine the ambient shading model: obects have different colors we can control the overall light intensity what happens when we turn off the lights? what happens as the light intensity increases? what happens if we change the color of the lights? So far, obects are uniformly lit. not the way things really appear in reality, light sources are localized in position or direction Diffuse, or Lambertian reflection will allow reflected intensity to vary with the direction of the light. 11 12

Diffuse reflectors Diffuse reflectors Diffuse reflection occurs from dull, matte surfaces, like latex paint, or chalk. These diffuse or Lambertian reflectors reradiate light equally in all directions. or picture a surface with little pigment particles embedded beneath the surface (neglect reflection at the surface for the moment): Picture a rough surface with lots of tiny microfacets. The microfacets and pigments distribute light rays in all directions. Embedded pigments are responsible for the coloration of diffusely reflected light in plastics and paints. Note: the figures above are intuitive, but not strictly (physically) correct. 13 14 Diffuse reflectors, cont. Iteration two The reflected intensity from a diffuse surface does not depend on the direction of the viewer. The incoming light, though, does depend on the direction of the light source: The incoming energy is proportional to the diffuse reflection equations: I = k + k I e d L + k I B, giving = k + k I + k I B( ) e d L where: k d is the diffuse reflection coefficient I L is the (color) intensity of the light source N is the normal to the surface (unit vector) L is the direction to the light source (unit vector) B prevents contribution of light from below the surface: 1 if N L > 0 B = 0 if N L 0 [Note: Shirley uses c r and c l instead of k d and L.] 15 16

Specular reflection Specular reflection derivation Specular reflection accounts for the highlight that you see on some obects. It is particularly important for smooth, shiny surfaces, such as: metal polished stone plastics apples skin For a perfect mirror reflector, light is reflected about N, so I L if V = R I = 0 otherwise Properties: Specular reflection depends on the viewing direction V. For non-metals, the color is determined solely by the color of the light. For metals, the color may be altered (e.g., brass) For a near-perfect reflector, you might expect the highlight to fall off quickly with increasing angle φ. Also known as: rough specular reflection directional diffuse reflection glossy reflection 17 18 Phong specular reflection Blinn-Phong specular reflection cos ns φ 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 ns = 1 A common alternative for specular reflection is the Blinn-Phong model (sometimes called the modified Phong model.) We compute the vector halfway between L and V as: 0.2 0.1 ns = 128 0 100 80 60 40 20 0 20 40 60 80 100 φ One way to get this effect is to take (R V), raised to a power n s. As n s gets larger, the dropoff becomes {more,less} gradual gives a {larger,smaller} highlight simulates a {more,less} mirror-like surface Phong specular reflection is proportional to: where (x) + max(0, x). n specular B R V + s I ( ) Analogous to Phong specular reflection, we can compute the specular contribution in terms of (N H), raised to a power n s : n specular B N H + s I ( ) where, again, (x) + max(0, x). 19 20

Iteration three Directional lights The next update to the Blinn-Phong shading model is then: where: I = k + k I + k I B( N L) + k I B( N H) e d L s L = k ILB e + kai La + k d ( N L) + ks( N H) ns ns k s is the specular reflection coefficient n s is the specular exponent or shininess H is the unit halfway vector between L and V, where V is the viewing direction. The simplest form of lights supported by renderers are ambient, directional, and point. Spotlights are also supported often as a special form of point light. We ve seen ambient light sources, which are not really geometric. Directional light sources have a single direction and intensity associated with them. [Note: Shirley uses e, r, h, and p instead of V, R, H, and n s.] 21 Using affine notation, what is the homogeneous coordinate for a directional light? 22 Point lights Spotlights The direction of a point light sources is determined by the vector from the light position to the surface point. We can also apply a directional attenuation of a point light source, giving a spotlight effect. E - P L = E - P r = E - P Physics tells us the intensity must drop off inversely with the square of the distance: 1 f = atten r 2 Sometimes, this distance-squared dropoff is considered too harsh. A common alternative is: 1 f = atten 2 a+ br + cr with user-supplied constants for a, b, and c. Using affine notation, what is the homogeneous coordinate for a point light? A common choice for the spotlight intensity is: where ( L S) if L S cosβ f = 2 spot a + br + cr 0 otherwise L is the direction to the point light. S is the center direction of the spotlight. β is the cutoff angle for the spotlight e is the angular falloff coefficient e 23 24

Iteration four Choosing the parameters Since light is additive, we can handle multiple lights by taking the sum over every light. Our equation is now: I = k + k I + e ( L S ) e β ( N L ) ( N H ) I B k + k n s 2 L, d s a + b r + c r Experiment with different parameter settings. To get you started, here are a few suggestions: Try n s in the range [0,100] Try k a + k d + k s < 1 Use a small k a (~0.1) n s k d k s This is the Phong illumination model. Which quantities are spatial vectors? Metal Plastic large medium Small, color of metal Medium, color of plastic Large, color of metal Medium, white Which are RGB triples? Planet 0 varying 0 Which are scalars? 25 26 BRDF The diffuse+specular parts of the Blinn-Phong illumination model are a mapping from light to viewing directions: s L + V I = ILB k d ( N L) + ksn L + V = I f ( L, V) The mapping function f r is often written in terms of incoming (light) directions ω in and outgoing (viewing) directions ω out : f ( ω, ω ) or f ( ω ω ) r L in r out This function is called the Bi-directional Reflectance Distribution Function (BRDF). Here s a plot with ω in held constant: r in n out More sophisticated BRDF s [Cook and Torrance, 1982] Anisotropic BRDFs [Westin, Arvo, Torrance 1992] f ( ω, ω ) r in out ω in BRDF s can be quite sophisticated 27 Artistics BRDFs [Gooch] 28

Gouraud vs. Phong interpolation Faceted shading Now we know how to compute the color at a point on a surface using the Blinn-Phong lighting model. Assume each face has a constant normal: Does graphics hardware do this calculation at every point? Not by default... Smooth surfaces are often approximated by polygonal facets, because: Graphics hardware generally wants polygons (esp. triangles). Sometimes it easier to write ray-surface intersection algorithms for polygonal models. How do we compute the shading for such a surface? For a distant viewer and a distant light source and constant material properties over the surface, how will the color of each triangle vary? Result: faceted, not smooth, appearance. 29 30 Faceted shading (cont d) Gouraud interpolation To get a smoother result that is easily performed in hardware, we can do Gouraud interpolation. Here s how it works: 1. Compute normals at the vertices. 2. Shade only the vertices. 3. Interpolate the resulting vertex colors. [Williams and Siegel 1990] 31 32

Facted shading vs. Gouraud interpolation Gouraud interpolation artifacts Gouraud interpolation has significant limitations. 1. If the polygonal approximation is too coarse, we can miss specular highlights. 2. We will encounter Mach banding (derivative discontinuity enhanced by human eye). This is what graphics hardware does by default. A substantial improvement is to do [Williams and Siegel 1990] 33 34 Phong interpolation Gouraud vs. Phong interpolation To get an even smoother result with fewer artifacts, we can perform Phong interpolation. Here s how it works: 1. Compute normals at the vertices. 2. Interpolate normals and normalize. 3. Shade using the interpolated normals. 35 [Williams and Siegel 1990] 36