Three-Dimensional Rendering As a Tool in Science and Engineering
Total Page:16
File Type:pdf, Size:1020Kb
TECHNICAL NOTES ______________________________________________________ MATTHEW R. FEINSTEIN THREE-DIMENSIONAL RENDERING AS A TOOL IN SCIENCE AND ENGINEERING Specialized graphics hardware and standardized software libraries are making three-dimensional rendering a rapid and easy process. These advances have opened the way to using rendering to perform computations in short-wavelength scattering and propagation. INTRODUCTION As the power and capabilities of specialized computer libraries and the emergence of standards for 3D render graphics hardware have increased, computer-generated ing, have simplified the software interface between the three-dimensional (3D) renderings of objects and scenes programmer and the hardware. Trends in technology have have become remarkably realistic, acquiring complex brought high-powered graphics programming to nonspe textures, perspective, lighting, atmospheric effects, and cialists, allowing the use of graphics hardware and soft other characteristics that can all be varied in real time. ware for many scientific and engineering purposes. From the standpoint of a scientist or engineer, however, an imbalance exists between graphics capabilities and A CASE STUDY graphics uses: we can render 3D scenes and objects The broader availability and lower cost of graphics rapidly and realistically, but the considerable program tools lead one to ask when one should use advanced ming effort and computer power that go into producing graphics hardware and software for computations. The these effects contrast unfavorably with their limited (al trade-offs in performance, cost, and ease of operation are though commercially valuable) uses. illustrated by a recent case study. Recent trends nevertheless suggest that the computa A large, mature Fortran program was being used to tions underlying the entertaining graphics we see in render 3D scenes for a variety of analysis tasks. However, movies and video arcades will become useful in science the analyst using the program was unhappy with its per and engineering. Although specialized 3D graphics soft formance. Since the Fortran program was written for a ware and hardware have been available to graphics pro generic UNIX computer but was running on a Silicon fessionals for several years, the advances in technology Graphics (SGI) workstation, it was reasonable to propose that are lowering the cost, increasing the speed, and that the rendering task be done with the built-in SGI broadening the availability of personal computers are graphics hardware and graphics software libraries. This also putting sophisticated graphics tools on the desktops approach raised several questions. For example, what is of many scientists and engineers. the difference in performance between a generic program These tools have a broader utility than one might and one that uses specialized hardware and software? expect, since calculations repeatedly and quickly per What is the difference in performance between low-end formed in modem 3D rendering are very similar to com and high-end graphics workstations? putations done (or that would be done if they were not We answered these questions by writing a functional so arduous) in many technical problems. For example, a equivalent of the older Fortran program using the same classic difficult problem in short-wavelength scattering is input files. The new program produced the same output the effects of shadows and blockage of one object by files as the Fortran program but took advantage of the another, but computations of shadows, hidden surface sophisticated graphics software library known as the GL, removal, and viewable areas are easy and rapid with which comes with SGI computers. With the GL version modem graphics workstations. Similarly, the effects of in hand, the old and new programs could be compared nonuniform lighting, illumination and shadows on on various SGr computers at APL. curved surfaces, and averaging of multiple viewpoints of Table 1 lists the times taken to produce a scene with a scene involve difficult, time-consuming computations about 1 million facets for the two programs tested on that are part of the repertoire of advanced computer two SGI computers. One can see that rendering speed rendering techniques. depends strongly on computer cost, and, in particular, In the past, using dedicated computer graphics hard that a significant performance advantage exists for the ware for scientific computations would have required GL program, but it appears only at the high end of the specialized knowledge. Major improvements, such as cost spectrum. One notable finding not displayed in the the development of hardware- and vendor-independent table is that the GL program was at least an order 342 Johns Hopkins APL Technical Digest, Volume 15, Number 4 (1994) Table 1. Comparison of rendering speeds using two programs larger computation. In sum, we now have a new, simpler and two computers for a 1-million facet scene. way of doing computations that would previously have required a long-term, large-scale effort. Generic GL program time program time Computer (s) (s) REFERENCES SGI 4D/35 (low cost) 105 110 IOpenGL Architecture Review Board, OpenGL Reference Manual, Addison SGI Onyx (high cost) 30 5 Wesley, Reading, MA (1993). 20penGL Architecture Review Board, OpenGL Programming Guide, Addison-Wesley, Reading, MA (1993). 3 Graff, M. , PEXlib: A Reference Manual, Prentice-HaU, Englewood Cliffs, NJ (1994). of magnitude smaller and simpler than the older Fortran 4Womak, P. , PEXlib: A Tutorial, Prentice-Hall, Englewood Cliffs, NJ program. (1994). We have learned that rendering is a rather easy thing to do. This is a nontrivial lesson. One can expect that the cost and speed of a given computation will decrease over time, but one cannot expect that the computation will THE AUTHOR become simpler. MATTHEW R. FEINSTEIN re STANDARDS FOR 3D RENDERING ceived B.S. and M.Eng. degrees In the past year or two, candidates for standardized from Cornell University in engi neering physics in 1970 and rendering libraries have emerged. For example, the GL 1971 , respectively, and a Ph.D. in only exists on SGI machines; however, an initial version applied physics from Yale Uni of a vendor-independent GL, known as OpenGL, has versity in 1976. He is a physicist been developed. 1,2 Another example of a vendor-indepen in the STW/ASUW Missile Sys 3 tems Group in the APL Fleet dent rendering library is PEXlib. ,4 Systems Department and a mem The comparison of one rendering library to another is ber of the Senior Professional less significant than the trend toward standardization, Staff. Since joining APL in 1978, which can be expected to continue. Dr. Feinstein has worked on variational techniques in scatter ing theory, measurement and CONCLUSION modeling of polarization aberra- tion due to radomes, and develop "Three-dimensional rendering for the masses" is a re ment of multi port monopulse ra ality, and it is now easy to make this technology part of a dar algorithms. Johns Hopkins APL Technical Digest, Volume 15, Number 4 (1994) 343 .