Lighting and Shading

Similar documents
CS5620 Intro to Computer Graphics

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

COMP371 COMPUTER GRAPHICS

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

Illumination Models & Shading

CS 325 Computer Graphics

Raytracing. COSC 4328/5327 Scott A. King

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

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

03 RENDERING PART TWO

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

Photorealism: Ray Tracing

CPSC 314 LIGHTING AND SHADING

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

Raytracing CS148 AS3. Due :59pm PDT

Lecture 10: Ray tracing

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

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

Complex Shading Algorithms

Ray Tracing. Kjetil Babington

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

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

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

Illumination & Shading: Part 1

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

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

Ray-Tracing. Misha Kazhdan

Reflection and Shading

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

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

Shading I Computer Graphics I, Fall 2008

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

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

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

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

Supplement to Lecture 16

Illumination and Shading

Illumination and Shading

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

Global Illumination. COMP 575/770 Spring 2013

Introduction to Computer Graphics 7. Shading

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

Comp 410/510 Computer Graphics. Spring Shading

Simple Lighting/Illumination Models

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

Illumination and Shading

Recall: Basic Ray Tracer

Introduction to Visualization and Computer Graphics

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Virtual Reality for Human Computer Interaction

Interpolation using scanline algorithm

CS 488. More Shading and Illumination. Luc RENAMBOT

Movie: For The Birds. Announcements. Ray Tracing 1. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

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

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

Shading, Advanced Rendering. Week 7, Wed Feb 28

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

Pipeline Operations. CS 4620 Lecture 10

Illumination & Shading

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

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Sung-Eui Yoon ( 윤성의 )

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

9. Illumination and Shading

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

Lighting. Figure 10.1

Advanced Shading I: Shadow Rasterization Techniques

Raytracing & Epsilon. Today. Last Time? Forward Ray Tracing. Does Ray Tracing Simulate Physics? Local Illumination

Lighting affects appearance

Shading and Illumination

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Illumination. Courtesy of Adam Finkelstein, Princeton University

Lighting and Reflectance COS 426

Illumination and Shading

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

Rendering Part I (Basics & Ray tracing) Lecture 25 December 1, 2015

Shading 1: basics Christian Miller CS Fall 2011

CS 428: Fall Introduction to. Raytracing. Andrew Nealen, Rutgers, /18/2009 1

COMP environment mapping Mar. 12, r = 2n(n v) v

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

Interactive Methods in Scientific Visualization

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

CPSC GLOBAL ILLUMINATION

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

Assignment 2 Ray Tracing

Local vs. Global Illumination & Radiosity

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

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

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

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Ray Tracing. Local Illumination. Object Space: Global Illumination. Image Space: Backward Ray Tracing. First idea: Forward Ray Tracing

Sung-Eui Yoon ( 윤성의 )

Ray Tracing COMP575/COMP770

Ray Tracing: shading

Visualisatie BMT. Rendering. Arjan Kok

Computer Graphics. Lecture 9 Environment mapping, Mirroring

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

Transcription:

Lighting and Shading

Today: Local Illumination Solving the rendering equation is too expensive First do local illumination Then hack in reflections and shadows

Local Shading: Notation light intensity in, light intensity out vector pointing to: light, normal direction, eye, reflection direction

Ambient Term Ignore camera and light direction completely material constant

Ambient Term Ignore camera and light direction completely one eq. per color channel material constant

Diffuse Term Lambertian surface constant BRDF

Diffuse Term Lambertian surface constant BRDF ignore back faces

Specular Term Perfect specular surface doesn t work

Specular Term Perfect specular surface doesn t work Phong model: specularity coefficient

Specular Term Perfect specular surface doesn t work Phong model: Looks like highlight that moves with light & eye

Putting It Together

Putting It Together typically:

Putting It Together typically: three copies of equation, one per color channel

higher expoonent Specularity Coefficient more specular

Light Attenuation Real light attenuation: inverse square law

