GRPHICS08 - Raytracing and Radiosity

755 views
536 views

Published on

This is a course on the theoretical underpinnings of 3D Graphics in computing, suitable for students with a suitable grounding in technical computing.

Published in: Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
755
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
23
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

GRPHICS08 - Raytracing and Radiosity

  1. 1. RAY-TRACING AND RADIOSITY Michael Heron
  2. 2. INTRODUCTION  Thus far our discussion of 3D graphics has concentrated mainly of real-time rendering.  In today’s lecture, we will discuss the two main techniques for non real-time rendering.  Raytracing  Radiosity
  3. 3. REFLECTION MODELS  Local reflection model  Imagine lights and objects are floating in dark space  Considers only direct illumination  Global reflection model  Indirect light considered  Light is reflected multiple times  Much more computationally expensive.  Outside the reach of most real-time applications.  For now…
  4. 4. LOCAL VERSUS GLOBAL Direct illumination only Local model Light source Global model Direct and indirect illumination
  5. 5. GLOBAL ILLUMINATION  In theory, for this we:  Trace rays from each light source to each point visible from that light source  Trace reflections and refractions from this point to other surfaces  Continue until:  We reach the viewport, or  We exit the scene entirely  Approximations still used  Can’t trace all rays of light from a light source.
  6. 6. RAY-TRACING  Ray tracing is the process of tracing the path of light through pixels in an image. Capable of producing high degrees of realism.  Still not quite photorealistic, but not far off. High computational cost  Best used for scenes and animations that can be pre- rendered.  Incorporates many aspects of physics Light reflection Light refraction Light scattering
  7. 7. RAY-TRACING  Rays send away from the camera rather than to it Most rays of light emitted from a source would not hit the viewing plane.  Comparable method called photon mapping exists.  Many orders of magnitude more expensive to calculate.  Provides advantages: Reflections and shadows realistically produced  And disadvantages: Expensive to calculate each scene Still an approximation
  8. 8. RAY-TRACING Rays sent backwards from the camera. Much less computationally expensive than the alternative. http://www.codinghorror.com/blog/archives/001073.html
  9. 9. LIGHT INTERACTIONS  Remember our different kinds of light interactions. Perfect Specular Imperfect Specular Diffuse  Must be able to combine light interactions in a ray-tracing model. Specular to Diffuse Diffuse to Specular And so on
  10. 10. TRANSMISSION OF LIGHT  Indirect transmission of light occurs in several ways  Reflection  Transparent refractions  Translucent diffusion  Transparency should refract light  It looks unrealistic otherwise.  Translucency transmits light in multiple new directions.
  11. 11. RAY-TRACING  For each pixel, we calculate the ray from the centre of the viewport through that pixel.  Find the intersection of that ray with the nearest object.  Determine the pixel colour based o surface properties, orientation, and light intensities  This may in itself have a component from reflected or refracted light rays  If the surface is reflective or transparent, generate a new ray.  Trace that onwards.  Repeat for all pixels.  If no intersection, pixel colour is background colour.
  12. 12. RAY-TRACING  Secondary rays may be used for diffuse reflection.  Generate multiple new rays and trace them on.  Depends on the kind of reflection needed.  Each secondary ray is followed until it hits another object, light source, or background.  Recursion is used to permit this relationship to extend to predefined limits.
  13. 13. RAY-TRACING RESULTS
  14. 14. EFFICIENCY  Expense of computation based on number of calculations required. Consider a 1000x1000 resolution.  On a scene with 1000 objects.  With a single light source.  Consider primary illumination first  How about secondary rays?  Further orders of illumination?  How about a second light source?  Or a third?  Various optimisation schemes exist.
  15. 15. RADIOSITY  Radiosity is based on a model of radiative heat transfer. Assumes conservation of light energy in a closed environment.  Energy emitted or reflected by every surface accounted for by: Absorption Reflection Refraction Fluorescence
  16. 16. RADIOSITY  All surfaces are broken up into patches and elements. Patches can emit or send light  They send light to other parts of the model. Elements can absorb light  They receive light from other parts of the model.  Number of patches relates to computational intensity.  Each element is associated with a patch. Indeed, a patch may have many elements
  17. 17. RADIOSITY  Radiosity works through a system of progressive refinement  Start with the patch which has most energy to ‘shoot’  Each of the elements receive the energy appropriately, and add to the energy of their own patches.  Repeat with the patch which now has the most unspent energy.  Repeat until all patches are empty, or some minimal bound is reached.
  18. 18. RADIOSITY Every polygon gets treated as a patch (a light source) Every patch is associated with a number of elements, http://www.cs.princeton.edu/courses/archive/fall00/cs426/lectures/ra diosity/radiosity.pdf
  19. 19. PATCHES  Patches may be present in higher resolution than surfaces.  One surface may be broken up into many patches.  Subdivision algorithms used to further refine patch mapping over surfaces.  Can be done blindly  Or intelligently  Focus at areas of high contrast in light levels.
  20. 20. RADIOSITY – A FIRST APPROACH  Imagine a simple room  Four walls  A Ceiling  A Floor  No light source  Radiosity makes each of the surfaces in the scene a light source.  Some of these surfaces may have no energy to spend to begin with.  Imagine the roof as a giant light source.  Like in a supermarket  Each surface stores:  How brightly lit it is  How much surplus energy it has to spend.  We must calculate the interaction of energy to surface of all surfaces in the scene.  Can be calculated in many ways. Most usual is by geometric distance.  The resulting number is the form factor.
  21. 21. RADIOSITY Radiosity creates a scene of soft diffuse light. Represents the interaction of surfaces well, but cannot suitably deal with specular reflection. http://www.cs.dartmouth.edu/~spl/ Academic/ComputerGraphics/Fall2 004/outline.html
  22. 22. GLOBAL REFLECTION MODELS  Ray Tracing  Simulates perfect specular reflections  Good for shiny objects reflecting in each other.  Ray-traced images tend to have lots of shiny objects with perfect reflections.  Is viewport dependant.  Change the viewport and you need to rerender.  Radiosity  Simulates the interactions of diffuse light  Good for matte surfaces  Images rendered using radiosity tend to be softly lit rooms without shiny objects.  Is viewport independent.  Change the viewport and the radiosity image remains the same.
  23. 23. GLOBAL REFLECTION MODELS  Best results obtained by combining the two into a two-pass method.  Radiosity used to build a model of diffuse illumination across a scene.  Raytracing used to build a viewport dependant illumination of the scene.  Combination of two has representation of specular and diffuse radiation.  Permits soft and hard lighting in a single scene.
  24. 24. TWO PASS - RAYTRACING
  25. 25. TWO PASS - RADIOSITY
  26. 26. TWO PASS - COMBINED
  27. 27. SUMMARY  Non real-time rendering works through two primary methods.  Ray-tracing  Map the path of light from a viewport to objects.  Radiosity  Light interactions modelled as energy interactions between patches.  Best results obtained by combining both approaches into a two-pass algorithm.

×