当前位置:   article > 正文

Real-Time Rendering——6.3 Procedural Texturing程序纹理_程序纹理是实时渲染吗

程序纹理是实时渲染吗

Given a texture-space location, performing an image lookup is one way of generating texture values. Another is to evaluate a function, thus defining a procedural texture.

给定纹理空间位置,执行图像查找是生成纹理值的一种方式。另一个是求一个函数的值,从而定义一个过程纹理。

Although procedural textures are commonly used in offline rendering applications, image textures are far more common in real-time rendering. This is due to the extremely high efficiency of the image texturing hardware in modern GPUs, which can perform many billions of texture accesses in a second. However, GPU architectures are evolving toward less expensive computation and (relatively) more costly memory access. These trends have made procedural textures find greater use in real-time applications.

虽然程序纹理通常用于离线渲染应用程序,但图像纹理在实时渲染中更常见。这是由于现代GPU中图像纹理硬件的极高效率,每秒钟可以执行数十亿次纹理访问。然而,GPU架构正朝着更便宜的计算和(相对)更昂贵的内存访问发展。这些趋势使得程序纹理在实时应用中有了更大的用途。

Volume textures are a particularly attractive application for procedural texturing,given the high storage costs of volume image textures. Such textures can be synthesized by a variety of techniques. One of the most common is using one or more noise functions to generate values [407, 1370, 1371, 1372]. See Figure 6.24. A noise function is often sampled at successive powers-of-two frequencies, called octaves. Each octave is given a weight, usually falling as the frequency increases, and the sum of these weighted samples is called a turbulence function.

考虑到体积图像纹理的高存储成本,体积纹理对于程序纹理是特别有吸引力的应用。这种纹理可以通过多种技术合成。最常见的一种是使用一个或多个噪声函数来生成值[407,1370,1371,1372]。参见图6.24。噪声函数通常以连续的2的幂频率进行采样,称为倍频程。每个倍频程都有一个权重,通常随着频率的增加而下降,这些加权样本的总和称为湍流函数。

Figure 6.24. Two examples of real-time procedural texturing using a volume texture. The marble on the left is a semitransparent volume texture rendered using ray marching. On the right, the object is a synthetic image generated with a complex procedural wood shader [1054] and composited atop a real-world environment. (Left image from the shadertoy “Playing marble,” courtesy of St´ephane Guillitte. Right image courtesy of Nicolas Savva, Autodesk, Inc.) 

图6.24。使用体积纹理的实时程序纹理的两个例子。左侧的大理石是使用光线行进渲染的半透明体积纹理。在右边,该对象是用复杂的程序性木材着色器[1054]生成的合成图像,并合成在真实世界环境的顶部。(左图来自shadertoy“玩弹珠”,由圣伊法内·吉利特提供。右图来自Nicolas Savva,Autodesk,Inc .)

Because of the cost of evaluating the noise function, the lattice points in the three-dimensional array are often precomputed and used to interpolate texture values. There are various methods that use color buffer blending to rapidly generate these arrays [1192]. Perlin [1373] presents a rapid, practical method for sampling this noise function and shows some uses. Olano [1319] provides noise generation algorithms that permit trade-offs between storing textures and performing computations. McEwan et al. [1168] develop methods for computing classic noise as well as simplex noise in the shader without any lookups, and source code is available. Parberry [1353] uses dynamic programming to amortize computations over several pixels to speed up noise computations. Green [587] gives a higher-quality method, but one that is meant more for near-interactive applications, as it uses 50 pixel shader instructions for a single lookup. The original noise function presented by Perlin [1370, 1371, 1372] can be improved upon. Cook and DeRose [290] present an alternate representation, called wavelet noise, which avoids aliasing problems with only a small increase in evaluation cost. Liu et al. [1054] use a variety of noise functions to simulate different wood textures and surface finishes. We also recommend the state-of-the-art report by Lagae et al. [956] on this topic.

