DOC PREVIEW
UW-Madison CS 559 - CS 559 Lecture Notes

This preview shows page 1-2-14-15-30-31 out of 31 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Last TimeTodayRaytracing ImplementationConstructing RaysRay-Object IntersectionsRay-Sphere IntersectionRay-Plane IntersectionsPoint-in-Polygon TestingMore complex testsCSG Intersection TestingRay-Patch IntersectionDetailsTransforming Normal VectorsNumerical IssuesMapping TechniquesTexture MappingBump MappingBump Mapping ExamplesDisplacement MappingSlide 20Procedural TexturingSoft ShadowsSlide 23Slide 24Anti-AliasingSlide 26Distribution RaytracingSlide 28Raytracing Can’t Do…Slide 30Missing Paths05/02/02 (c) 2002 University of WisconsinLast Time•An introduction to global illumination–We can’t solve the general case, so we look to special cases•Light paths as a way of classifying rendering algorithms: L(S|D)*E•Raytracing–Captures LDS*E paths: Start at the eye, any number of specular bounces before ending at a diffuse surface and going to the light–Can also do LSE and LE if light source is not a point05/02/02 (c) 2002 University of WisconsinToday•Issues in implementing a ray-tracing algorithm–How to intersect rays with various objects–Texture mapping and other enhancements–Area light sources and soft shadows05/02/02 (c) 2002 University of WisconsinRaytracing Implementation•Raytracing breaks down into two tasks:–Constructing the rays to cast–Intersecting rays with geometry•The former problem is simple vector arithmetic•The intersection problem arises in many areas of computer graphics–Collision detection–Other rendering algorithms•Intersection is essentially root finding (as we will see)–Any root finding technique can be applied05/02/02 (c) 2002 University of WisconsinConstructing Rays•Define rays by an initial point and a direction: x(t)=x0+td•Eye rays: Rays from the eye through a pixel–Construct using the eye location and the pixel’s location on the image plane. x0=eye•Shadow rays: Rays from a point on a surface to the light.–x0=point on surface•Reflection rays: Rays from a point on a surface in the reflection direction–Construct using laws of reflection. x0=surface point•Transmitted rays: Rays from a point on a transparent surface through the surface–Construct using laws of refraction. x0=surface point05/02/02 (c) 2002 University of WisconsinRay-Object Intersections•Aim: Find the parameter value, ti, at which the ray first meets object i•Transform the ray into the object’s local coordinate system–Makes ray-object intersections generic: ray-sphere, ray-plane, …•Write the surface of the object implicitly: f(x)=0–Unit sphere at the origin is x•x-1=0–Plane with normal n passing through origin is: n•x=0•Put the ray equation in for x–Result is an equation of the form f(t)=0 where we want t–Now it’s just root finding05/02/02 (c) 2002 University of WisconsinRay-Sphere Intersection•Quadratic in t–2 solutions: Ray passes through sphere - take minimum value that is > 0–1 solution: Ray is tangent - use it if >0–0 solutions: Ray does not hit sphere        012:01 :Substitute01 :Sphere)( :Ray0002000-----xxdxdddxdxxxdxxtttttt05/02/02 (c) 2002 University of WisconsinRay-Plane Intersections•To do polygons, intersect with plane then do point-in-polygon test…  dnxnxndndxnxndxx------0000:0:0 :Substitute0 :Plane)( :Rayttttt05/02/02 (c) 2002 University of WisconsinPoint-in-Polygon Testing•Project point and polygon onto a 2D plane–Find biggest component of normal vector, and just use other two coordinates–For example, if n=(0.2, 0.4, 0.9), just use x,y coordinates, which is like projecting down onto the x-y plane•Cast a ray from the point to infinity and count the number of edges it crosses–Odd number means point is inside–Edge crossing tests are very fast - think clipping05/02/02 (c) 2002 University of WisconsinMore complex tests•Ray-Polygon test reveals a common strategy–Intersect with something easy - a superset of the actual shape–Do a bounds check to make sure you have actually hit the shape•Also works for cylinders, disks, cones•CSG is well suited to raytracing–Find intersection along ray of all the CSG primitives–Break the ray into intervals according to which primitives it is in–Do set operations to find the first interval that is actually inside the CSG object05/02/02 (c) 2002 University of WisconsinCSG Intersection TestingSubtractIntersection intervalsSubtract intervals05/02/02 (c) 2002 University of WisconsinRay-Patch Intersection•Equation in 3 parameters, two for surface and two for ray•Solve using Newton’s method for root finding–Have derivatives from basis functions–Starting point from control polygon, or random guess, or try a whole set of different starting values0)()( :Substitute0)()(),( :Patch)( :Ray30i30030i300  jjiijjjiijvBuBtvBuBvuttPdxPxdxx05/02/02 (c) 2002 University of WisconsinDetails•Must find first intersection of ray from the eye–Find all candidate intersections, sort them and take soonest–Techniques for avoiding testing all objects•Bounding boxes that are cheap to test•Octrees for organizing objects in space–Take care to eliminate intersections behind the eye–Same rules apply for reflection and transmission rays•Shadow ray just has to find any intersection shadowing the light source–Speedup: Keep a cache of shadowing objects - test those first05/02/02 (c) 2002 University of WisconsinTransforming Normal Vectors•Normal vectors are not transformed the same way points are–Ray directions behave like normal vectors•Plane equation should still be true with transformed points!•Transform normal vectors with the inverse transpose of the transformation matrix–For rotations, matrix is its own inverse transpose0 : EqnPlane xnT  1TTTTTMKIKMIMK0MxKn0MxKnT05/02/02 (c) 2002 University of WisconsinNumerical Issues•Shadow, reflection and transmission rays have to be sure they don’t intersect the surface they are leaving–Can’t just ignore the object the ray is leaving - some objects self-shadow–Solution: Use a tolerance - offset the starting point off the surface a little in the normal direction•Finding all the intersections with a spline surface patch is difficult•CSG can have problems when doing set operations–Make sure pieces being subtracted protrude above surfacesBad Good05/02/02 (c) 2002 University of WisconsinMapping


View Full Document

UW-Madison CS 559 - CS 559 Lecture Notes

Documents in this Course
Filters

Filters

14 pages

Lecture 2

Lecture 2

24 pages

Clipping

Clipping

22 pages

Modeling

Modeling

33 pages

Filters

Filters

26 pages

Dithering

Dithering

33 pages

Lecture 4

Lecture 4

20 pages

Load more
Download CS 559 Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CS 559 Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS 559 Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?