Top Banner

of 5

William.sig78

Apr 05, 2018

Download

Documents

don504
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/31/2019 William.sig78

    1/5

    CASTING CURVED SHADOWS ON CUR VED SURFACES

    Lance WilliamsComputer Graphics Lab

    New York Institute of TechnologyOld Westbury, New York 11568

    AbstractShadowing has historically been used to increasethe intelligibility of scenes in electron micros-copy and aerial survey. Vario us meth ods have beenpublished for the determination of shadows in com-puter synthesized scenes. The displ ay of shadowsmay make the shape and relative position of objectsin such scenes more comprehensible; it is a tech-nique lending vividn ess and realism to computer an-imation.

    To date, algorithms for the determination of sha-dows have been restricted to scenes constructed ofplanar polygons. A simple algorithm is d escribedwhich utilizes Z-buffer visible surface computationto display shadows cast by objects modelled ofsmooth surface patches. The metho d can be appliedto all enviror~nents, in fact, for which visib lesurfaces can be computed. The cost of determi ningthe shadows associated with each light source isroughly t wice the cost of rendering the scenewithou t shadows, plus a fixed transfo rmation over-head whic h depend s on the image resolution. No ex-tra entities are added to the scene description inthe shadowing process. This comprehe nsive algo-rithm, which permit s curved shadows to be cast oncurved surfaces, is contrast ed with a less costlymethod for casting the shadows of the environmenton a sing le ground plane.In order to attain good results, the discret e na-ture of the visible-surface computations must betreated with care. The effects of dither, interpo-lation, and geometric quantization at differentstages of the shadowing algorithm are examined.The special problems posed by self-shadowing sur-faces are described.

    Key words: shadows, hidd en surfacecomputer animation, computer graphics.C R c l a s s i f i c a t i o n : 8 . 2

    algorithms,

    IntroductionThe Z-buffer visibl e surface algorithm, first pub-lished by Catmull [i], was the first method to makepossible computer generated shaded pictures of hi-cubic surface patches. The algorith m is extreme lygenera l and quite simple to implement but requiressubstantial memory.

    A "frane buffer," in the curren t computer graph icsparlance, is a memory that stores a complete digi-tal picture. It may serve as an intermediarybetween the computer that produces the picture anda video driver which continuously refreshes adisplay. Some visible surface algorit hms (e.g.[2]) require a frame buffer in order to comput e animage. In this case, the frame buffer mediates thedisplay process in a more substantial way.The Z-buffer is an extens ion of this mass -memo ryapproach to computer graphics which resolves thevisibl e surfaces in a scene by storing dept h (Z)values at each point in the picture. As objects arerendered, their Z value s are compared at each pointwith the stored Z value s to deter mine visibility.Since this determination requires only that a meas-ure exist which orders the surfaces to bedisplayed, it is not too strong a statemen t to saythat the Z-buffer algori thm provid es a discretesolution to all scenes for which visible surfacescan be computed.Z-buffer vis ible surface compu tatio n is of partic u-lar interest because it exhibits li miting-ca se pro-perties [3]. The objects to be rendered do nothave to be sorted beforehand, so indefinitely com-plex scenes can be handled. At the pixel level,the Z-buffer implicitly execute s radix sorts in Xand Y and simp le indexing in Z. In X and Y, thesorts are bucket sorts, the special case of the ra-dix sort where the radix encompasses the range ofthe keys, obviatin g all comparisons . In Z, the in-dex of the sort is reduced to one, necessi tatingonly a single comparison for each item.Radix sorting is the only sorting m ethod whic hgrows only linearly in expense with the ntmber ofrandomly- ordered items to be sorted, and the Z-buffer is the only visible surface algorithm thecost of which grows only linearly with the averagedepth compl exity of the enviro r~ent (that is tosay, with the total screen area of all surfacesrendered, whether visible in the final image ornot).Thus the Z-buffer algorithm enjoys two key advan-tages over all other existing visib le surface algo-rithms:

    i. indefinitely large enviror~ents;2. linear cost growth.

    In addition, the final image computed has an asso-

    2 7 0

  • 7/31/2019 William.sig78

    2/5

    ciated Z partition, a "depth map" [4] of the scene.This extra information permits a great many in-teresting post-proce sses on a computed im age . Suchalgorithms a re n oteworthy because their expensedoes not vary with the size or complexit y of theenvironment, but depe nds onl y on the image resolu-tion. The shadow algorithm described here is oneattemp t to exploi t the Z partition.

    Shadow InformationThe display of shadows may make the shape and rela-tive po sition of objects in computer generatedscenes more comprehensible. Shadows emphasize andmay serve to clarify the three dimensional natureof the forms displayed.The shadows cast by a point source of light onto aflat surf ace represent, like a pers pect ivetransformation, a projection of the scene onto aplane. This simplified situa tion offer s a con-venient way of understanding the information thatshadows convey. A scene rendered with shadows con-tains two views in one image. If we are content tocast shadows on a single wall or ground plane,these two views are simple projections. In gen-eral, of course, shadows ma y fall acros s any sur-face in the scene. Two view s are still suffi cientto compu te the shadows, however, if they are Z-buffer views.The proposed algorithm works as follows:i. A view of the scene is constructed from the

    point of view of the light source. Only the Zvalues and not the shading values need be com-puted and stored.

    2. A view of the scene is then constructed fromthe point of view of the observer's eye. Alinear transformation exists which maps X,Y,Zpoints in the observer's view into X,Y,Z coor-dinates in the light source view. As eachpoint is generated in the observer's view, itis transformed into the computed view in thelight source space and tested for visibilit yto the light source before computing its shad-ing value. If the point is not visible to thelight source, it is in shado w and is shadedaccordingly.

    Step (2) as defin ed is the "correct" form of theproposed algorithm, but in the ensuing discussionand pictures a modified procedure is ass~ned. Theccmplete scene is computed from the observer'sviewpoint, and the point-by-point transformati on tothe light source space and consequent shadowing isundertaken as a post-process. This modified algo-rithm incorrectly shades the hilights in the scene,since they appear in the shading process and thenare merely darkened if they are found to lie inshadow; hiligh ts should not appe ar in shadowedareas at all. The modifie d algorithm may alsosuffer more severely from quantization problems,since the Z coordinates of the visible points willhave been quantized to the resolution of the Zbuffer (16 bits in the case s illustrated her e) be-fore transformation. On the other hand, the ex-pense of the transformation in the modified versio ndoes not depend on the complexity of the scene, asit does when all points are transformed as they arecGmputod. Opera ting as a post process, the

    transformation is applied only to the points thatare visi ble in the final picture. The expens e isthus dependent only on the reso lution of the image.Like most point-by-point operations, expense in-creases with the square of the resolution.

    Limitations of Image SpaceThe generalizati on to curved surfaces and thelinear cost growth which distingui sh the proposedalgorithm are both attributable to the fact thatall com putations are performed in image space.This approach carries with it certain limitations,however, which must be weighed against the advan-tages.Since shadow determinati on is based on transforma-tion between two images, the user must take care toensure that all objects which may cast a shadow inthe observer's image be within the field of view ofthe light source image. The ass~nption is thatpoints transformed into the light source spacewhich lie outside the viewing vol~ne of the lightsource are illeminated. Shadows may only be castwithin the viewing vol~ne of the light source.While it is not precisel y true that the lightsource must lie outside the observer's field ofview, it can cast shadows only within its ownfield. If a light source within the observer'sviewing volt, e is to cast shadows in all direc-tions, its sphere of ill~nination must be sectoredinto multiple views as suggested by Crow [5]. Com-puting these views in the Z-buffer is only slightlymore expensive than computing a single view con-taining all the objec ts in the scene. Trans formi ngpoin ts from the obse rver's image into the lightsource space becom es more expensive, however. Ei-ther each point must be transformed into each lightsource view (the correct approach in computing sha-dows for multiple light sources) , or clippedagainst the light source viewing vol~nes in theobserver's space and transformed into the coordi-nates of the light source view in which it falls.The major difficu lty with this method is the in-creased memo ry required.Severe perspective, either in the observer's viewor required by a light source close to the scene,may increase the quantizatio n problems attendant intransforming from one image to the other. In anycase, qu antization and aliasing are the chief draw-back of image space algorithms. The aliasing prob-lem must be addressed vigorous ly whenever imagespace techni ques are applied. This is a large andcemplicated issue, outside the scope of this paper;for a general treatment of aliasing and visiblesurfac e algorithas, see [i], [6] , and espe cial ly[7]. [3] wil l tre at the special topic of aliasing,geometric quanti zation and the Z-buffer.Self-shadowing surfaces rendered by the proposedtechnique constitute an excellent case stud y in im-age space sampling problems. When we transform apoint from a surface in the observer's space onto asurfa ce in the light so urce space, it should ideal-ly lie right on the surface of which it is a part.Due to the imprecision of machine arithmetic andmore particular ly o the quantization of Z-buffersurfaces, it will fall above or below the surface.Since we wa nt the poin t to appear illt~ninated if itlies on a visible surface, we subtract a bias from

    2 7 1

  • 7/31/2019 William.sig78

    3/5

    fig. 1The observe r ' view of four spheres.

    fig. 2The four spheres viewed from thelight source.

    position of the

    fig. 3Shadow with reduced surface bias revealstion moire.

    quantiza- fig. 4Increased bias and dither applied to shadowtation.

    compu-

    fig. 5Low-pass filtering applied to shadow.

    fig. 6Shadow applied to the image of fig. 1

    2 7 2

  • 7/31/2019 William.sig78

    4/5

    the Z value of the point after it has beentransformed into the light source space (actually,of course, this bias is incorporated into the gen-eral linear transform ation employed). The bias maymove the shadow line slightly, but it has thedesired effect of keeping surfaces from shadowingthemselves where they are plainly visible to thelight source.As a surface curves smoothly away from the light,however, it must ultimatel y shadow itself. This isnot a problem with polygons, the sharp edges ofwhich make shadowing a rather sharply defined pro-position. A smooth surface shadowing itself in ashallow curve may switch from light to dark on thestrength of a le ast significan t b it in the Z-buffer. Worse, it may switc h back and forth as thequantizing error beats with the ssmpling grid, pro-ducing a vivid moire.Figures 1 and 2 illustrate a simple scene from thepoint of view of an observer and from the point ofview of the light source, respectively. The Z biassubtracted from the transformed points in computingthe shadows of figure 3 has been delibe rately re-duced to reveal the quantizing moire. The lightsource is at infinity, rotated one hundred degree sabout the vertical axis to the left of theobserve r's bearing. Note that the quantizing erroris greates t in two areas: at the edge of the vert-ical solid shadow line, and in a dark curved bandto the left of it. These correspond to, respec-tively, the right edge of the spheres in the lightsource view, and the right edge of the spheres inthe untransforme d observer's view. These edges arealiased in the original views, discre te periodicsanples of non-bandli mited images. Another way ofviewing the probl em is that the edges are quantizedin the original views, quantized to the nine bitsof resolutio n available in X and Y. Clearly theproblem is much greater than in Z, where sixteenbits are available. Unfortunately, extra lateralresolutio n is purchased at square la w expense.Bandlimit ing the Z partit ion before sampling, if itwere practical, would not improve matters. Zvalues at the edges of the spheres would be a~nooth blend of the depth of the edge and the depthof the far clipping plane, meanin gless points asfar as the scene is concerned. The aliasing ef-fects observed are local, however, and it is rea-sonable to treat the smooth surfaces within theragged edges as correc tly sanpled. This asst~nptionimplies that a filter to reconstruc t the surfacebetween samples is in order. Indeed, interpolatin gthe Z values of the light source image to derive Zvalues at the exact X,Y coordinates of thetransformed observer points (rather than using theZ value of the nearest neighbor for comparison) im-proves matte rs somewhat, reducing shadow noise inthe form of isolated pixels.Treating shadow noise as a quantizin g rather thanan aliasing problem improves the image further.The error signal in a quantizing system correl atesquite strongly with the signal. Addition of randomnoise in the range of a single quant t~ breaks upthis correlation, reduces the resulting period ici-ties (moire) to which the hu~nan eye is so sensi-tive, and whitens the spectrt~n of the error. Fig-ure 4 illustrates the sphere shadows wit h increasednegative Z bias and bilinear interpolation of light

    source Z values to the X,Y of the transformed ob-server points, whi ch have been dithered by the ad-dition of normally distributed random values in therange -.5 to +.5. The shadow image is subsequ entlydejagged by an edge dequant izing filter similar toone advanced by Freeman [8], then low pass filteredto further smooth the contour s and merge the dith-ered edge of self shadowing (figure 5).As a final, not unimportant observation, figure 6illustrates that the problem of self shadowing sur-faces may not be terribly significa nt in practice.Figures 3 through 5 were of the computed shadowsalone; figure 6 display s the shaded surfaces withtheir shadows. Shading the spheres according tothe position of the light source casting the sha-dows causes a ~nooth shadow transition which ob-scures the quantiz ation error. In practic e,translucent shadows (their translucency correspond-ing to the additive "a~bient" term in most surfaceshading formulations) gener ally look better thandeep black shadows, and low pass filtering of theshadows before they are applied to the image sub-jectively approximates the soft penuabra cast byreal light sources.

    ConclusionsThe algorithn described operates successfully onscenes of curved surface patches, and does so witha cost that increases only linearly with the com-plexit y of the environment. The cost is roughl ytwice the cost of rendering the scene normally,plus the cost of transforming the points of theobserver 's image into the light source image. Inthe origin ally stated algorithm, the cost oftransformation increases linearly with the depthcomple xity of the scene. The cost of transforma-tion in a modified version of the algorithm whichperforms shadowing strictly as a post- process isfixed by the resoluti on of the screen, andcorresponds to a scene with an average depth com-plexi ty of one. The rendering cost is only "rough-ly" twice the cost of rendering the scene normally,since the light source view requires no shadingcomputation. Depending on the comple xity of theshading rules applied [9], this may represent asubstantial savings.Speed does not directly correspond to "computation-al expense" when special hardware can be applied.The enormous interest in real-time graphics has ledto the development of specialized transformationhardware, specifically, digital devices to mult iplyfour by four transform ation matric es by four ele-ment homogeneous point coordinates [i0]. The modi-fied versio n of the shadow algorithm, develop ed foranimation purposes, is parti cular ly suited to pipe-lining of the coordina te transforms. The intent atNYIT is to apply the Floating Point Systems API20-Barray processor to such problems.The comple xity of software necess ary to implementthe shadow algorithn is minimal if the necessarymemo ry is available. Althou gh it has long beensuggested that two passes of a visible surface al-gorithm is sufficient to compute shadowing [5],relating the data provided by the two passes isvery diffic ult for many algorithms. The Z-bufferprovides a straightforward means of relating datain different views since the visible surfaces arethree dimens ional and hen ce subject to general

    2 7 3

  • 7/31/2019 William.sig78

    5/5

    three dimensional transformations.The bright outlook for memory technology bo des wellfor mass-memor y graphics. The shadow algorithmdiscussed here is one simple example of a wideclass of extremely general algorithms which exhibitvery desirable cost growth properties. The chal-lenge of this approach to computer graphics is tocope successfully with the problems posed by thediscrete nature of image space scene representa-tions.

    [1]

    [2]

    [3]

    [4]

    [5]

    [6]

    [7]

    [8]

    [9]

    [10]

    ReferencesCatmull, E., "A Subdi visio nAlgo rithm for Com-puter Displ ay of Curved Surfaces," PhD.thesis, Dept. of Comput er Science, Univ ersit yof Utah, 1974.Newell, M. G., Newell, R. G., and Sancha, T.L., "A Solution to the Hidden Surface Prob-lem," Proceedings of the 1972 ACM NationalConference.Willian s, L., forthcomi ng PhD. thesis, Univer-sity of Utah.For the application of this representation toscene analysis, see: Levine, M. D., O'Handley ,D. A., and Yagi, G. M., "Computer Determ ina-tion of Depth Maps," Com puter Gr aphic s and Im-age Processing, No. 2, 1973.Crow, F. C., "Shadow Algor ithms for Compute rGraphics," Siggraph 1977 Proceedings, Vol. ii,No. 2, Simmer 1977.Blinn, J. F., "A Scan-Line Algorit~n for theDisplay of Bicubic Surface Patches," PhD.thesis, Dept. of Compute r Science, univ ersi tyof Utah, 1978.Crow, F. C., "The Aliasi ng Prob lem in

    Comput er-Synt hesize d Shaded Images ," PhD.thesis, Dept. of Compute r Science, univ ersit yof Utah, 1976.Freeman, H., "Computer Process ing of LineDrawing Images," ACM Comput ing Surveys, Vol.6, No. i, March 1974.Blinn, J. F., "Models of Light Reflect ion forComput er Synthe sized Pictures," Siggra ph 1977Proceedi ngs, Vol. ii, No. 2, Summer 1977.Sutherland, I.E., "A Head-Mounted Three-

    Dimens ional Display," Fall Joint Compute rConference 1968, Thompson Books, Washington,D.C., 757.

    fig. 7a3d smile sculpted by Alvy Ray Smith.

    fig. 7bevinces the shadow of a smile.

    fig. 8The robot casting his shadow on the wall and flooris compos ed of over 350 bicubic s urface patches.

    Especial thanks are due David DiFrancisco and Gar-land Stern for photog raphic assistance.

    27 4