由于评估噪声函数的成本,三维阵列中的格点通常被预先计算并用于内插纹理值。有多种方法使用颜色缓冲混合来快速生成这些阵列[1192]。Perlin [1373]提出了一种快速、实用的噪声函数采样方法,并给出了一些应用。Olano [1319]提供了噪声生成算法,允许在存储纹理和执行计算之间进行权衡。McEwan等人[1168]开发了无需任何查找即可在着色器中计算经典噪声和单纯形噪声的方法,并且提供了源代码。Parberry [1353]使用动态编程将计算分摊到几个像素上,以加速噪声计算。Green [587]提供了一种更高质量的方法,但它更适用于接近交互的应用程序,因为它使用50个像素着色器指令进行一次查找。Perlin [1370,1371,1372]提出的原始噪声函数可以改进。Cook和DeRose [290]提出了另一种表示方法,称为小波噪声,它避免了混叠问题,仅略微增加了评估成本。刘等人[1054]使用各种噪声函数来模拟不同的木材纹理和表面光洁度。我们还推荐Lagae等人[956]关于该主题的最新报告。

Other procedural methods are possible. For example, a cellular texture is formed by measuring distances from each location to a set of “feature points” scattered through space. Mapping the resulting closest distances in various ways, e.g., changing the color or shading normal, creates patterns that look like cells, flagstones, lizard skin,and other natural textures. Griffiths [602] discusses how to efficiently find the closest neighbors and generate cellular textures on the GPU.

其他程序方法也是可能的。例如,通过测量从每个位置到散布在空间中的一组“特征点”的距离来形成细胞纹理。以各种方式映射产生的最近距离,例如,改变颜色或阴影法线,创建看起来像细胞、石板、蜥蜴皮和其他自然纹理的图案。Griffiths [602]讨论了如何有效地找到最近的邻居并在GPU上生成细胞纹理。

Another type of procedural texture is the result of a physical simulation or some other interactive process, such as water ripples or spreading cracks. In such cases,procedural textures can produce effectively infinite variability in reaction to dynamic conditions.

另一种类型的程序纹理是物理模拟或其他交互过程的结果,如水波纹或蔓延的裂缝。在这种情况下,程序纹理可以在对动态条件的反应中有效地产生无限的可变性。

When generating a procedural two-dimensional texture, parameterization issues can pose even more difficulties than for authored textures, where stretching or seam artifacts can be manually touched up or worked around. One solution is to avoid parameterization completely by synthesizing textures directly onto the surface. Performing this operation on complex surfaces is technically challenging and is an active area of research. See Wei et al. [1861] for an overview of this field.

当生成程序性二维纹理时,参数化问题可能会比创作的纹理带来更多的困难,在创作的纹理中,可以手动修改或处理拉伸或接缝伪影。一种解决方案是通过直接在表面上合成纹理来完全避免参数化。在复杂的表面上进行这种操作在技术上具有挑战性,并且是一个活跃的研究领域。参见Wei等人[1861]对该领域的概述。

Antialiasing procedural textures is both harder and easier than antialiasing image textures. On one hand, precomputation methods such as mipmapping are not available, putting the burden on the programmer. On the other, the procedural texture author has “inside information” about the texture content and so can tailor it to avoid aliasing. This is particularly true for procedural textures created by summing multiple noise functions. The frequency of each noise function is known, so any frequencies that would cause aliasing can be discarded, actually making the computation less costly. There are a variety of techniques for antialiasing other types of procedural textures [407, 605, 1392, 1512]. Dorn et al. [371] discuss previous work and present some processes for reformulating texture functions to avoid high frequencies, i.e., to be band-limited.

抗锯齿程序纹理比抗锯齿图像纹理更难也更容易。一方面,预计算方法(如mipmapping)不可用,给程序员增加了负担。另一方面,程序纹理作者拥有关于纹理内容的“内部信息”,因此可以对其进行裁剪以避免走样。对于通过对多个噪波函数求和而创建的程序纹理来说尤其如此。每个噪声函数的频率都是已知的,因此可以丢弃任何会导致混叠的频率,从而降低计算成本。有多种技术可以反走样其他类型的程序纹理。Dorn等人[371]讨论了之前的工作,并提出了一些重构纹理函数的过程,以避免高频,即限制频带。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/108309
推荐阅读
相关标签
  

闽ICP备14008679号