University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Picking and Lighting Week 4, Fri 26 Sep 2003 recap: viewports and picking.

Slides:



Advertisements
Similar presentations
Better Interactive Programs
Advertisements

Graphics Pipeline.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Computer graphics & visualization Global Illumination Effects.
The Radiance Equation Mel Slater. Outline Introduction Light Simplifying Assumptions Radiance Reflectance The Radiance Equation Traditional Rendering.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Picking Week 10, Mon Mar.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Lighting/Shading I Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading II Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Alla Sheffer Advanced Rendering Week.
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Better Interactive Programs Ed Angel Professor of Computer Science, Electrical and Computer.
Projections and Picking Wed 24 Sep 2003
7M836 Animation & Rendering
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Lighting Week 5, Mon 29 Sep 2003 recap: picking, light sources lighting.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Picking II, Collision.
Informationsteknologi Tuesday, November 6, 2007Computer Graphics - Class 41 Today’s class Input and interaction.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
CSC418 Computer Graphics n Raytracing n Shadows n Global Illumination.
CS 445 / 645: Introductory Computer Graphics
Picking. What is picking? Selecting an object on the screen What does this require? –Get Mouse Location –Compute what objects are rendered at the position.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
19/4/ :32 Graphics II Syllabus Selection and Picking Session 1.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSC461 Lecture 11: Interactive Programs Contents and Objectives Picking Writing modes – XOR/Copy Rubberbanding Display list.
-Global Illumination Techniques
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
Korea University Korea University Computer Graphics Laboratory Computer Graphics Laboratory Jung Lee, Chapter 13.
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
Computing & Information Sciences Kansas State University Lecture 20 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 21 of 42 William H. Hsu.
CS559: Computer Graphics Lecture 15: Hierarchical Modeling and Shading Li Zhang Spring 2008.
Week 10 - Wednesday.  What did we talk about last time?  Shadow volumes and shadow mapping  Ambient occlusion.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
1 Better Interactive Programs. 2 Objectives Learn to build more sophisticated interactive programs using ­Picking Select objects from the display Three.
OpenGL Selection. Three Selection Methods Color coding (OpenGL) Selection mode (OpenGL) Selection ray (generic)
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Procedural Approaches.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading I Week.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Viewing/Projection V,
Chapter 1 Graphics Systems and Models Models and Architectures.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Computer Graphics: Illumination
Photorealistic Rendering vs. Interactive 3D Graphics
Better Interactive Programs
3D Graphics Rendering PPT By Ricardo Veguilla.
Models and Architectures
Models and Architectures
Models and Architectures
Better Interactive Programs
Models and Architectures
Models and Architectures
CSC418 Computer Graphics Raytracing Shadows Global Illumination.
Presentation transcript:

University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Picking and Lighting Week 4, Fri 26 Sep 2003 recap: viewports and picking picking 2 lighting

Week 4, Fri 26 Sep 03 © Tamara Munzner2 News signup for project 1 demo slots extra TA hours in labs –Fri (today) 12-1:30 –Monday 10-2 –Tuesday 11-1 –Wednesday 10-1 –Thursday 11-1 normal lab hours –Fri –Wed 1-3

University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 3 Viewports and picking recap

Week 4, Fri 26 Sep 03 © Tamara Munzner4 Viewport recap coord sys: onscreen pixels –determined by display/window system –origin often upper left x y display viewport x y

Week 4, Fri 26 Sep 03 © Tamara Munzner5 3 Picking Approaches recap manual ray intersection bounding extents backbuffer coloring x VCS y

University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 6 Picking 2

Week 4, Fri 26 Sep 03 © Tamara Munzner7 Select/Hit assign per-object integer keys (names) use small region around cursor for viewport redraw in special mode store hit list of objects in region examine hit list OpenGL support

Week 4, Fri 26 Sep 03 © Tamara Munzner8 Viewport small rectangle around cursor –change coord sys so fills viewport why rectangle instead of point? –people aren’t great at positioning mouse Fitts’s Law: time to acquire a target is function of the distance to and size of the target –allow several pixels of slop

Week 4, Fri 26 Sep 03 © Tamara Munzner9 tricky to compute –invert viewport matrix, set up new orthogonal projection simple utility command –gluPickMatrix(x,y,w,h,viewport) x,y: cursor point w,h: sensitivity/slop (in pixels) –push old setup first, so can pop it later Viewport

Week 4, Fri 26 Sep 03 © Tamara Munzner10 Render Modes glRenderMode(mode) –GL_RENDER: normal color buffer default –GL_SELECT: selection mode for picking –(GL_FEEDBACK: report objects drawn)

Week 4, Fri 26 Sep 03 © Tamara Munzner11 Name Stack “names” are just integers glInitNames() flat list glLoadName(name) or hierarchy supported by stack glPushName(name), glPopName –can have multiple names per object

