To appear in the ACM SIGGRAPH conference proceedings Shader Algebra
To appear in the ACM SIGGRAPH conference proceedings Shader Algebra
复制标题
DOI:
--
复制
发表时间:
2004
期刊:
影响因子:
--
通讯作者:
M. McCool;Stefanus Du Toit;T. Popa;Bryan Chan;K. Moule
中科院分区:
文献类型:
--
作者:
M. McCool;Stefanus Du Toit;T. Popa;Bryan Chan;K. Moule
Shaders can be thought of as functions that map streams to streams, where a stream consists of a sequence of homogeneous records or equivalently, a tuple of channels corresponding to record elements. A shader operates on each input record and generates output records independently. An algebra consists of a set of objects and a set of operators that act on those objects. To define a shader algebra, we treat shader functions as first-class objects and define two binary operators: connection and combination. Connection is defined as functional composition: the outputs of one shader are fed into the inputs of another. Combination concatenates the input channels, output channels, and computations of two shaders. Similar operators can be used to manipulate streams and apply computational kernels expressed as shaders to streams. Connecting a shader to a stream applies that shader to all elements of the stream; combining streams concatenates the record definitions of those streams. In conjunction with an optimizing compiler, these operators can manipulate shaders in many useful ways, including shader specialization, without modification of the source code of the original shaders. We demonstrate these operators in the context of Sh, a metaprogramming shading language embedded in C++. In this implementation, shaders and streams are represented with objects and the shader algebra operators are implemented with operator overloading. CR Categories: I.3.7 [Computer Graphics]: ThreeDimensional Graphics and Realism—Color, shading, shadowing, and texture