Chapter 7 - Light, Materials, Appearance

Similar documents
Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

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

Pipeline Operations. CS 4620 Lecture 14

Interpolation using scanline algorithm

9. Illumination and Shading

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

Shading and Illumination

CHAPTER 1 Graphics Systems and Models 3

Illumination and Shading

Pipeline Operations. CS 4620 Lecture 10

Global Illumination. Why Global Illumination. Pros/Cons and Applications. What s Global Illumination

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Rasterization Overview

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

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

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

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

Final Project: Real-Time Global Illumination with Radiance Regression Functions

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

Lecture 12: Advanced Rendering

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

Reflection and Shading

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

Virtual Reality for Human Computer Interaction

The Traditional Graphics Pipeline

Rendering and Radiosity. Introduction to Design Media Lecture 4 John Lee

COMP371 COMPUTER GRAPHICS

CS5620 Intro to Computer Graphics

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

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

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

Photorealism: Ray Tracing

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene).

Lecture 15: Shading-I. CITS3003 Graphics & Animation

CS 130 Exam I. Fall 2015

The Traditional Graphics Pipeline

CPSC GLOBAL ILLUMINATION

Computer Graphics. Illumination and Shading

Introduction to Visualization and Computer Graphics

Graphics for VEs. Ruth Aylett

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

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

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

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

How do we draw a picture?

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

CPSC / Illumination and Shading

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

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

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

Level of Details in Computer Rendering

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

CS 488. More Shading and Illumination. Luc RENAMBOT

Computer Graphics I Lecture 11

Illumination Models & Shading

From Graphics to Visualization

03 RENDERING PART TWO

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

The Traditional Graphics Pipeline

CPSC 314 LIGHTING AND SHADING

Shading 1: basics Christian Miller CS Fall 2011

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Intro to Ray-Tracing & Ray-Surface Acceleration

Photorealistic 3D Rendering for VW in Mobile Devices

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

Topics and things to know about them:

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Lighting and Shading

TDA361/DIT220 Computer Graphics, January 15 th 2016

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

Graphics Hardware and Display Devices

Virtual Reality for Human Computer Interaction

Shadows. COMP 575/770 Spring 2013

The Rasterization Pipeline

TSBK03 Screen-Space Ambient Occlusion

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

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

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

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

CS451Real-time Rendering Pipeline

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

Computer Graphics and GPGPU Programming

CS 130 Final. Fall 2015

CS 325 Computer Graphics

Visualisatie BMT. Rendering. Arjan Kok

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

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

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

Deferred Rendering Due: Wednesday November 15 at 10pm

Overview: Ray Tracing & The Perspective Projection Pipeline

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

Supplement to Lecture 16

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

6. Illumination, Lighting

Transcription:

Chapter 7 - Light, Materials, Appearance Types of light in nature and in CG Shadows Using lights in CG Illumination models Textures and maps Procedural surface descriptions Literature: E. Angel/D. Shreiner, Interactive Computer Graphics A Top-Down Approach with Shader-Based OpenGL, 6th ed., Pearson 2012 1

Procedural Surface Descriptions Programming languages for surface descriptions Can influence various stages of the rendering pipeline in particular: can implement textures and the Phong model but also much more... Can describe real 3D structures not just surface color State of the art in high end 3D graphics e.g., RenderMan, used in PIXAR movies also in OpenGL, DirectX Detailed implementation varies depending on the platform in OpenGL: GL Shading Language (GLSL) Used for vertex shaders and fragment shaders https://renderman.pixar.com/products/tools/rms-slim.html 2

Pipeline Architectures for 3D Graphics Pipelining improves throughput At the same time product n undergoes procedure n, and product n 1 undergoes procedure n 1 Pipelines in computer graphics target parallel processing Basic geometric pipeline: Objects (vertices) to pixels Intermediate product: fragment Fragment is a potential pixel Information needed to update a pixel in frame buffer Assemply line by Henry Ford Source: bethnowacki.weebly.com Angel/Shreiner 3

Fixed-Function and Programmable Pipelines Traditional pipelining: Fixed Function Pipeline Order and functionality of steps in the pipeline are fixed Many options and parameters to adjust behavior of (hardware) implementation Modern pipelining architecture: Programmable Pipelines General scheme of pipeline is fixed Main steps are programmable by developer OpenGL Architecture: Vertex processing and fragment processing are programmable ( Shader ) Using GLSL; alternative languages exist, e.g. Nvidia Cg Vertex Shader Fragment Shader 4