Light Attenuation Real light attenuation: inverse square law Tends to look bad: too dim or washed out So, we cheat

Light Attenuation d is light-to-point distance Can tweak constant & linear term to taste

Directional Light Light at infinity Sun All light rays parallel Obviously, no attenuation

Dealing with Discrete Geometry Flat shading: use normal per face Very obvious discontinuities at edges Only used for stylized chunky effect

Gouraud Interpolation First, compute color at vertices Linearly interpolate color over face

Gouraud Interpolation First, compute color at vertices Linearly interpolate color over face Color now continuous, but still obvious artifacts (nobody uses this anymore)

Phong Interpolation First, linearly interpolate normals Next, renormalize normals (important) Then, compute color per pixel

Phong Interpolation First, linearly interpolate normals Next, renormalize normals (important) Then, compute color per pixel Because of all of the normalizations, used to be considered decadent; now the standard local shading scheme

Local vs Global Illumination Local: shade each object based only on itself, the eye, and the light sources Global: take all other objects in scene into account also BRDFs and the rendering equation

Local vs Global Illumination Grey Area: take other objects into account, without full global illumination adds realism without being too slow

Local vs Global Illumination Grey Area: take other objects into account, without full global illumination adds realism without being too slow common techniques exist for shadows reflections refractions

Shooting Shadow Rays

Shooting Shadow Rays For each intersection pt: for each light: shoot ray from point to light if it hits an object: do nothing (shadow) else add shading contribution

Classic Bug

Classic Bug at what t does the ray hit an object?

Classic Bug at what t does the ray hit an object?

Classic Bug at what t does the ray hit an object? if lucky: {-1.2, 0.0}

Classic Bug at what t does the ray hit an object? if lucky: {-1.2, 0.0} if unlucky: {-1.2, 1e-12}

Ignore t Near Zero?

Ignore t Near Zero?

Ignore t Near Zero? Fix: move slightly in normal direction (or backward ray direction) before shooting shadow ray

Hard Shadows real-world doesn t look like this

Hard Shadows real-world doesn t look like this shadows usually soft why?

Soft Shadows

Other Secondary Rays Translucent objects

Other Secondary Rays Reflection & refraction

Reflection Purely specular (mirrored) surface

Reflection Purely specular (mirrored) surface: 1. Incoming ray hits surface

Reflection Purely specular (mirrored) surface: 1. Incoming ray hits surface 2. Shoot secondary reflection ray

Reflection Purely specular (mirrored) surface: 1. Incoming ray hits surface 2. Shoot secondary reflection ray 3. Set pixel color to color seen by

Choosing the Reflection Ray Angle of reflection = angle of incidence

Choosing the Reflection Ray Angle of reflection = angle of incidence I.e. negate component of in normal dir leave tangent component untouched

Choosing the Reflection Ray Angle of reflection = angle of incidence I.e. negate component of in normal dir leave tangent component untouched

Choosing the Reflection Ray Angle of reflection = angle of incidence I.e. negate component of in normal dir leave tangent component untouched

Choosing the Reflection Ray The math:

Reflection in Practice Objects may not be perfectly mirrored blend reflected color with basic shading

Reflection in Practice Objects may not be perfectly mirrored blend reflected color with basic shading Objects have base color multiplies reflected color

Reflections in Practice Reflection ray might hit reflective objects cast recursive reflection rays stop after some maximum recursion limit

Refraction

Refraction Light bends when moving between different materials Caused by change in speed of light We see dotted straw

Index of Refraction Measures speed of light in material

Index of Refraction Measures speed of light in material Common values: Vacuum: 1.0 Air: 1.0001 Water: 1.33 Glass: 1.5

Snell s Law Special cases:

Implementing Snell s Law Shoot refraction ray Solve for alpha

Refractions in Practice Again, usually multiplied by a base color Light bends when entering and leaving must detect both when ray-tracing

Reflection & Refraction Example