Intro. to Advanced Lighting, Basic Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, April.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
3D Graphics Rendering and Terrain Modeling
Advanced Effects CMSC 435/634. General Approach Ray Tracing – Shoot more rays Rasterization – Render more images.
AIR NAVIGATION Part 3 The 1 in 60 rule.
AIR NAVIGATION Part 3 The 1 in 60 rule.
Subsurface scattering Model of light transport in translucent materials Marble, jade, milk, skin Light penetrates material and exits at different point.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Camera-Aware Photon Mapping Final Project of CS6620 Byong Wu “Bernard” Chong Apr. 28, 2008.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
CS 325 Introduction to Computer Graphics 04 / 09 / 2010 Instructor: Michael Eckmann.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Alla Sheffer Advanced Rendering Week.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
RAY TRACING.
Advanced lighting and rendering Multipass rendering.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
Real-Time Ray Tracing 3D Modeling of the Future Marissa Hollingsworth Spring 2009.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
BSP Trees, Quadtrees & Octrees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January 28, 2004.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
An Introduction to Ray Tracing CS /27/1998 Vic Baker.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Polygon Lists & 3-D File Formats Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 18, 2002.
12/05/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling Very brief intro to global illumination.
Reflections Specular reflection is the perfect reflection of light from a surface. The law a reflection states that the direction of the incoming ray and.
CS 481 Preview, Some Lighting Details Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 19, 2003.
Project Raytracing. Content Goals Idea of Raytracing Ray Casting – Therory – Practice Raytracing – Theory – Light model – Practice Output images Conclusion.
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
Data Structures for Scenes, The Basics of Scene Graphs Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday,
Raytracing and Global Illumination Intro. to Computer Graphics, CS180, Fall 2008 UC Santa Barbara.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
1 Dr. Scott Schaefer Ray Tracing. 2/42 Ray Tracing Provides rendering method with  Refraction/Transparent surfaces  Reflective surfaces  Shadows.
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
Gene Au-yeung, Daniel Quach, Jeffrey Su, Albert Wang, Jessica Wang, David Woo.
More on Drawable Objects, Hierarchical Objects Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January.
1 Ray-Tracing ©Anthony Steed Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!
Advanced HSR Methods Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday, January 30, 2004.

More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
OpenGL Selection. Three Selection Methods Color coding (OpenGL) Selection mode (OpenGL) Selection ray (generic)
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
Build-A-Button Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, October 8, 2003.
Parallel Ray Tracer Computer Systems Lab Presentation Stuart Maier.
Reflection and Light Flat Mirrors.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
CS380: Computer Graphics Distributed Ray Tracing TA Course URL:
Ray-tracing.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
CS3241 C OMPUTER G RAPHICS Tutorial 8. Q UESTION #1 Given an object represented in polygons, how to find its bounding sphere?
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
OpenGL and You I Cast, Therefore I Am. Ray Casting Idea is simple, implementation takes some work –Cast rays as if you were the camera –Determine intersection.
RAYTRACER PART I OF II.  Loosely based on the way we perceive the world around us (visually)  A (near) infinite number of photons are emitted by a light.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS552: Computer Graphics Lecture 36: Ray Tracing.
Review Ray Tracing III Review. Pseudo codes RayCast-1  Plain ray caster (direct illumination) RayCast-2  RayCast-1 + shadow rays RayTrace-1  Recursive.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.

Photorealistic Rendering vs. Interactive 3D Graphics
More on Widgets, Misc. Topics
Frame Buffer Applications
Presentation transcript:

Intro. to Advanced Lighting, Basic Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, April 12, 2004

12 Apr 2004CS 481/6812 Intro. to Advanced Lighting In our next unit, we look at advanced techniques for lighting scenes. Most of these do not fit well within the pipeline-based rendering model we have been discussing. Most of these techniques are also too slow for real-time rendering. The first technique we will look at is called “ray tracing”.

12 Apr 2004CS 481/6813 Basic Ray Tracing: Introduction In “normal” rendering: We deal with a series of objects, made of primitives. For each primitive, we determine which pixels it affects, if any. Ray tracing turns this around: We deal with pixels, one by one. For each pixel, we ask what we see (which primitive?) when we look at it.

12 Apr 2004CS 481/6814 Basic Ray Tracing: Tracing A Ray The way we determine what we see when we look at a pixel is to draw an imaginary ray from the viewing position, through the pixel, into the scene. We ask which objects in the scene the ray hits. The first hit is the one that counts. First hit Current pixel Image Scene objects

12 Apr 2004CS 481/6815 Basic Ray Tracing: Tracing A Ray What do we do when we have a hit? We determine what color the object is at that point. Light sources and the object’s normal may affect the computation. We can also do true specular reflection: Reflect the ray and do the ray tracing computation again. We can also do true refraction, for translucent objects. Normal Original ray Reflected ray

12 Apr 2004CS 481/6816 Basic Ray Tracing: Two Questions When we do ray tracing, there are two basic questions that need to be answered repeatedly: Given a ray, does it hit an object in the scene, and, if so, which one does it hit first? If a ray hits an object, what color do we see when we look along the ray? Designing code to answer these is an excellent application of object-oriented design principles.

12 Apr 2004CS 481/6817 Basic Ray Tracing: What is a Ray? A ray is half of a line. It has a starting point and a direction. To store a ray, we need: A starting point: pos. A direction vector (unit vector): vec. It is reasonable to implement a ray as a class. For convenience, rays can know how to reflect and refract themselves.

12 Apr 2004CS 481/6818 Basic Ray Tracing: Ray-Object Intersection The first question that needs to be answered is whether a ray hits any object in the scene. To answer this, test the ray against each object in turn. This test is called ray-object intersection. What class knows how to do this? Answer: The object’s class. Since every object class needs to be able to do ray-object intersection: Write an abstract base class for objects. Each object is derived from the base class. Ray-object intersection is a virtual function.

12 Apr 2004CS 481/6819 Basic Ray Tracing: What Do Objects Do? More generally, what do objects need to be able to do? Answer: They need to be able to answer the two questions, for themselves. So, an object has two member functions: First, given a ray, test whether the ray hits the object, and, if so, how far from the start of the ray the hit lies. How far, so we can tell which hit comes first. Second, given a ray that hits the object, tell what color is seen along the ray. And that is all! Except for administrative stuff: constructors, etc. Right??

12 Apr 2004CS 481/68110 Basic Ray Tracing: Hits In practice, to determine the color (question 2), an object needs to know where the ray hit and what the normal is. These are almost always calculated during the ray-object intersection test (question 1). Therefore, it is convenient to have a “hit” class. This holds: Whether the ray hit the object: bool. If so: How far along the ray: double. Where the hit is: pos. The object’s normal vector at this point: vec. Again, this is not required, but will nearly always speed things up by avoiding repeating a computation.

12 Apr 2004CS 481/68111 Basic Ray Tracing: Class Summary So, in a simple ray tracer, we have: A ray class. An object base class. Various objects are derived from it. Virtual functions for ray-object intersection and color computation. A hit class. This design is easily extended. Adding new objects works without changing other code. We can add features like multiple rays per pixel, etc.