Download - GRPHICS08 - Raytracing and Radiosity
RAY-TRACING AND RADIOSITYMichael Heron
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
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…
LOCAL VERSUS GLOBAL
Direct illumination only
Local model
Light source
Global model
Direct and indirectillumination
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.
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 reflectionLight refractionLight scattering
RAY-TRACING
Rays send away from the camera rather than to itMost 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 sceneStill an approximation
RAY-TRACING
Rays sent backwards from the camera.
Much less computationally expensive than the alternative.
http://www.codinghorror.com/blog/archives/001073.html
LIGHT INTERACTIONS
Remember our different kinds of light interactions.Perfect Specular Imperfect SpecularDiffuse
Must be able to combine light interactions in a ray-tracing model.Specular to DiffuseDiffuse to SpecularAnd so on
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.
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.
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.
RAY-TRACING RESULTS
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.
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:AbsorptionReflectionRefractionFluorescence
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
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.
RADIOSITYEvery 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/radiosity/radiosity.pdf
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.
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.
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/Fall2004/outline.html
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.
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.
TWO PASS - RAYTRACING
TWO PASS - RADIOSITY
TWO PASS - COMBINED
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.