Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mike Merchant Nicholas Hilbert

Similar presentations


Presentation on theme: "Mike Merchant Nicholas Hilbert"— Presentation transcript:

1 Mike Merchant Nicholas Hilbert
Ray Tracing Mike Merchant Nicholas Hilbert

2 What is Ray Tracing? Essentially, tracing a ray that connects a light source to an object to a screen which is made of pixels. The rays will then go through each pixel into a “camera”… basically, this creates perspective for the viewer as well as seeing the correct color. The ray can be either reflected or absorbed into the object (one of this methods beauties)

3 Color Image plane (pixels) are determined by the color of the light ray that passes through that pixel. (Ultimately… determining the color of each pixel is the point of ray tracing) Each ray’s color is determined by the light around it, the color of the objects around it, and the material aspect of the object itself (including it’s natural color) There are a few other things going on here that we will talk about a little later and then we will come back to this picture to describe everything

4 Types of Ray Tracing - Forwards
Simulates real life (aka Photon Tracing) Accurately determines color of each object Highly inefficient Light Source emits photons which travel in a straight line (do not consider quantum mechanics… that will make this process even more difficult to manage) When these photons hit an object, they bounce in a different direction and only a handful of them actually strike the viewing plane (you can barely see a blue and green spec on the black screen) Teapot… almost

5 Types of Ray Tracing - Backwards
Emits 1 ray from the viewer to each pixel on the screen and tracks its path No unnecessary rays for simple ray tracer (1080p screen = 2,073,600 rays… not too bad) Still time consuming This method does not take as many calculations as the first method… but it’s still bad For every ray shot from the “camera” to the scene, if that ray intersects anything it will bounce and hit another object which will help determine the color of that object There are a few extra properties that ray tracing allows for which help make it one of the most powerful rendering mechanics

6 Complexity is O(heightscreen * widthscreen * numobjects)
Simple Ray Tracer PseudoCode

7 REFLECTION + REFRACTION
Now we need to consider how to show reflections on objects – Bounce another ray of the object opposite of the incoming ray. Or Refraction – bouncing rays through an object and coming out the other end Square root is expensive

8 Recursively Reflecting/Refracting Rays
Create a tree of rays: root note is the original ray, each node is a reflected/refracted ray, and all leaves are non-reflected/non-refracted rays… go until a depth limit is reached or there are no more nodes Rays can bounce off/through objects which can cause many extra rays to appear that don’t actually go straight to the light source These rays can make a tree of rays that can be recursively traced to determine that pixels color Depth limit is to simulate attenuation of light throughout the scene (Otherwise)

9 ((Same complexity as before)number of reflected/refracted rays)
For every reflected or refracted ray, the Trace function is recalled

10 Current Overview Primary Ray: Ray from the viewer’s eye, camera, etc.
Reflection Ray: Ray that bounces off object (ie. Sphere, find Normal at the point of intersection and then find angle between) Refraction Ray: Ray that travels through the (based on Normal and refractive index of object) Shadow Ray: Ray that travels to the light source (if possible)

11 Problems Time Consuming: Aliasing
Impossible for real-time graphics Takes time to calculate closest object through ray (usually involves the dreaded square root function) Aliasing Image has perfect reflection (unnatural) Complexity needed Make one ray from center of ray to many different rays and then average the colors using a filter (not part of our presentation) Images unnaturally crisp. (see next slide)

12 Anti-Aliasing Ray tracing gives a color for all points on image… but a square pixel contains an infinite number of points which might not all be the same color Shoot more rays at each pixel (random or not) then filter the result and color the pixel accordingly

13 Distributed Ray Tracing – Monte Carlo Ray Tracing
Light can bounce off in many directions at one point Can add real world effects, such as: Gloss Soft Shadows Focus More rays per everything Gloss: more rays bounce off an object and then the calculate the color of each ray Soft Shadows: send more shadow rays off an object and grab the average Focus: jitter eye position and shoot more primary rays

14 Finished Overview Complicated Ray Tracer is able to simulate an image in real life… but must require lots of calculations Add more rays that intersect at a point (for distributed ray tracing)

15 Accelerated Ray Tracing
Adaptive depth control Decrease the depth of possible recursion for reflected/refracted rays Only keep rays needed for basic image Remove features mentioned in the last few slides Bounding Volumes “Embarrassingly parallel” We already mentioned this earlier, but just reduce the depth you can traverse in the recursive tree Bounding volumes will be mentioned on the next slide followed by first-hit speedup

16 Bounding Volumes Bind objects together into bigger objects
If ray doesn’t hit bounded object, it won’t hit objects inside either Also used for single objects

17 Embarrassingly parallel
Wikipedia: “… an embarrassingly parallel workload, is one for which little or no effort is required to separate the problem into a number of parallel tasks” Only need scene and a ray to calculate pixel’s color No information from other rays are needed

18 Finale Questions?


Download ppt "Mike Merchant Nicholas Hilbert"

Similar presentations


Ads by Google