1 / 39

Computer Graphics SS 2014 Ray-Tracing

Computer Graphics SS 2014 Ray-Tracing. Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung. Basics. Ray is a straight path along which light photons travel Multiple photons can travel along the same ray at the same time

garnet
Download Presentation

Computer Graphics SS 2014 Ray-Tracing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Graphics SS 2014 Ray-Tracing Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung

  2. Basics • Ray is a straight path along which light photons travel • Multiple photons can travel along the same ray at the same time • Photons originate at some light source and bounce around the geometry in the scene until they hit the eye • If photons collide with objects they might get absorbed or they change their direction due to the laws of reflection

  3. Basics

  4. Basics • Tracing photons forwards from each light source would lead to an excellent picture of the scene • But most photons will never hit the eye • Therefore, we trace photons backwards from the eye into the scene • Requires a sampling structure, i.e. a virtual pixel plane, to determine the rays to follow

  5. Basics • The classicalraytracingmethod • Recursivecomputationofpathsthroughthescene Interaction withobjects, i.e. absorption, specular reflection, refraction, Point-wiseevaluationof localilluminationmodel andshadows

  6. Basics • The classicalraytracingmethod • The dottedlinesrepresentshadowrays, whichareshottothelightsource • Ifthesurfacepointis in shade, nothinghappens, elsethelocalilluminationfromthelightsourceisevaluated

  7. Basics • The basic ray tracing method

  8. Basics • The basic ray tracing method Two bounces No bounce One bounce

  9. Spheres-over-plane

  10. Spheres-over-plane

  11. Spheres-over-plane

  12. Spheres-over-plane

  13. Spheres-over-plane (mirror 10)

  14. Spheres-over-plane

  15. Spheres-over-plane

  16. Spheres-over-plane

  17. Spheres-over-plane

  18. Spheres-over-plane (glass 10)

  19. Spheres-over-plane (glass/mirror)

  20. Basics • Light transport • Classical (so calledWhitted) raytraceronlysimulates (a) andreflectionoflocalilluminationdue topoint light source

  21. Basics • Recursiveraytraversalresults in a tree-likecomputation order • Primary, secondary, tertiary etc. rays • Oneor multiple shadowraystopointlight source • More work in branches but lesscontributiontothe final imagedue toabsorption I = Idirect+ ksIreflected+ ktIrefracted Idirect= Idiffuse+ Ispecular primaryray L1 R1 T1 L3 L2 T2 R1 R3 T3

  22. distance toview plane upvector height viewing direction point of view width look vector position Basics up vector projection of up vector • The ray tracing camera

  23. Basics • The numberofsamplestotake, i.e. thenumberofraystoshot, isdefinedbytheresolutionoftheviewport (thepixel raster)

  24. Basics • Samplingtheimage plane • A continuousspheresampledatvaryingviewportresolution

  25. point of view Basics • The ray tracing camera mimics an infinite view frustum • The portion of the scene that is visible • Attention: light paths have to consider objects/light sources outside the frustum

  26. Basics • Sampling theimage plane withat least oneray per pixel for (eachpixel) { ray= getRay(viewpoint, pixelcenter) pixelcolor = traverse(ray) } traverse(ray) { compute_first_ray_object_intersection computenormal, reflectionandrefractionray color= evaluate_local_lighting_model(normal) return(color + kstraverse(reflect) + kttraverse(refract)) } Attention: recursiontermination

  27. Basics • Trace a ray through each pixel into the scene • Reflect/refract at specular/transparent surfaces • Continue until • Pure diffuse surface is hit (Whittedraytracer only) or • Energy drops below threshold because of attenuation or • The ray leaves the scene • Local illumination: Idirect= Idiffuse+ Ispecular

  28. Path notation • Classification of global illumination algorithms • What happens along a ray? E: the eyeD: diffuse reflectionS: specular reflectionL: the light source • Correct global illumination must simulate all combinations of interactions:L(D|S)*E

  29. Path notation

  30. Path notation • Classical ray tracing simulates only LS*E and LDS*E paths • See reflected objects / look through transparent objects • Point light sources create sharp shadow boundaries

  31. Path notation • Classical ray tracing approximates the rendering equation • BRDF reduced to • Perfectreflection/refraction • Diffuse (specular) reflection of direct light • Hemisphere integral reduced to sum of three rays

  32. Path tracing (Kajiya 1986) • Observation • Many rays per pixel are spawned recursively, having ever decreasing contribution, in particular, if also diffuse reflection is considered • Work around • Trace each ray through the scene as a single path (i.e. do not create children at intersection points) • Trace many rays per pixel • Trace paths first along which most energy is received

  33. Path tracing • Example

  34. Path tracing • A pathiscreatedbyfollowingonerayateachintersectionpoint • A randomfactordeterminesthe type ofraytobefollowed and itsdirection • The probabilityofselecting a rayof a certain type depends on material properties • Definekd+ks+kt-1 = 0 • Chooserandomnumberx [0,1] • Ifx < kdshoot diffuse rayelseifx < kd+ksshootspecularrayelseshoottransmittedray

  35. Path tracing • Extension bypickingrandomdirectionsvia importance sampling • The integrantissampled in areasthatcontributemosttothe integral • The probabilityofchoosingdirectionsdshouldbe proportional tothecosinebetweendandrforglossyreflectionsdandnfor diffuse reflections

  36. Path tracing • Importance sampling Sampling directionscanbechosenwithhigherprobabilityinto „important“ directions

  37. Path tracing • Example 4 rays per pixel

  38. Path tracing • Example 225 rays per pixel

  39. Path tracing • Example 400 rays per pixel

More Related