CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.

Slides:



Advertisements
Similar presentations
Digital Depth of Field Presented by N. David King.
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
With Lenses Created by Derek J. Wells. Under the expressed written consent of Derek J. Wells in accordance with the rules and by-laws of Derek J. Wells.
Law of Reflection (Smooth Surface):
Refraction How to Find Images Using Ray Diagrams  Bending of light due to a change in speed (changes mediums)  Objects behind or in more optically dense.
Pinhole Cameras Converging & Diverging Lenses. Pinhole Image.
Physics 1C Lecture 26C. Recap from last lecture Optical characteristics of lens are defined by focal length f: For a given f, imaging properties are given.
and Optical Instruments
Image Formation 2 Thin Lens Multi lens/mirror system
Images on a Plane Mirror
Mirrors Physics 202 Professor Lee Carkner Lecture 22.
Ray Diagrams Notes.
Level Set Methods Nilanjan Ray Department of Computing Science University of Alberta.
Ray Tracing Outline For each pixel { Shoot ray r from eye to center of pixel with trace( r ) } function trace( r ) For each object { Find object with closest.
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
Image Characteristics
Aperture and Depth of Field. APERTURE (F/STOP) 1.What is it? 2.Where is it? 3.What does it do? 4.When do you use it? 5.Why would you use F/2.8? 6.Why.
Aperture and Depth of Field. Review What are the three controls on the camera that control proper exposure?
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
OVER EXPOSED UNDER EXPOSED? OVER AND UNDEREXPOSED: DEFINED The exposure related decision made can affect your image in a number of different ways. For.
By Joe Jodoin The Human Eye. Parts of the eye There are lots of parts of the eye so EYE will only talk about the main parts. Those parts are the cornea,
Refraction and Lens. Refraction Refraction: the change in direction of a wave as it crosses the boundary b/w 2 media in which a wave travels different.
An Introduction to Ray Tracing CS /27/1998 Vic Baker.
CS 325 Introduction to Computer Graphics 03 / 03 / 2010 Instructor: Michael Eckmann.
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.
Chapter 19 – Optics Jennie L. Borders.
Ray Optics: Reflection and Refraction Rays Representation of the path that light follows Represent beams of light that are composed of millions.
LIGHT AND ITS USES. LIGHT RAY STRAIGHT LINE PATH OF LIGHT.
1 CS6825: Image Formation How are images created. How are images created.
L 32 Light and Optics [2] Measurements of the speed of light  The bending of light – refraction  Total internal reflection  Dispersion Rainbows Atmospheric.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
10.3 Ray Model of light.  Remember in our first talk, we discussed how images that are formed by light are created by BILLIONS of light rays coming from.
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
Images in Plane Mirrors
Last Word on Chapter 22 Geometric Optics Images in a Plane Mirror.
Mirrors and Lenses Chapter 14.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
RAY MODEL OF LIGHT. RAY MODEL Light tends to travel in straight lines. Light’s straight lines are represented by rays Each ray ends with an arrow to indicate.
Lenses and Perspective. Reading a Lens Maximum F or T # Focal Length: power to bend light from subject Distance scale Focus Index DOF Scale Hyperfocal.
LIGHT UNIT – SPA5 STUDY QUESTIONS Directions: Go through this slide show in presentation mode. Read each question carefully, decide on the best answer,
Lesson 25 Lenses Eleanor Roosevelt High School Chin-Sung Lin.
Line Ray Beam the paths along which light energy travels a bundle of light rays.
Properties of Light and Reflection
Translations, Rotations, Reflections, and Dilations.
Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010.
R EFLECTION Plane (flat) mirrors. L IGHT T RAVELS IN S TRAIGHT L INES.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Reflection and Refraction of Light
How Does the Telescope Work?. First, remember these things … Beams of light normally travel in straight lines, – But they bend when moving from one material.
Dispersion The spreading of light into its color components is called dispersion. When light enters a prism, the refracted ray is bent towards the normal,
The amount of reflection depends on how different the media are.
L 32 Light and Optics [2] Measurements of the speed of light 
Mirrors and Lenses. Mirrors and Images Key Question: How does a lens or mirror form an image?
Chapter 19. Reflection The smooth surface of the lake reflects light rays so that the observer sees an inverted image of the landscape.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
4.4 Images in a Plane Mirror. Images in Plane Mirrors When you place an object in front of a mirror the light rays reflect off the object and some will.
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.
Mirrors. Types of mirror There are two types of mirror Plane (flat) Curved Concave (curves in) Convex (curves out)
 Light travels in a straight line  Objects emitting light do so in all directions  A light “ray” is a line and arrow representing the directions and.
CS 376 Introduction to Computer Graphics 04 / 13 / 2007 Instructor: Michael Eckmann.
PHY 102: Lecture Wave Fronts and Rays 9.2 Reflection of Light
M Manser WAVES : Optics (t riple science) By the end of this presentation you should be able to: Identify the differences between converging and diverging.
Light & Optics Chapters Electromagnetic Wave.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Mike Merchant Nicholas Hilbert
Lesson 14 Key Concepts and Notes
Presentation transcript:

CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing

CIS 310: Visual Programming, Spring 2006 Western State College Ray Tracing Ray Tracing is a way of producing occasionally stunning 3-D pictures. It's also a nice way to explore O-O programming (not again!). It's unfortunately full of math. I'll help as I can and we'll try to keep the math from overwhelming us. Let's peek at the wikipedia:

CIS 310: Visual Programming, Spring 2006 Western State College Light Rays A ray tracer makes light move "backwards" – that is, go from effect to cause in the lighting world. Instead of light entering your eye, we instead shoot out a "reversed" light beam to see how light can enter the eye at that angle.

CIS 310: Visual Programming, Spring 2006 Western State College Help from the Internet Since we don't have a text, we'll use a bunch of websites to help us figure out ray tracing. Note that there's a LOT of code out there. I don't recommend that you try to graft this code into your project – that's probably harder than writing it from scratch anyway. I'll make a lot of links in the wiki to help us through this project.

CIS 310: Visual Programming, Spring 2006 Western State College A P3 Class Like last project, we need a class to represent basic math objects. We'll need all of the 2-D operations, but this time in 3-D. I'll leave the 3-D generalizations to you – ask if you have questions. We're going to conflate points and vectors – this can be confusing but that's life.

CIS 310: Visual Programming, Spring 2006 Western State College Efficiency Our goal will NOT be efficiency! As usual, it's better to make the code simple initially and then improve it slowly than to try and write optimized code from the start. Unlike some ray tracers, we'll use completely functional (non mutating) P3 objects. This is slower but prevents some seriously confusing hassles.

CIS 310: Visual Programming, Spring 2006 Western State College Light Rays A light ray is a pair containing a originating point (P3) and direction - normalized P3, a P3 on the unit sphere (magnitude 1) This is obviously a good candidate for a class. The key to this whole representation is to think of a light ray as a trajectory; light moves at a speed of "1" in our world. This is nice – it means that distance = travel time.

CIS 310: Visual Programming, Spring 2006 Western State College Rays as Trajectories Ray = (origin, direction) P(t) = origin + t * direction How does the "t*" work? How does the "+" work?

CIS 310: Visual Programming, Spring 2006 Western State College The Viewing Plane How to we turn a 3-D scene into a 2-D image? We mimic the eye and consider a single point (like the iris of your eye) to focus our light rays through. In a real eye, the viewing plane is behind the focus point – that actually inverts the image at the back of your eye! Here we'll place the "viewing plane" in front of the focus point. So what we want to do is compute a light ray for each pixel in the viewing plane.

CIS 310: Visual Programming, Spring 2006 Western State College Where Is the Viewing Plane? Let's keep things as computationally simple as possible! The viewing plane will be at x = 0 and the place we'll view from is at (-d,0,0). If we change the view point this will be the like choosing a different lens on a camera. We'll stay at (d,0,0) just to keep things simple. That is, we'll be distance d from the viewing plane and all of our object should be somewhere that the x coordinate is positive. We'll cram our eye into a 2x2 square, with y and z going from -1 to 1. This keeps things nicely centered!

CIS 310: Visual Programming, Spring 2006 Western State College Pixels to Viewing Plane Coordinates If we have a view port that’s "h" high and "w" wide, where should the pixel at (x,y) be on the viewing plane? Note: keep the image square! Let's work this out in class.