“Specializing shaders” by Guenter, Knoblock and Ruf

  • ©Brian Guenter, Todd B. Knoblock, and Erik Ruf




    Specializing shaders



    We have developed a system for interactive manipulation of shading parameters for three dimensional rendering. The system takes as input user-defined shaders, written in a subset of C, which are then specialized for interactive use. Since users typically experiment with different values of a single shader parameter while leaving the others constant, we can benefit by automatically generating a specialized shader that performs only those computations depending on the parameter being varied; all other values needed by the shader can be precomputed and cached. The specialized shaders are as much as 95 times faster than the original user defined shader. This dramatic improvement in speed makes it possible to interactively view parameter changes for relatively complex shading models, such as procedural solid texturing.


    1. Andersen, Lars Ole. Self-applicable C Program Specialization. Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (San Francisco, California, June 12- 20, 1992). Yale University technical report YALEU/DCS/RR-909, 1992, 54-61.
    2. Andersen, Peter Holst. Partial Evaluation Applied to Ray Tracing. Unpublished manuscript, October 1994.
    3. Baier, Romana, Robert Gltick, and Robert Z6chling. Partial Evaluation of Numerical Programs in Fortran. Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (Orlando, Florida, June 25, 1994). University of Melbourne technical report 94/9, 1994, 119-132
    4. Demers, Alan J., Thomas Reps, and Tim Teitelbaum. Incremental Evaluation for Attribute Grammars with Application to Syntax-directed Editors. Proceedings of the Eighth Annual ACM Symposium on Principles of Programming Languages (Williamsburg, Virginia, January 1981), 105-116.
    5. Goad, Chris. Special Purpose Automatic Programming for Hidden Surface Elimination. Proceedings of SIGGRAPH 82 (Boston, Massachusetts, July 26-30, 1982). In Computer Graphics 16, 3 (July 1982), 167-178.
    6. Hanrahan, Pat. Ray Tracing Algebraic Surfaces. Proceedings of SIGGRAPH 83 (Detroit, Michigan, July 25- 29, 1983). In Computer Graphics 17, 3 (July 1983), 83-90.
    7. Hanrahan, Pat and Jim Lawson. A Language for Shading and Lighting Calculations. Computer Graphics 24, 4 (August 1990), 289-298.
    8. Hoover, Roger. Alphonse: Incremental Computation as a Programming Abstraction. Proceedings of the SIGPLAN ’92 Conference on Programming Language Design and Implementation (San Francisco, California, June 1992), 261-272.
    9. Jones, Neil D., Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, 1993.
    10. Mogensen, Torben. The Application of Partial Evaluation to Ray-Tracing. Master’s thesis, DIKU, University of Copenhagen, Denmark, 1986.
    11. Osgood, Nathaniel David. PARTICLE: an Automatic Program Specialization System for Imperative and Lowlevel Languages. Master’s thesis, MIT, September 1993.
    12. Pugh, William and Tim Teitelbaum. Incremental Computation Via Function Caching. Proceedings of the Sixteenth Annual ACM Symposium on Principles of Programming Languages (Austin, Texas, January 1989), 315-328.
    13. Ruf, Erik. Topics in Online Partial Evaluation. Ph.D. thesis, Stanford University, April 1993. Published as Stanford Computer Systems Laboratory technical report CSL-TR-93-563, March 1993.
    14. Sequin, Carlo H. and Eliot K. Smyrl. Parameterized Ray Tracing. Proceedings of SIGGRAPH 89 (Boston, Massachusetts, July 31-August 4, 1989). In Computer Graphics 23, 3 (July 1989), 307-314.
    15. Sundaresh, R.S. and Paul Hudak. A Theory of Incremental Computation and Its Application. Proceedings of the Eighteenth Annual ACM Symposium on Principles of Programming Languages (Orlando, Florida, January 1991), 1-13.
    16. Upstill, Steve. The RenderMan Companion. Addison- Wesley, 1989.
    17. Watkins, Christopher D., Stephen B. Coy, and Mark Finlay. Photorealism and Ray Tracing in C. M&T Books, 1992
    18. Watt, Alan and Mark Watt. Advanced Animation and Rendering Techniques. ACM Press, 1992.

ACM Digital Library Publication: