modern methods of realistic lighting in real time · ssdo is a fast approximation of global...

8
Modern Methods of Realistic Lighting in Real Time Istv´ an Szentandr´ asi Supervised by: Adam Herout Faculty of Information Technology Brno University of Technology Brno / Czech Republic Abstract Physically plausible illumination in real-time is often achieved using approximations. Recent methods approxi- mate global illumination in the screen space by exploiting the capabilities of modern graphics cards. Two of these techniques, screen-space ambient occlusion and screen- space directional occlusion are described in this work. Screen-space directional occlusion is a generalized ver- sion of screen-space ambient occlusion. It supports one indirect bounce of diffuse light, and depends on the direc- tion of the incoming light. The main goal of this project is to further experiment with these methodsand improve them. For uniform distribution of the sampling points, the Halton sequence is used. To reduce the noise, geometry- aware bilateral filtering is presented. Methods are further sped up by computing them in lower resolution, and are restored to full resolution using joint bilateral upsampling to create the final image. Keywords: global illumination, ambient occlusion, screen-space ambient occlusion, screen-space directional occlusion, halton sequence, bilateral filtering 1 Introduction Computing global illumination in real-time has been and still is a major challenge in computer graphics. Due to the complexity of light transport and some material properties real-time frame rates can only be achieved at the cost of trade-offs and rough approximations. Perceptually among the most important optical phenomena belong soft shad- ows and indirect lighting. There have been many attempts to simulate either of these in real time. A handful of these attempts are based on ambient occlusion (AO) [17], which is very popular in the film industry as well as in games. The main advantage of these techniques lays in their speed and simple implementation. As every approximation, ambient occlusion has some limitations, too. The basic method [17] displays darken- ing of cavities, however it does not take into account the direction and intensity of light coming from light sources or environmental maps. A better method has been intro- duced by Ritschell et al. [13] called screen-space direc- tional occlusion (SSDO). SSDO provides more realistic illumination: accounts for the direction of the incoming light and supports a single indirect bounce of light. The aim of this work is to experiment with these meth- ods and improve them. This work is structured as follows. In Section 2 I describe the present state of methods used in the area. In Section 3 I will present several selected meth- ods and techniques, which are in some way connected to global illumination. Among the selected ones are screen- space ambient occlusion (SSAO), SSDO and shadow map- ping. In Section 4 are possible modifications and opti- mizations to the SSDO method. Finally in Section 5 are the achieved results and discussions for further optimiza- tions and future work. 2 Related Work Ray tracing and radiosity has always been the two ba- sic approaches to approximate physically correct lighting. However, both methods require massive computations. In case of radiosity it is solving a system of equations. In the case of ray tracing the major slowing factors are the num- ber of object-ray intersections and visibility tests. There are many techniques to accelerate these methods, like final gathering, irradiance caching, sparse sampling, advanced space division structures etc. Even with the recent growth in processor speeds and the introduction of GPGPU solu- tions, the performance of these methods is still too slow for interactive applications. Rendering on GPU is still the su- perior solution for real-time rendering. Especially for dy- namic scenes it still has a major lead. This barrier caused the development of alternative methods which did not try to simulate physically correct lighting. They just aim to give a perceptually sufficient approximation. Since the introduction of ambient occlusion [2][17], it has been widely adopted both in gaming and film industry. Ambient occlusion computes the visibility of the hemi- sphere at each point of the scene. The method is often calculated by casting rays in every direction over the hemi- sphere using Monte Carlo sampling. The calculated factor is used to modulate ambient lighting, just as the name sug- gests. [5] Casting rays in every point still requires too much com- puting power, so a few alternative methods were intro- Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Upload: others

Post on 22-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

Modern Methods of Realistic Lighting in Real Time

Istvan SzentandrasiSupervised by: Adam Herout

Faculty of Information TechnologyBrno University of Technology

Brno / Czech Republic

Abstract

Physically plausible illumination in real-time is oftenachieved using approximations. Recent methods approxi-mate global illumination in the screen space by exploitingthe capabilities of modern graphics cards. Two of thesetechniques, screen-space ambient occlusion and screen-space directional occlusion are described in this work.Screen-space directional occlusion is a generalized ver-sion of screen-space ambient occlusion. It supports oneindirect bounce of diffuse light, and depends on the direc-tion of the incoming light. The main goal of this projectis to further experiment with these methodsand improvethem. For uniform distribution of the sampling points, theHalton sequence is used. To reduce the noise, geometry-aware bilateral filtering is presented. Methods are furthersped up by computing them in lower resolution, and arerestored to full resolution using joint bilateral upsamplingto create the final image.

Keywords: global illumination, ambient occlusion,screen-space ambient occlusion, screen-space directionalocclusion, halton sequence, bilateral filtering

1 Introduction

Computing global illumination in real-time has been andstill is a major challenge in computer graphics. Due to thecomplexity of light transport and some material propertiesreal-time frame rates can only be achieved at the cost oftrade-offs and rough approximations. Perceptually amongthe most important optical phenomena belong soft shad-ows and indirect lighting. There have been many attemptsto simulate either of these in real time. A handful of theseattempts are based on ambient occlusion (AO) [17], whichis very popular in the film industry as well as in games.The main advantage of these techniques lays in their speedand simple implementation.

As every approximation, ambient occlusion has somelimitations, too. The basic method [17] displays darken-ing of cavities, however it does not take into account thedirection and intensity of light coming from light sourcesor environmental maps. A better method has been intro-duced by Ritschell et al. [13] called screen-space direc-

tional occlusion (SSDO). SSDO provides more realisticillumination: accounts for the direction of the incominglight and supports a single indirect bounce of light.

The aim of this work is to experiment with these meth-ods and improve them. This work is structured as follows.In Section 2 I describe the present state of methods used inthe area. In Section 3 I will present several selected meth-ods and techniques, which are in some way connected toglobal illumination. Among the selected ones are screen-space ambient occlusion (SSAO), SSDO and shadow map-ping. In Section 4 are possible modifications and opti-mizations to the SSDO method. Finally in Section 5 arethe achieved results and discussions for further optimiza-tions and future work.

2 Related Work

Ray tracing and radiosity has always been the two ba-sic approaches to approximate physically correct lighting.However, both methods require massive computations. Incase of radiosity it is solving a system of equations. In thecase of ray tracing the major slowing factors are the num-ber of object-ray intersections and visibility tests. Thereare many techniques to accelerate these methods, like finalgathering, irradiance caching, sparse sampling, advancedspace division structures etc. Even with the recent growthin processor speeds and the introduction of GPGPU solu-tions, the performance of these methods is still too slow forinteractive applications. Rendering on GPU is still the su-perior solution for real-time rendering. Especially for dy-namic scenes it still has a major lead. This barrier causedthe development of alternative methods which did not tryto simulate physically correct lighting. They just aim togive a perceptually sufficient approximation.

Since the introduction of ambient occlusion [2][17], ithas been widely adopted both in gaming and film industry.Ambient occlusion computes the visibility of the hemi-sphere at each point of the scene. The method is oftencalculated by casting rays in every direction over the hemi-sphere using Monte Carlo sampling. The calculated factoris used to modulate ambient lighting, just as the name sug-gests. [5]

Casting rays in every point still requires too much com-puting power, so a few alternative methods were intro-

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Page 2: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

duced. These methods compute AO less accurately in or-der to achieve higher frame-rates. Instead of computingocclusion over surfaces in 3D, these methods usually ap-proximate AO in the screen space [14][9][1][6]. SSAO isvery popular due to its simplicity and speed. It does notrequire any additional data and can be applied as a post-process to the scene.

Ambient occlusion is just a coarse approximation ofgeneral light transport. It does not take into account anydirectional information or other more expensive illumina-tion effects (interreflections, caustics, subsurface scatter-ing). A different family of techniques, the precomputedradiance transfer (PRT) [5], does support the aforemen-tioned features. On the other hand, the PRT algorithmstypically assume static scenes, distant lights or environ-ment maps.

Screen-space directional occlusion (SSDO) [13] triesto combine the speed and simplicity of SSAO methodswith directional information of lighting and indirect colorbleeding.

