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

Slides:



Advertisements
Similar presentations
Lecture 8 Transparency, Mirroring
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
3D Graphics Rendering and Terrain Modeling
Advanced Effects CMSC 435/634. General Approach Ray Tracing – Shoot more rays Rasterization – Render more images.
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
Light Issues in Computer Graphics Presented by Saleema Amershi.
Reflections from Bumpy Surfaces GPU Graphics. What are we trying to achieve?  Most surfaces are not flat like glass  Some of these surfaces still give.
Ray Tracing Tutorial. Ray Casting One type of visibility algorithm.
CS 325 Introduction to Computer Graphics 04 / 09 / 2010 Instructor: Michael Eckmann.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
Computer Graphics (Fall 2005) COMS 4160, Lecture 21: Ray Tracing
RAY TRACING.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
Now Playing: Melody Day Caribou from Andorra Released August 21, 2007.
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 14: Ray Tracing
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.
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
Now Playing: Quicksand Under Carpet New Radiant Storm King from Leftover Blues: Released 2004.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
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.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
COMP 175: Computer Graphics March 24, 2015
Computer Graphics Panos Trahanias ΗΥ358 Spring 2009.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS 376 Introduction to Computer Graphics 04 / 11 / 2007 Instructor: Michael Eckmann.
-Global Illumination Techniques
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.
CS 325 Introduction to Computer Graphics 04 / 26 / 2010 Instructor: Michael Eckmann.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
1 Dr. Scott Schaefer Ray Tracing. 2/42 Ray Tracing Provides rendering method with  Refraction/Transparent surfaces  Reflective surfaces  Shadows.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
CS 325 Introduction to Computer Graphics 03 / 24 / 2010 Instructor: Michael Eckmann.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Ray Tracer Spring 2008 Help Session. Outline Project Web Resources What do you have to do for this project? Ray Class Isect Class Requirements Tricks.
04/30/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling We are now all done with modeling, the standard hardware pipeline.
Basic Ray Tracing CMSC 435/634.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
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.
CS380: Computer Graphics Distributed Ray Tracing TA Course URL:
Monte-Carlo Ray Tracing and
CS 376 Introduction to Computer Graphics 04 / 02 / 2007 Instructor: Michael Eckmann.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
CSCE 441: Computer Graphics Ray Tracing
In the name of God Computer Graphics. Last Time Some techniques for modeling Today Global illumination and raytracing.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
RENDERING : Global Illumination
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.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
Ray Tracing I. Reading Hill, Chapter 14, Sections 14.1 to 14.5 Hill, Chapter 14, Sections and
CS 376 Introduction to Computer Graphics 04 / 13 / 2007 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 04 / 18 / 2007 Instructor: Michael Eckmann.
Basic Ray Tracing CMSC 435/634.
Photorealistic Rendering vs. Interactive 3D Graphics
3D Graphics Rendering PPT By Ricardo Veguilla.
RAY TRACING.
© University of Wisconsin, CS559 Fall 2004
Reflections from Bumpy Surfaces
Lecture 11: Recursive Ray Tracer
Introduction to Ray Tracing
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 Objects in Our World OK – next idea: The ray tracer needs to have something for the light rays to hit! So we need to place some objects in our world. We don't want to get TOO mathematical so let's stick with just three sorts of objects: * Spheres * Planar objects * Point light sources

CIS 310: Visual Programming, Spring 2006 Western State College Equation of a Sphere What's a sphere in 3-D? Simple: (x-xc) 2 + (y-yc) 2 + (z-zc) 2 = r 2 That is, a sphere is a center (P3) and a radius.

CIS 310: Visual Programming, Spring 2006 Western State College A Planar Object We'll define a planar object in a nice, simple way. We'll map the 3-D point onto a 2-D plane. Or look at this from the other direction: we're going to move a 2-D object into a 3-D world. How do we do this? * Translate the origin to some new point (a P3) * Point the plane in some direction (a normalized P3) * Scale the plane by some constant factor * Spin the object (an angle)

CIS 310: Visual Programming, Spring 2006 Western State College Working With Objects So what do we need to do with these objects? There's really only one thing that we have to do: find out where a ray intersects the object (a point). We also would like to know the angle of the object at that point so we can shade the color, bounce the ray, or whatever we want. We'll address the math later …

CIS 310: Visual Programming, Spring 2006 Western State College The Ray Tracer for each pixel in viewing plane: compute a ray based on the eye position launch the ray into the scene to get back a color save the color in a bitmap That sounds easy! What's the hard part?

CIS 310: Visual Programming, Spring 2006 Western State College Following Rays The nasty bit is following each ray to see what it hits. That's where we have to do intersections between rays and objects. Ignoring the efficiency of visiting every object for every ray, we have the following: trace(ray) = best = infinity for each object o in world best = min(o.intersect(ray), best) Here, intersect returns the distance along the ray. I didn't bother to keep track of which object is being intersected but that's easy.

CIS 310: Visual Programming, Spring 2006 Western State College Hitting an object Now we know which object (and where on that object) the ray hits. What's next? There are three basic ways an object acquires a color at a point: a) A light source reveals the coloring (texture) of the object at that point b) The object reflects rays from other places in the scene c) The object refracts a ray (the ray passes through the object in some way) In theory, all of these can happen at once. This requires a color blend

CIS 310: Visual Programming, Spring 2006 Western State College Recursion Ray tracing is a classic example of control recursion. When a ray hits an object you respond by sending new rays (maybe lots of them) off in new directions. Note that rays lose intensity as they go. One optimization is to delete rays when they lose too much intensity (this is hard in that you don't know the intensity until after you get to a light source! But you can keep track of a multiplier and the brightest source)

CIS 310: Visual Programming, Spring 2006 Western State College Hitting a non-reflective source Let's start with the simplest case: a ray hits an opaque object – the ray doesn't bounce or refract so all you see is the underlying color of the object. But how much illumination do you give the color of the object? That's the tricky part! The way you compute illumination is to cast rays to each light source from the object's surface.

CIS 310: Visual Programming, Spring 2006 Western State College Shading If a light source illuminates a point, how much light is reflected by the surface? This depends on the normal vector of the surface and direction of the light source. I'll skip the math right now and simply point out that you need to shoot rays to every light source. When the ray is obstructed, ignore the source. When the ray is unobstructed, allow it to contribute to the color.

CIS 310: Visual Programming, Spring 2006 Western State College Texture Mapping Any function that converts a 3-D coordinate on an object into a 2-D coordinate can be used as a texture map. The texture map "wraps" a surface in a 2-D image.

CIS 310: Visual Programming, Spring 2006 Western State College The Next Step We need to write a good math library. * Intersect a ray and a sphere * Intersect a ray and a plane * Mappings for a sphere and a plane * Shading functions * Reflection / refraction ray transformations

CIS 310: Visual Programming, Spring 2006 Western State College Things You Need to Do * Set up the raster to ray part of the system * Object representations (we can do an object design now …) * Search for the closest object along a ray * Various ray scattering algorithms * Color operations (how do you do these?) * Make a cool picture for me