Week 4, Fri 26 Sep 03 © Tamara Munzner12 for(int i = 0; i < 2; i++) { glPushName(i); for(int j = 0; j < 2; j++) { glPushMatrix(); glPushName(j); glTranslatef(i*10.0,0,j * 10.0); glPushName(HEAD); glCallList(snowManHeadDL); glLoadName(BODY); glCallList(snowManBodyDL); glPopName(); glPopName(); glPopMatrix(); } glPopName(); } Hierarchical Names Example

Week 4, Fri 26 Sep 03 © Tamara Munzner13 Hit List glSelectBuffer(buffersize, *buffer) –where to store hit list data on hit, copy entire contents of name stack to output buffer. hit record –number of names on stack –minimum and minimum depth of object vertices depth lies in the z-buffer range [0,1] multiplied by 2^32 -1 then rounded to nearest int

Week 4, Fri 26 Sep 03 © Tamara Munzner14 Separate Pick Function? use same function to draw and pick –simpler to code –name stack commands ignored in render mode customize functions for each –potentially more efficient –can avoid drawing unpickable objects

Week 4, Fri 26 Sep 03 © Tamara Munzner15 Select/Hit advantages –faster OpenGL support means hardware accel only do clipping work, no shading or rasterization –flexible precision size of region controllable –flexible architecture custom code possible, e.g. guaranteed frame rate disadvantages –more complex

University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 16 Lighting: Illumination

Week 4, Fri 26 Sep 03 © Tamara Munzner17 Goal model interaction of light with matter in a way that appears realistic and is fast phenomenological reflection models –ignore real physics, approximate the look –simple, non-physical –Phong, Blinn-Phong physically based reflection models –simulate physics –BRDFs: Bidirectional Reflection Distribution Functions

Week 4, Fri 26 Sep 03 © Tamara Munzner18 Photorealistic Illumination [electricimage.com]

Week 4, Fri 26 Sep 03 © Tamara Munzner19 Photorealistic Illumination [electricimage.com]

Week 4, Fri 26 Sep 03 © Tamara Munzner20 Fast Local Illumination

Week 4, Fri 26 Sep 03 © Tamara Munzner21 Light Sources and Materials appearance depends on –light sources, locations, properties –material (surface) properties –viewer position local illumination –compute at material, from light to viewer global illumination (later in course) –ray tracing: from viewer into scene –radiosity: between surface patches

Week 4, Fri 26 Sep 03 © Tamara Munzner22 Illumination in the Pipeline local illumination –only models light arriving directly from light source –no interreflections and shadows can be added through tricks, multiple rendering passes light sources –simple shapes materials –simple, non-physical reflection models

Week 4, Fri 26 Sep 03 © Tamara Munzner23 Light Sources types of light sources –glLightfv(GL_LIGHT0,GL_POSITION,light[]) –directional/parallel lights real-life example: sun infinitely far source: homogeneous coord w=0 –point lights same intensity in all directions –spot lights limited set of directions: –point+direction+cutoff angle

Week 4, Fri 26 Sep 03 © Tamara Munzner24 Light Sources area lights –light sources with a finite area –more realistic model of many light sources –not available with projective rendering pipeline, (i.e., not available with OpenGL)

Week 4, Fri 26 Sep 03 © Tamara Munzner25 Light Sources ambient lights –no identifiable source or direction –hack for replacing true global illumination (light bouncing off from other objects)

Week 4, Fri 26 Sep 03 © Tamara Munzner26 Light Sources geometry: positions and directions –standard: world coordinate system effect: lights fixed wrt world geometry demo: –alternative: camera coordinate system effect: lights attached to camera (car headlights) –points and directions undergo normal model/view transformation illumination calculations: camera coords

Week 4, Fri 26 Sep 03 © Tamara Munzner27 Illumination as Radiative Transfer radiative heat transfer approximation –substitute light for heat –treat light as packets of energy (photons) ignore wavelength-dependent effects –model transport as flow (light transport) –steady state of flow is “light field” heat/light source thermometer/eye reflective objects energy packets

Week 4, Fri 26 Sep 03 © Tamara Munzner28 Light Transport Assumptions geometrical optics (light is photons not waves) –no diffraction diffraction example: –no polarization (some sunglasses) light of all orientations gets through –no interference (packets don’t interact) interference demo: light waves single slit new wavefront

Week 4, Fri 26 Sep 03 © Tamara Munzner29 Light Transport Assumptions II color approximated by discrete wavelengths –quantized approx of dispersion (rainbows) –quantized approx of fluorescence (cycling vests) no propagation media (surfaces in vacuum) –no atmospheric scattering (fog, clouds) some tricks to simulate explicitly –no refraction (mirages)

Week 4, Fri 26 Sep 03 © Tamara Munzner30 Light Transport Assumptions III light travels in straight line –no gravity lenses superposition (lights can be added) –no nonlinear reflection models nonlinearity handled separately