diff --git a/13/README-ch.md b/13/README-ch.md index 541cfd3..ecaba1e 100644 --- a/13/README-ch.md +++ b/13/README-ch.md @@ -38,7 +38,7 @@ y *= amplitude*0.06; 现在,让我们把正弦波放在一边,想想 Perlin 噪声!Perlin 噪声的基本形式看起来和正弦波有点相似。它的振幅和频率有着某种变化,但振幅保持着合理的连续性,而且频率被限制在一个距离中心频率很小的范围内。尽管它不像正弦波那样规则,并且把几个不同缩放比例的 Perlin 噪声相加更容易制造出随机形态。把一些正弦波相加也是有可能制造随机形态的,但那需要很多不同的波叠加才能把他们的天生的周期性和规则形隐藏起来。 -通过在循环(循环次数为 *octaves*)中叠加噪声,并以一定的倍数(*lacunarity*,间隙度)连续升高频率,同时以一定的比例(*gain*,增益)降低 **噪声** 的振幅,最终的结果会有更好的细节。这项技术叫“分形布朗运动(fractal Brownian Motion)”(*fBM*),或者“分形噪声(fractal noise)”,最简单的实现如下: +通过在循环(循环次数为 *octaves*,一次循环为一个八度)中叠加噪声,并以一定的倍数(*lacunarity*,间隙度)连续升高频率,同时以一定的比例(*gain*,增益)降低 **噪声** 的振幅,最终的结果会有更好的细节。这项技术叫“分形布朗运动(fractal Brownian Motion)”(*fBM*),或者“分形噪声(fractal noise)”,最简单的实现如下:
-Another member of this family of algorithms is the **ridge**, where the sharp valleys are turned upside down to create sharp ridges instead: +这个算法家族中的另一个成员是**山脊**(ridge),就是把凹下去的山谷翻上来,从而制造山脊: ```glsl n = abs(n); // create creases @@ -96,16 +96,16 @@ Another member of this family of algorithms is the **ridge**, where the sharp va -Another variant which can create useful variations is to multiply the noise components together instead of adding them. It's also interesting to scale subsequent noise functions with something that depends on the previous terms in the loop. When we do things like that, we are moving away from the strict definition of a fractal and into the relatively unknown field of "multifractals". Multifractals are not as strictly defined mathematically, but that doesn't make them less useful for graphics. In fact, multifractal simulations are very common in modern commercial software for terrain generation. For further reading, you could read chapter 16 of the book "Texturing and Modeling: a Procedural Approach" (3rd edition), by Kenton Musgrave. Sadly, that book is out of print since a few years back, but you can still find it in libraries and on the second hand market. (There's a PDF version of the 1st edition available for purchase online, but don't buy that - it's a waste of money. It's from 1994, and it doesn't contain any of the terrain modeling stuff from the 3rd edition.) +这个算法的另外一个变种,把噪声分量乘起来(而不是叠加)可以创造一些很有用的东西。另外一个方法是,根据前一次循环中的噪声来缩放后续的噪声。当我们这样做的时候,我们已经走出严格的分形定义了,走入了一个叫“多重分形”的未知领域。多重分形虽不是按数学方式严格定义,但这并不意味着它的用处会更少些。 实际上,多重分形模拟生成地形中在商业软件中非常常见。要了解更多,你可以去读 Kenton Musgrave 的“Texturing and Modeling: a Procedural Approach”(第三版)的 16 章。很可惜,这本书几年前已经绝版,不过你还可以从图书馆和二手市场找到。网上有卖这本书第一版的 PDF 版,但是别去买——只是浪费钱。这是 1994 年的版本,不包括第三版包含的地形建模的部分。 ### 域翘曲(Domain Warping) -[Inigo Quiles wrote this other fascinating article](http://www.iquilezles.org/www/articles/warp/warp.htm) about how it's possible to use fBm to warp a space of a fBm. Mind blowing, Right? It's like the dream inside the dream of Inception. +[Inigo Quiles 写了另一篇有趣的文章](http://www.iquilezles.org/www/articles/warp/warp.htm),关于如何用 fBm 来扭曲 fBm 空间。很有意思,不是吗?这就像《盗梦空间》里的梦中梦。 ![ f(p) = fbm( p + fbm( p + fbm( p ) ) ) - Inigo Quiles (2002)](quiles.jpg) -A less extreme example of this technique is the following code where the wrap is used to produce this clouds-like texture. Note how the self-similarity property is still present in the result. +下面的代码展示了这项技术的一个不那么极端的例子,用它生成类似云一样的纹理。注意自相似性如何表现在结果中。
-Warping the texture coordinates with noise in this manner can be very useful, a lot of fun, and fiendishly difficult to master. It's a powerful tool, but it takes quite a bit of experience to use it well. A useful tool for this is to displace the coordinates with the derivative (gradient) of the noise. [A famous article by Ken Perlin and Fabrice Neyret called "flow noise"](http://evasion.imag.fr/Publications/2001/PN01/) is based on this idea. Some modern implementations of Perlin noise include a variant that computes both the function and it's analytical gradient. If the "true" gradient is not available for a procedural function, you can always compute finite differences to approximate it, although this is less accurate and involves more work. +用这种方法用噪声扭曲纹理坐标非常有用,非常有趣,也极难掌握。这是个很强大的工具,但要想用好它需要一些经验。一个有用的办法是,用噪声的导数(梯度)替换坐标。[Ken Perlin 和 Fabrice Neyret 的一篇非常著名的“流体噪声”](http://evasion.imag.fr/Publications/2001/PN01/)就是以这个想法为基础。一些现代的 Perlin 噪声的实现不但计算噪声,还计算它的解析梯度。如果“真实”梯度对过程化函数不变计算,你总是可以计算出数值梯度来逼近它,尽管没那么精确而且要花费更多工夫。