To appear in the ACM SIGGRAPH conference proceedings Shader Algebra

To appear in the ACM SIGGRAPH conference proceedings Shader Algebra
复制标题

DOI:
--
复制
发表时间:
2004
期刊:
ACM Transactions on Graphics (TOG)
影响因子:
--
通讯作者:
M. McCool;Stefanus Du Toit;T. Popa;Bryan Chan;K. Moule
M. McCool;Stefanus Du Toit;T. Popa;Bryan Chan;K. Moule
中科院分区:
其他
文献类型:
--
作者:
M. McCool;Stefanus Du Toit;T. Popa;Bryan Chan;K. Moule

文献摘要

被引文献

相似文献

着色器可以被视为将流映射到流的函数,其中流由一系列同质记录组成,或者等效地由与记录元素对应的通道元组组成。着色器对每个输入记录进行操作并独立生成输出记录。代数由一组对象和一组作用于这些对象的运算符组成。为了定义着色器代数,我们将着色器函数视为第一类对象,并定义两个二元运算符:连接和组合。连接被定义为功能组合:一个着色器的输出被馈送到另一个着色器的输入。组合连接两个着色器的输入通道、输出通道和计算。类似的运算符可用于操作流并将表示为着色器的计算内核应用于流。将着色器连接到流会将该着色器应用到流的所有元素;组合流连接这些流的记录定义。与优化编译器结合使用,这些运算符可以通过许多有用的方式操作着色器,包括着色器专门化,而无需修改原始着色器的源代码。我们在 Sh(一种嵌入 C++ 中的元编程着色语言)的上下文中演示了这些运算符。在此实现中,着色器和流用对象表示,着色器代数运算符通过运算符重载实现。 CR 类别:I.3.7 [计算机图形]:三维图形和写实主义——颜色、阴影、阴影和纹理
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