首页 >> 大全

Real-Time Rendering——6

2023-12-25 大全 30 作者:考证青年

6.4 纹理动画

The image to a does not have to be . For , a video can be used as a that from frame to frame.

应用于表面的图像不必是静态的。例如,视频源 可用作逐帧变化的纹理。

The need not be , . The can the from frame to frame, in the mesh’s data or via in the or pixel . that a has been and that it has been with an image that looks like water. Say the v- is the of flow. To make the water move, one must an from the v- on each frame. from the has the of the to move .

纹理坐标也不必是静态的。应用程序设计人员可以在网格数据本身中或通过顶点或像素着色器中应用的函数来显式地更改帧与帧之间的纹理坐标。想象一下,一个瀑布已经被建模,并且已经用看起来像正在下落的水的图像对其进行了纹理处理。假设v坐标是流动的方向。要让水流动,必须在每一个连续的帧上从v坐标中减去一个量。从纹理坐标中减去具有使纹理本身看起来向前移动的效果

More can be by a to the .In to , this for such as zoom,, and [1192, 1904], image and [1729],and [638]. Many more can be by on the CPU or in .

通过将矩阵应用于纹理坐标,可以创建更精细的效果。除了平移,这允许线性变换,例如缩放、旋转和剪切[1192,1904],图像扭曲和变形变换[1729],以及广义投影[638]。通过在CPU或着色器中应用函数,可以创建更多精细的效果。

By using , one can other . For , by with a and in a flesh , one can make a come to life [1215].

通过使用纹理混合技术,可以实现其他动画效果。例如,从大理石纹理开始,然后淡入肉色纹理,就可以让雕像栩栩如生[1215]。

6.5 材料映射

A use of a is to a the . Real-world have that vary over their . To such , the pixel can read from and use them to the the .The that is most often by a is the color. This is known as an color map or color map. , any can be by a : it, it, or it in some other way. For , in 6.25 three are to a , the .

纹理的一个常见用途是修改影响着色方程的材质属性。现实世界中的物体通常具有随其表面而变化的材料属性。为了模拟这样的对象,像素着色器可以从纹理中读取值,并在评估着色方程之前使用它们来修改材质参数。纹理最常修改的参数是表面颜色。这种纹理被称为反照率颜色贴图或漫反射颜色贴图。然而,任何参数都可以被纹理修改:替换它,乘以它,或者以其他方式改变它。例如,在图6.25中,三种不同的纹理被应用到一个表面,取代了常量值。

6.25. and . On the right are the for color, ( is ), and bump map ( is ). (Image from three.js webgl [218].)

图6.25。金属砖和灰浆。右边是表面颜色、粗糙度(越浅越粗糙)和凹凸贴图高度(越浅越高)的纹理。(图片来自three.js示例webgl色调映射[218])。)

The use of in can be taken . of a in an , a can be used to the flow and of the pixel . Two or more with and could be to a by one which areas of the have which , code to be for each. As an , a with some rusty can use a to where the rust is , the rusty part of the based on that and the shiny metal ( 9.5.2).

材质的使用可以更进一步。纹理可以用来控制像素着色器本身的流程和功能,而不是修改方程中的参数。通过让一个纹理指定表面的哪些区域具有哪种材料,可以将具有不同着色方程式和参数的两种或多种材料应用于表面,从而为每个区域执行不同的代码。例如,具有一些生锈区域的金属表面可以使用纹理来指示生锈的位置,根据纹理查找有条件地执行着色器的生锈部分,否则执行闪亮金属着色器(第9.5.2节)。

model such as color have a to the final color from the . Thus, such can be with , and is . , such as or bump ( 6.7), a bit more care to avoid . that take of the can for such . These are in 9.13.

着色模型输入(如表面颜色)与着色器的最终颜色输出具有线性关系。因此,包含这种输入的纹理可以用标准技术过滤,并且避免了锯齿。包含非线性阴影输入的纹理,如粗糙度或凹凸贴图(6.7节),需要多加小心以避免走样。考虑到着色方程的过滤技术可以改善这种纹理的结果。这些技术将在9.13节中讨论。

关于我们

最火推荐

小编推荐

联系我们


版权声明:本站内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 88@qq.com 举报,一经查实,本站将立刻删除。备案号:桂ICP备2021009421号
Powered By Z-BlogPHP.
复制成功
微信号:
我知道了