OpenGL: Vertex and Fragment Shaders Vertex Shader can do the following: transform the vertex position using the modelview and projection matrices transform normals, and if required normalize them generate and transform texture coordinates lighting per vertex or compute values for lighting per pixel color computation Fragment Shader can do the following: compute colors, and texture coordinates per pixel apply a texture fog computation compute normals if you want lighting per pixel This, and more details at: http://www.lighthouse3d.com/opengl/glsl/ 5

Chapter 8 - Shading and Rendering Local Illumination Models: Shading Global Illumination: Ray Tracing Global Illumination: Radiosity Non-Photorealistic Rendering Literature: H.-J. Bungartz, M. Griebel, C. Zenger: Einführung in die Computergraphik, 2. Auflage, Vieweg 2002 6

The 3D rendering pipeline (our version for this class) 3D models in model coordinates 3D models in world coordinates 2D Polygons in camera coordinates Pixels in image coordinates Scene graph Camera Rasterization Animation, Interaction Lights 7

Local Illumination: Shading Local illumination: Light calculations are done locally without the global scene No cast shadows (since those would be from other objects, hence global) Object shadows are OK, only depend on the surface normal Simple idea: Loop over all polygons For each polygon: Determine the pixels it occupies on the screen and their color Draw using e.g., Z-buffer algorithm to get occlusion right Each polygon only considered once Some pixels considered multiple times More efficient: Scan-line algorithms 8

Scan-Line Algorithms in More Detail Using u for horizontal pixel dimension, v for vertical pixel dimension Edge Table (ET): List of all non-horizontal edges, sorted by smaller u value of end point Refers to polygons to which the edge belongs Polygon Table (PT): List of all polygons with plane equation parameters, color information and inside/outside flag (see earlier in the lecture) Active Edge Table (AET): List of all edges crossing the current scan line for v = 0..V (all scan lines): Compute AET, reset flags in PT; for all crossings in AET: update flags; determine currently visible polygon P; set pixel color according to info for P in PT; end end Each polygon considered only once Each pixel considered only once 9

Reminder: Phong s Illumination Model I o = I amb + I diff + I spec = I a k a + I i k d ( l n )+I i k s ( r v ) n Prerequisites for using the model: Exact location on surface known Light source(s) known Generalization to many light sources: Summation of all diffuse and specular components created by all light sources Light colors easily covered by the model Do we really have to compute the formula for each pixel? r v n l 10

Flat Shading Determine one surface normal for each triangle Compute the color for this triangle using e.g., the Phong illumination model e.g. for the center point of the triangle using the normal, camera and light positions Draw the entire triangle in this color Neighboring triangles will have different shades Visible crease between triangles Cheapest and fastest form of shading Can be a wanted effect, e.g. with primitives 11

Mach Band Effect Flat Shading suffers from an optical illusion Human visual system accentuates discontinuity at brightness boundary Darker stripes appear to exist at dark side, and vice versa Source: keithwiley.com Source: Wikipedia 12

Gouraud Shading Determine normals for all mesh vertices i.e., triangle now has 3 normals Compute colors at all vertices using e.g., the Phong illumination model using the 3 normals, camera and light positions Interpolate between these colors along the edges Interpolate also for the inner pixels of the triangle Neighboring triangles will have smooth transitions If normals at a vertex are the same for all triangles using it Simplest form of smooth shading Specular highlights only if they fall on a vertex by chance 13

Phong Shading Determine normals for all mesh vertices Interpolate between these normals along the edges Compute colors at all vertices using e.g., the Phong illumination model using the interpolated normal, camera and light positions Neighboring triangles will have smooth transitions If normals at a vertex are the same for all triangles using it Has widely substituted Gouraud shading Specular highlights in arbitrary positions Have to compute Phong illumination model for every pixel 14

Shading in OpenGL Standard built-in shaders: Flat shading Gouraud shading (default) Shader set by glshademodel function GL_FLAT, GL_SMOOTH Additional global settings in gllightmodel* E.g. properties of ambient light E.g. enforcement of separate treatment for specular and nonspecular colors (as needed when using texture patterns on specular surfaces) 15