To avoid some limitations of screen space ambient oc-clusion a hybrid method was introduced by Reinbothe etal. [12]. This method works in 3D space by voxelizationof the scene, calculating occlusion based on this informa-tion and finally using bilateral filtering in the screen spaceto smooth the shadows.

A completely different approach was taken by Ka-planyan et al. [7]. They approximate indirect illuminationin fully dynamic scenes using cascaded light propagationvolumes. This method supports single bounce illumina-tion with occlusion, but it can be extended to support mul-tiple bounces and to handle participating media.

These techniques show that to generate sufficiently re-alistic images, no physically precise computations areneeded. Simple approximations using soft shadows, am-bient occlusion, and optionally a single bounce of indirectlight can give acceptable results even in real-time.

3 Real-Time Global IlluminationTechniques

There are many techniques to approximate global illumi-nation in real time. This section contains the descriptionof the techniques I experimented with.

3.1 Screen-Space Ambient Occlusion

Screen-space ambient occlusion (SSAO) is a coarse ap-proximation of ambient occlusion that works in the screenspace to achieve real-time frame rates. The idea behindSSAO is to reuse the z-buffer data, which was alreadycomputed during rendering of the scene. The approach isbased on sampling the surrounding pixels combined withsimple depth comparisons. Based on the results, an aver-age visibility value can be computed. This visibility prop-erty is used as a darkening factor for cavities and corners

in the scene. This way SSAO can be computed in one passas a post-process over the image.

z-buffernormal

camera

sampling directions

original point

occluders

surface

hemisphere

