OpenGL Lighting Computer Graphics Spring Frank Palermo

Similar documents
Shading I Computer Graphics I, Fall 2008

Illumination and Shading

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Illumination & Shading: Part 1

Comp 410/510 Computer Graphics. Spring Shading

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Light Sources. Spotlight model

Illumination & Shading

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Illumination and Shading

Illumination Models & Shading

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

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

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

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

CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading. Emmanuel Agu

CGT520 Lighting. Lighting. T-vertices. Normal vector. Color of an object can be specified 1) Explicitly as a color buffer

Sung-Eui Yoon ( 윤성의 )

Illumination and Shading

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

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

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

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

Shading. CSE 457 Winter 2015

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

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

Shading and Illumination

Illumination and Shading

CS5620 Intro to Computer Graphics

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

Shading. Brian Curless CSE 457 Spring 2015

w Foley, Section16.1 Reading

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

Why we need shading?

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Computer Graphics. Illumination and Shading

Shading , Fall 2004 Nancy Pollard Mark Tomczak

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Introduction to Computer Graphics 7. Shading

Illumination in Computer Graphics

Illumination & Shading I

Phong Lighting & Materials. Some slides modified from: David Kabala Others from: Andries Van Damm, Brown Univ.

CEng 477 Introduction to Computer Graphics Fall

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

Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008

LIGHTING AND SHADING

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

Lighting/Shading III. Week 7, Wed Mar 3

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

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

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

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

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

Computer Graphics. Illumination and Shading

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

The Rasterization Pipeline

CS 4600 Fall Utah School of Computing

CSE 681 Illumination and Phong Shading

CPSC 314 LIGHTING AND SHADING

Pipeline Operations. CS 4620 Lecture 10

Virtual Reality for Human Computer Interaction

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

CPSC / Illumination and Shading

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

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

Shading. Brian Curless CSE 457 Spring 2017

Pipeline Operations. CS 4620 Lecture 14

Light Transport Baoquan Chen 2017

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

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

Virtual Reality for Human Computer Interaction

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

University of British Columbia CPSC 314 Computer Graphics Sep-Dec Tamara Munzner (guest lecturing) Lighting/Shading

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

1.6 Rough Surface Scattering Applications Computer Graphic Shading and Rendering

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

Visualisatie BMT. Rendering. Arjan Kok

CG Surfaces: Materials, Shading, and Texturing

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

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

CS452/552; EE465/505. Intro to Lighting

Lecture 4 Advanced Computer Graphics (CS & SE )

Illumination & Shading

Interactive Real-Time Raycasting

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

Shading. Brian Curless CSE 557 Autumn 2017

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

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

Graphics and Visualization

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

Lighting. Figure 10.1

CS 488. More Shading and Illumination. Luc RENAMBOT

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

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

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

Transcription:

OpenGL Lighting 15-462 Computer Graphics Spring 2009 Frank Palermo

OpenGL is just a bunch of hacks. -Adrien Treuille

What Adrien Means... What Adrien means is that OpenGL was designed to produce reasonable-looking 3D images quickly & simply. A lot of its design is not based on the way light actually behaves in the real world, or on the way we perceive a scene. Keep that in mind as we discuss the OpenGL pipeline and lighting model.

The OpenGL Pipeline * Featuring slides shamelessly stolen from a previous teaching of 15-462!

The OpenGL Pipeline * Featuring slides shamelessly stolen from a previous teaching of 15-462!

The OpenGL Pipeline * Featuring slides shamelessly stolen from a previous teaching of 15-462!

The OpenGL Pipeline * Featuring slides shamelessly stolen from a previous teaching of 15-462!

The OpenGL Pipeline * Featuring slides shamelessly stolen from a previous teaching of 15-462!

The OpenGL Pipeline * Featuring slides shamelessly stolen from a previous teaching of 15-462!

OpenGL Lighting By default, OpenGL's fixed-function pipeline implements the Blinn-Phong Shading Model. Originally from Bui Tuong Phong's Ph.D. work at the University of Utah (1973). Modified by James F. Blinn (1977). Light is modeled in three categories: ambient, diffuse, and specular.

Ambient Lighting Image: Brad Smith Approximates the low level of light that is normally present everywhere in a scene (scattered by many objects before reaching the eye). Constant term; applies equally to all points on the object.

Diffuse Lighting Image: Brad Smith Approximates light scattered by objects with rough surfaces. Its intensity depends on the angle between the light source and the surface normal (not the direction to the viewer).

Specular Lighting Image: Brad Smith Approximates light reflected by shiny objects with smooth surfaces. Its intensity depends on the angle between the viewer and the direction of a ray reflected from the light source.

The Equation Ka, Kd, Ks = Ambient, Diffuse, and Specular Color (Set for Materials, i.e. Objects) Ia, Id, Is = Ambient, Diffuse, and Specular Intensity (Set for Lights) Dot Products: Provide the dependence on the light-surface and reflection-viewer angles discussed earlier.

The Blinn-Phong Model In OpenGL Phong: The calculation is done over the entire surface. Blinn-Phong: The calculation is done only at vertices; the remainder of the surface is interpolated from surrounding vertices. Image: Brad Smith

Emissive Lighting OpenGL adds emissive lighting, which allows an object to glow with its own light. Is this everything we need to model all possible lighting phenomena?

The Blinn-Phong Model In OpenGL OpenGL evaluates the equation for you. You just need to set the material parameters and light intensities (and provide surface normals!). Chapter 5 of the OpenGL Programming Guide describes the commands you will need and gives examples of their use.

Some OpenGL Commands Setting light intensities: gllightfv(gl_light0, GL_DIFFUSE, Id); gllightfv(gl_light0, GL_SPECULAR, Is); Setting material colors: glmaterialfv(gl_front_and_back, GL_AMBIENT, Ka); glmaterialfv(gl_front_and_back, GL_DIFFUSE, Kd); glmaterialfv(gl_front_and_back, GL_SPECULAR, Ks); Setting surface normals: glvertex3dv(&vertices[0].x); glnormal3dv(&normals[1].x);

Limitations of OpenGL Lighting The pipeline is essentially one-way (left to right on the illustration). Once a polygon has been rendered, it's forgotten and can't be used as part of any other lighting calculations. No mirrors, glow sticks made with emissive light won't actually light up anything else in the scene, etc. Can only capture light source object viewer (called direct illumination ).

Direct vs. Global Illumination "Fast Separation of Direct and Global Components of a Scene using High Frequency Illumination" by Nayar et. al. (SIGGRAPH 2006). OpenGL could render the image at center, but it would miss all of the information in the image at right.

Solutions? Use a completely different algorithm such as raytracing or photon mapping which supports global illumination. Projects 3 & 4. Program the pipeline to behave differently using GLSL. Project 2. Be happy with Blinn-Phong. Project 1 (and lecture next Tuesday!)