Chapter 8 - Shading and Rendering Local Illumination Models: Shading Global Illumination: Ray Tracing Global Illumination: Radiosity Non-Photorealistic Rendering 16

Global illumination: Ray Tracing Global illumination: Light calculations are done globally considering the entire scene i.e. cast shadows are OK if properly calculated Object shadows are OK anyway Ray casting: From the eye, cast a ray through every screen pixel Find the first polygon it intersects with Determine its color at intersection and use for the pixel Also solves occlusion (makes Z-Buffer unnecessary) Ray tracing: recursive ray casting From intersection, follow reflected and refracted beams up to a maximum recursion depth Works with arbitrary geometric primitives http://pclab.arch.ntua.gr/03postgra/mladenstamenico/ (probably not original) 17

http://hof.povray.org/glasses.html 18

source: Blender Gallery 19

source: Blender Gallery 20

Brainstorming: What Makes Ray Tracing Hard? 21

Optimizations for Ray Tracing Bounding volumes: Instead of calculating intersection with individual objects, first calculate intersection with a volume containing several objects Can decrease computation time to less than linear complexity (in number of existing objects) Adaptive recursion depth control Maximum recursion limit is always necessary Recursion should be stopped as soon as possible E.g. stop if intensity goes below a threshold value Monte Carlo Methods Improve complexity (cascading recursion = exponential) Use one random ray for recursive tracing (instead of refracted/reflected rays) Carry out multiple experiments (e.g. 100) and compute average values 22

Recent development: Real Time Ray Tracing Various optimizations presented over the last few years Real time ray tracing has become feasible Follow http://openrt.de/ (images from there) 23

Chapter 8 - Shading and Rendering Local Illumination Models: Shading Global Illumination: Ray Tracing Global Illumination: Radiosity Non-Photorealistic Rendering 24

Reminder: The rendering equation [Kajiya 86] I o (x, ω) =I e (x, ω)+ Io = outgoing light Ie = emitted light Reflectance Function Ii = incoming light angle of incoming light f r (x, ω, ω)i i (x, ω )( ω n )d ω Ω Describes all flow of light in a scene in an abstract way doesn t describe some effects of light: http://en.wikipedia.org/wiki/file:rendering_eq.png 25

Global Illumination: Radiosity source: Blender Gallery Simulation of energy flow in scene Can show color bleeding blueish and reddish sides of boxes Naturally deals with area light sources Creates soft shadows Only uses diffuse reflection does not produce specular highlights http://www.webreference.com/3d/lesson46/ 26

Radiosity Algorithm Divide all surfaces into small patches For each patch determine its initial energy Loop until close to energy equilibrium Loop over all patches determine energy exchange with every other patch Radiosity solution : energy for all patches Recompute if changes http://en.wikipedia.org/wiki/file:radiosity_progress.png http://pclab.arch.ntua.gr/03postgra/mladenstamenico/ (probably not original) 27

source: Blender Gallery 28

Combinations Ray Tracing is adequate for reflecting and transparent surfaces Radiosity is adequate for the interaction between diffuse light sources What we want is a combination of the two! This is non-trivial, a simple sequence of algorithms is not sufficient Example for a state-of-the-art combination (more like another innovative approach): Photon Maps (Jensen 96) First step: Inverse ray tracing with accumulation of light energy Photons are sent from light sources into scene, using Monte Carlo approach Surfaces accumulate energy from various sources Second step: Path tracing (i.e. Monte Carlo based ray tracing) in optimized version (e.g. only small recursion depth) 29

Chapter 8 - Shading and Rendering Local Illumination Models: Shading Global Illumination: Ray Tracing Global Illumination: Radiosity Non-Photorealistic Rendering 30

Non-Photorealistic Rendering (NPR) Create graphics that look like drawings or paintings One method: stroke-based NPR instead of grey shades, determine a stroke density and pattern imitates pencil drawings or etchings (Kupferstich) Other methods: using image manipulation on rendered images can in principle often be done in Photoshop http://www.cs.ucdavis.edu/~ma/siggraph02/course23/ Active field of research http://www.cs.ucdavis.edu/~ma/siggraph02/course23/ http://graphics.uni-konstanz.de/forschung/npr/watercolor/ many others http://www.katrinlang.de/npr/ 31