Figure 1: SSAO principle. An area around the pixel issampled in 2D (bottom image). Using the normal onlysampling points that should be in the hemisphere are used(top image). The generated depths for each sampling pointare compared to the depth of the appropriate pixel to deter-mine, if the pixel corresponds to an occluder object (yel-low (light) and red (dark) points.

Additional information can be used to achieve more pre-cise and hence better looking results. The normals for eachpixel could be a good choice. Without taking the nor-mal into account and just randomly generating points ina close proximity of the pixel may cause darkening of un-wanted parts of the scene, such as planes that are almostparallel with the viewing angle. Using the normal of thepixel sampling directions outside the hemisphere can befiltered out. However, random sampling may cause prob-lems in the image which have to be sorted out. To avoidartifacts, the distribution of the generated random samplesover the hemisphere is needed to be as uniform as possible.Also, the noise caused by non-uniform sampling should besmoothed.

Usually in SSAO methods, the problem of generatingsamples randomly with uniform distribution is solved byprecomputing a few uniformly distributed random direc-tions in a sphere. Variation to the sampling points is addedusing random normals to reflect the directions. These newdirections are then optionally reversed to be in the hemi-

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Page 3: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

sphere around the normal of the pixel. In this project I usedthe Halton sequences with appropriately chosen bases.

Computing ambient occlusion from simple depth val-ues has some drawbacks, too. First the precision of SSAOis highly dependent on the size of the scene. The biggerthe scene, the smaller changes in z-buffer values of nearbyvertices. This can lead to unwanted effects, like darkeningthe whole silhouette of an object.

The second problem is caused by the limited area thatis sampled for occluders. Two objects which are close in3D, and so the surfaces close to each other should be dark-ened, the distance between their projected positions mightbe larger then the sampled area. As a consequence SSAOwill not detect any occluders.

3.2 Screen-Space Directional Occlusion

SSDO is a fast approximation of global illumination. Itworks in the screen space, takes into account the directionof the light, and is able to handle one indirect bounce ofdiffuse light [13]. To compute light transport SSDO usesthe 3D positions and normals of each pixel in th screenspace as input. In theory the output is created in twopasses. In the first pass, the direct illumination is com-puted. In the second pass, the indirect bounce of light iscomputed using the data from the previous pass.

3.2.1 Direct Illumination Using Directional Occlusion

While the standard SSAO methods use only the positionsand normals of each pixel, SSDO also takes into accountthe direction of the incoming light. The amount of direc-tional light is computed as follows for each point P andnormal N:

Ldir(P) =1π

∫Ω

ρ

πLin(ω)V (ω)(N ·ω)dω, (1)

where ρ

πis the diffuse BRDF, Lin is the incoming radiance

from solid angle omega in the hemisphere Ω; V is the visi-bility test. When using Monte Carlo sampling the integralis replaced by a sum of K samples each covering a solidangle of ∆ω = 2π/K:

Ldir(P) =K

∑i=1

ρ

πLin(ωi)V (ωi)(N ·ωi)∆ω. (2)

This method assumes that Lin can be efficiently com-puted from environment maps or point lights. Similarlyto SSAO, to avoid ray-tracing the occluders are approx-imated in the screen space. The difference is that whilein SSAO the samples are generated in 2D in image space,SSDO uses sample points generated in the hemisphere in3D using the normal and the 3D position of the pixel. Thesample points are then backprojected into the image spaceto determine if in the given direction is an occluder or not.This way SSDO does not suffer from the problem men-tioned in SSAO, that is: objects further away in the screen-space, but closer in 3D in the scene may cause occlusion.

The sampling of the hemisphere is done as follows:for every generated solid angle ωi and a random stepri ∈ [0 .. rmax], the position of the sampling points is com-puted as P+ riωi. The generated points are located in thehemisphere with a center of P and oriented around the nor-mal N. The depth of the backprojected sampling points iscompared with the values from the original z-buffer. If thedepth value from the original z-buffer is greater than thedepth of the sampling point, the sampling point is belowthe surface. The light from this direction is blocked byan occluder. Otherwise the light has clear path from thisdirection and the incoming radiance can be computed.

B

C

rMax

Camera

Not in the hemisphere,

discard for bounce

occluder

environment map or light

source computation

ADbounce

no bounce

A,B,C,D pseudorandomly generated points

C,B - light comes from this direction

A - occluder, but no bounceD - occluder, bounce

C - no bounce

normal

original point

Figure 2: SSDO principle

To get a clearer picture the method is demonstrated byFigure 2 for four sampling points A, B, C, D (red dots).The sampling points are generated randomly with uniformdistribution over the hemisphere with a random step fromthe original point and then backprojected to the image.Now that the image space coordinates are known, the 3Dcoordinates can be computed or read from a frame buffer(green, orange and black dots). These points are again pro-jected into the image to get the distance from the camera.If the sampling point is further than the appropriate pointon a surface in the scene, the sampling point is classified asan occluder (A and D points). Otherwise, the illuminationcan be computed from the direction defined by the pointand the origin (B and C points). The direction is shown bythe yellow line.

3.2.2 Indirect Bounce

Since the 3D position and normal are available for eachsampling point projected to the surface, they can be used toget one indirect bounce of light from the given directions.In the original paper only the points on the surface pro-jected from sampling points classified as occluders weretaken into account (A and D points). For each of these

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Page 4: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

pixels the computed directional light intensity and the cor-responding pixel color from the direct illumination pass isused as the base for indirect light. To calculate the indirectradiance sent to the origin, these pixels are treated as smallpatches oriented around the normal. Using the sender nor-mal, back facing patches can be filtered out (for examplefor sampling point A).

The equation for the additional incoming indirect radi-ance for a point P:

Lind(P)=1π

∫Ω

ρ

πLdir(Pω)(1−V (ω))

As(N ·ω)(Nω · (−ω))

|P−Pω |2dω,

(3)where Pω and Nω are the point and normal from pointand normal buffer, each corresponding to a sampling pointtaken from the hemisphere in direction ω . As is the areaassociated with the sender patch. This equation respectsthe mutual orientation of the surfaces based on the normals((N ·ω)(Nω ·(−ω))) and that the intensity of the incomingradiance decreases quadratically with the distance of thesurfaces.

The modified version of the equations for K samples isthen:

Lind(P) =K

∑i=1

ρ

πLi(1−V (ωi))

As(N ·ωi)(Ni · (−ωi))

|P−Pi|2∆ω,

(4)For the initial value for As, the base circle is subdividedinto K regions, each covering As = πr2

max/K. This valuecan also be used as a parameter to control the strength ofthe color bleeding manually.

In the example above (Figure 2), points A and D arethe only occluders. After projecting these points onto thesurface from the cameras viewpoint, the information aboutthe normal, position and color are also available. The pro-jected point for A has a back facing normal, so it will notcontribute to the final bounce. The patch for samplingpoint D, on the other hand, will qualify as a sender of in-direct light towards point P.

The original version does not take into account situa-tions when the point is not classified as an occluder, butstill can be used for bouncing light. Like on Figure 2 pointB.

3.3 Shadow mapping

Shadow mapping [16] is an algorithm to create shadows inreal-time. The algorithm can be split into two parts. First,the scene is rendered from the lights point of view and foreach pixel the distance from the light is saved into a tex-ture. This information can be used for depth comparisonfor each pixel from the camera to decide if it is in shadowor not.

Since the depth comparison and rendering from differ-ent views can all be done on hardware, this technique isreally fast. The depth comparison is on the level of pix-els, which means that self-shadowing is not a problem for

Figure 3: Shadow mapping principle

shadow mapping. Another advantage over other shadow-ing techniques is that it can be used for transparent objects.

There are several problems to take care of. Since eachpixel stores the depth value of the pixel centre, for pointsthat are projected between these pixel centers in the sec-ond part of the algorithm, self-occlusion artifacts may ap-pear. This problem can be solved by introducing a bias tothe shadow map values. The source of the next problemcomes from the fact, that the shadow map is stored in atexture and therefore its resolution is limited. This leadsto aliasing on the edges of shadows. This problem canbe solved with percentage-closer filtering [11]. Using thismethod, the area of penumbra appears. These soft shad-ows may further improve perception. For larger scenes,the size of the shadow maps is a huge issue. To achievesufficient results for every part of the scene several meth-ods exist. For example: perspective shadow maps [15],cascaded shadow maps [3].

4 Modifications and ImplementationNotes

The aim of this project is to experiment with the meth-ods described in the previous chapter and to potentiallyimprove them. Next I describe three modifications andimprovements that proved to be successful.

4.1 SSDO for Directional and Point Lights

When SSDO is computed for scenes with directional andpoint lights, several modifications are possible. Comput-ing the pixels intensity in real implementations based onthe equation (2), due to the random or pseudo-randomsampling of the directions in the hemisphere, causes noiseeven on plain surfaces with no occluders nearby. To avoidthis SSDO, can be computed as follows: when renderingthe scene before computing SSDO to get the material, nor-mal, depth information, the overall intensity of the pix-els can be computed using the appropriate lighting model.The overall intensity should be equal to the value com-puted using equation (1) without the visibility function.

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Page 5: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

When computing SSDO, instead of computing the inten-sity for the pixels, a modulation factor can be computedfor each pixel. This modulation factor is the ratio of theintensity computed with the visibility function and with-out it using equation (2). The modulation factor can beapplied to the diffuse and/or to ambient component of theoverall intensity when creating the final image.

This modulation factor can be further processed. To re-duce noise, smoothing can be used. Simple Gaussian bluris not enough in this case. The usage of geometric in-formation is necessary to prevent bleeding of values overedges and between distant pixels in 3D, but close in 2D.A geometry-aware filtering, like a modified bilateral filter-ing on the base of normals and depth value is suitable. Thismethod was used also by Reinbothe et al. [12]. To approx-imate the results of a full bilateral filtering, they separatedthe calculations into a vertical and a horizontal pass. Com-bination of the results of these two one dimensional filtersimproves the frame rates significantly and still providesacceptable quality.

Since this factor is actually a generalized version ofthe darkening factor computed with ambient occlusion, itchanges, similarly to ambient occlusion factor, slowly overspatial space on surfaces. This permits to compute it inlower resolutions. As a consequence the method could besped up radically; on the other side, result should be up-sampled correctly. For this joint bilateral upsampling [8]can be used with the same modifications as for smoothingto honor geometry properties.

4.2 Sampling and the Halton Sequence

In both SSAO and SSDO, Monte Carlo sampling is used toapproximate the correct solutions. Absolute random distri-bution of samples in Monte Carlo methods can cause prob-lems; one of the worst of these is clumping (when for smallnumber of random numbers, the variance between the val-ues is low). To decrease the effect of clumping in sam-ples, quasi-Monte Carlo methods eliminate the random-ness completely. Samples are deterministically computedto achieve a stochastic distribution as close to the uniformdistribution as possible.

To describe how much the point distribution of a givenmethod derivates from an ideal solution a measure calleddiscrepancy is used. Quasi-Monte Carlo methods tryto minimize this discrepancy. There are several low-discrepancy sequences that are used for generating sam-pling points: Hammersley, Halton, Sobol, Niederreiter,etc. [5]

The Halton sequence generation is based on the radicalinverse function applied to an integer i. This integer canbe expressed in a base b with terms a j:

i =∞

∑j=0

a j(i)b j. (5)

The radical inverse function is computed by reflecting the

resulting digit sequence about the decimal point:

Φb(i) =∞

∑j=0

a j(i)b− j−1. (6)

For generating multi-dimensional low-discrepancy se-quences, a different radical-inverse sequence is used ineach dimension. The ith point in the sequence is givenas:

xi = (Φb1(i),Φb1(i), . . . ,Φbd (i)), (7)

where the bases b j are relatively prime and d is the dimen-sion of the sequence.

An intuitive explanation of the uniformness of the Hal-ton sequence is as follows: before generating strings oflength m + 1, all the strings of length m are produced.This means that before generating a new point on an in-terval, all intervals of size b−m will be visited first. Thisfact also suggests some kind of periodicity in similarityof the generated values. For example consider a Hal-ton sequence with base 2: Φ2(50) = 0.296875,Φ2(50+16) = 0.2578125,Φ2(50 + 32) = 0.2890625,Φ2(50 +64) = 0.3046875. This periodicity can be expressed [4]:∣∣(Φb(i)−Φb(i+mNg)

∣∣< 1bk ;Ng = lbk, l > 0,k ≥ 0, (8)

where l, m, k are integers, and Ng is the period to generatesimilar sampling points. For multidimensional Halton se-quences, the least common multiple of the periods for eachdimension is used as Ng. This property is demonstrated inFigure 4.

Figure 4: Projected view of the hemisphere - Halton se-quences with bases 2, 5 and period 10. Each pixel is col-ored based on the index in the sequence and the period.Every 10th has the same color.

This periodicity can be exploited to control the numberof sampling points, but still have a quasi uniform distribu-tion. Another possibility may be for example in the caseof occlusion detection to filter out directions, where an oc-cluder was already found.

4.3 Preprocessing

In SSDO, the same amount of sampling points is generatedfor every pixel. Setting this amount higher means better

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Page 6: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

results, but it will cause a performance drop. Generatingmore samples for planes which do not have any occludersnearby is a waste of computing power. The solution wouldbe to generate more sampling points for pixels which arepotentially occluded and less for pixels where the proba-bility of finding an occluder is low. The number of oc-cluders is usually higher at parts of the image where thenormals or the depth values differ significantly. So to getareas where the higher number of sampling points shouldbe generated, a preprocessing step could be added to theSSDO calculations. In this preprocessing step, a weight iscalculated to define the number of sampling points to beused. Areas where the changes in normal and depth valuesare bigger are given a higher weight. Planes, on the otherhand will have much smaller weight, since the normals areconstant for pixels on the same plane.

Figure 5: Preprocessed images with different sizes of fil-tered images. The darker regions represent higher numberof sampling points. The blue color just shows the com-puted SSDO darkening factor.

To calculate this weight, a simple filtering using the nor-mal and depth values can be used to get the gradient mag-nitude. This value can be used to determine the number ofsampling points. To get wider areas around discontinuitiesand in order to speed up the filtering, it can be computedin much lower resolutions. Optionally combining resultsfrom different resolutions should give more precise resultsof areas where the SSDO values may change more. Us-ing just one resolution is not the best solution. A moreadvanced method was used in [10] to get locations wherehigher resolution was required for computing image spaceradiosity.

5 Results

With both methods (SSAO and SSDO) I was able to pro-duce realistic images in real-time (Figure 6). The resultsof the achieved frame rates are summarized in Table 1.The methods were tested on four scenes with resolution1024x768. These numbers are just exemplary. The speedof these methods depends in great extent also on the reso-lution, graphics hardware, as well as the degree of requiredsmoothing.

SSAO was naturally the fastest for all scenes. The addi-tional computation and texture reads to get bounces forSSDO makes it 25% slower with the same number of

sampling points. However, to get good results for SSDOwith larger hemisphere radius, many sampling directionsare needed. The number of sampling points for the sec-ond SSDO column was calculated from the results of thepreprocessing step. From the measured frame-rates it isclear that the limiting factor for SSDO computation is thespeed of the fragment shader and the number of texturelookups per pixel. These are the areas that should be moreoptimized in the future.

Due to the fact that SSDO is computed in the screenspace, a few problems arise. The lack of complete knowl-edge of 3D causes occluders not visible from the camera’spoint of view to be discarded, hence making the resultshighly view-dependent. For more complex scenes even asmall change in camera position may reveal parts of thescene previously hidden and cause new shadows and indi-rect bounces. The authors of the original paper suggestedusing depth peeling for partly solving this problem. Stor-ing multiple depth values for each point in multiple passesgives more information on the scene structure, however,it makes the speed of the technique dependent on scenecomplexity. It also further slows down occlusion compu-tations by forcing to read values from multiple buffers andcalculating the depth test for each. Alternatively, the au-thors also suggest using multiple viewpoints. This in the-ory could give better results than depth peeling, but correctpositioning of the cameras may vary based on the scenetype.

Figure 7: Left SSDO, right SSAO with different light po-sition in front of the dragon in the bottom row of imagesand behind the dragon for the top row images.

A comparison of SSAO and SSDO can be seen in Fig-ure 7. The difference of the two techniques can be eas-ily observed on the darkening factor around the tail of thedragon. While SSAO darkens only the silhouette, the tailin SSDO darkens the wall close to it in 3D. The next differ-ence is when the light position is changed. While SSAOremains static with moving light, the shadows caused byocclusion in SSDO move a little in the opposite direction.This nice feature of SSDO with the addition of the bouncegives much more believable results than SSAO.

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Page 7: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

(a) Dragon (b) Buddha (c) Cornell box (d) Boxes

Figure 6: Scenes rendered using SSDO. (Dragon and Buddha models are from the The Stanford 3D Scanning Repository)

Scene Number of faces SSAO [FPS] SSDO 10 [FPS] SSDO 20+ [FPS]Dragon 201037 146 104 85Buddha 290939 126 95 74

Cornell box 30 199 142 104Boxes 2294 191 130 95

Table 1: Frame rates for each scene and method with 7x7 kernel for filtering and 3x3 kernel for upsampling. For SSAO10 sampling points were used, for SSDO 10 sampling points per pixel and for the second column of SSDO 20+ samplingpoints (maximally 50). For testing an ATI RadeonTM HD 4850 GPU was used.

6 Conclusions

Screen-space ambient occlusion is a very fast approxima-tion of ambient occlusion, but it has some limitations.Screen-space directional occlusion includes two general-izations that add directional occlusion and diffuse indirectbounces. Both extensions improve realism considerablyfor a minor computational cost.

In this paper, a few experiments were made to thescreen-space directional occlusion. Sample point gener-ation based on Halton sequence is an easy way to getuniform distribution of the sampling points. The peri-odic properties of the Halton sequence can also be usedto potentially further optimize the method. This was ex-ploited to generate variable amount of sampling points,but still have a pseudo uniform distribution. To reducenoise, a modified version of bilateral filtering was used,which took into account the geometry information as wellto avoid color bleeding over edges and between objects.The SSAO and SSDO methods were computed in lowerresolutions to speed up the method. For upsampling to theoriginal resolution, joint bilateral upsampling was used tohonor geometry properties.

In the future, more experiments can be made to SSAOand SSDO accompanied with more comprehensive testingbased on the controllable features of each method. To geta clearer picture where these methods stand performance-wise, a few other methods could be explored, too.

References

[1] Louis Bavoil, Miguel Sainz, and Rouslan Dim-itrov. Image-space horizon-based ambient occlusion.

In ACM SIGGRAPH 2008 talks, SIGGRAPH ’08,pages 22:1–22:1, New York, NY, USA, 2008. ACM.

[2] Robert L. Cook and Kenneth E. Torrance. A re-flectance model for computer graphics. SIGGRAPHComput. Graph., 15:307–316, August 1981.

[3] R. Dimitrov. Cascaded shadow maps (whitepaper).NVIDIA OpenGL SDK 10 Code Samples, 2007.

[4] Kirill Dmitriev, Stefan Brabec, Karol Myszkowski,and Hans-Peter Seidel. Interactive global illumina-tion using selective photon tracing. In Proceedingsof the 13th Eurographics workshop on Rendering,EGRW ’02, pages 25–36, Aire-la-Ville, Switzerland,Switzerland, 2002. Eurographics Association.

[5] P. Dutre, K. Bala, and P. Bekaert. Advanced globalillumination. Ak Peters Series. AK Peters, 2006.

[6] Dominic Filion and Rob McNaughton. Effects &techniques. In ACM SIGGRAPH 2008 classes, SIG-GRAPH ’08, pages 133–164, New York, NY, USA,2008. ACM.

[7] Anton Kaplanyan and Carsten Dachsbacher. Cas-caded light propagation volumes for real-time indi-rect illumination. In Proceedings of the 2010 ACMSIGGRAPH symposium on Interactive 3D Graphicsand Games, I3D ’10, pages 99–107, New York, NY,USA, 2010. ACM.

[8] Johannes Kopf, Michael F. Cohen, Dani Lischinski,and Matt Uyttendaele. Joint bilateral upsampling.In ACM SIGGRAPH 2007 papers, SIGGRAPH ’07,New York, NY, USA, 2007. ACM.

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)

Page 8: Modern Methods of Realistic Lighting in Real Time · SSDO is a fast approximation of global illumination. It works in the screen space, takes into account the direction of the light,

[9] Martin Mittring. Finding next gen: Cryengine 2.In ACM SIGGRAPH 2007 courses, SIGGRAPH ’07,pages 97–121, New York, NY, USA, 2007. ACM.

[10] G. Nichols, J. Shopf, and C. Wyman. Hierarchicalimage-space radiosity for interactive global illumi-nation. page 11411149, 2009.

[11] William T. Reeves, David H. Salesin, and Robert L.Cook. Rendering antialiased shadows with depthmaps. In Proceedings of the 14th annual conferenceon Computer graphics and interactive techniques,SIGGRAPH ’87, pages 283–291, New York, NY,USA, 1987. ACM.

[12] C. Reinbothe, T. Boubekeur, and M. Alexa. Hybridambient occlusion. EUROGRAPHICS 2009 AreasPapers, 2009.

[13] Tobias Ritschel, Thorsten Grosch, and Hans-PeterSeidel. Approximating dynamic global illuminationin image space. In Proceedings of the 2009 sympo-sium on Interactive 3D graphics and games, I3D ’09,pages 75–82, New York, NY, USA, 2009. ACM.

[14] Perumaal Shanmugam and Okan Arikan. Hardwareaccelerated ambient occlusion techniques on gpus. InProceedings of the 2007 symposium on Interactive3D graphics and games, I3D ’07, pages 73–80, NewYork, NY, USA, 2007. ACM.

[15] Marc Stamminger and George Drettakis. Perspec-tive shadow maps. In Proceedings of the 29th an-nual conference on Computer graphics and inter-active techniques, SIGGRAPH ’02, pages 557–562,New York, NY, USA, 2002. ACM.

[16] Lance Williams. Casting curved shadows on curvedsurfaces. In Proceedings of the 5th annual con-ference on Computer graphics and interactive tech-niques, SIGGRAPH ’78, pages 270–274, New York,NY, USA, 1978. ACM.

[17] S. Zhukov, A. Inoes, and G. Kronin. An ambientlight illumination model. In proceedings of the Eu-rographics Workshop in Vienna, Austria, RenderingTechniques ’98, pages 45–56, Springer, 1998.

Proceedings of CESCG 2011: The 15th Central European Seminar on Computer Graphics (non-peer-reviewed)