Introduction简介

A renderer achieves effects such as depth-of-field, motion blur and antialiasing by shooting several rays out of each pixel. These rays are called 『primary rays』. When not enough primary rays are shot per pixel, the results can be noisy (『grainy』) or jaggy. However, not all parts of the image need the same number of primary rays! For example, a fast moving object needs more primary rays for smooth motion blur compared to a stationary one. Similarly, an out-of-focus object needs more rays for accurate/smooth depth of field compared to an in-focus one. This means that shooting the same number of primary rays for all pixels on the screen can be wasteful. Shooting the same number of primary rays per pixel is called 『fixed rate sampling』. Fixed rate sampling is the exact opposite of 『adaptive sampling』.

渲染器在对一些效果如景深、运动模糊和抗锯齿进行处理时,会从每一个像素发射很多采样射线,当每一个像素发射的Primary Rays(一级采样射线)不足时,渲染结果就会有噪点和锯齿。当然不是图片的每一部分都需要一样多的Primary Rays。例如渲染一个快速运动的物体可能要比渲染静止物体需要更多的Primary Rays来使运动模糊足够平滑。类似的,一个失焦物体相比实焦物体,也需要更多的Primary Rays来使景深模糊足够准确/平滑。这意味著为每一个像素发射相同多的采样射线比较低效。为每一个像素发射相同多的采样射线叫作限定采样,与其相对就是自适应采样。

Unified sampling is an adaptive sampling technique which detectsthe parts of the image that are noisy/jaggy and adjusts the number of primary rays accordingly – in a per pixel fashion. As a result, rendering takes less time. Furthermore, because unified sampling treats antialiasing, depth of field and motion blur together, is removes the need for separate controls for 「AA samples」, 「DOF samples」 and 「Motion blur samples」 which, in turn, simplifies the workflow.

Unified Sampling(统一采样)是一种自适应采样技术,这种技术通过判断画面中噪点/锯齿,自动调整每个像素的主采样射线数量。这样渲染会节省时间。由于自适应采样将抗锯齿、景深和运动模糊放在一起计算,所以无须单独控制诸如AA Samples、DOF Samples以及Motion Blur Samples等等采样参数。这样就简化了设置流程。

Because unified sampling detects noise and stops rendering when a pixel is 『clean enough』, a desirable byproduct is that it also benefits the performance of other multi-sample effects, such as:

因为Unified Sampling会在发现某一像素「足够干净」的时候停止渲染,因此这会给另外几种涉及多次采样的计算带来效率上的额外好处:

1、Glossy reflections/refractions 折/反射光泽

2、Brute-force GI 暴力GI

3、Area lighting 区域光

4、Ambient occlusion 环境遮挡

Settings设置

Min/Max Samples最小/最大采样

These are the minimum and maximum number of primary rays that will be shot per pixel. Redshift will initially shoot 『min samples』 rays for a given pixel and then, if it still detects noise around that pixel, it will shootmore rays until the pixel is clean enough or if it reaches 『max samples』 rays. If you』re using depth of field or motion blur, it』s recommended that you use at least 8-16 『min samples』. Scenes containing strong depth of field or longmotion blur might require a fairly high 『max samples』, such as 256.

最小和最大采样射线控制每一个像素发射一级采样射线的数量。Redshift先为每一个像素发射Min Sample所定义的数量,如果它检测在围绕这个像素的区域有噪点,它会发射更多的采样去清除噪点,最终直到Max Samples定义的数量。如果正在使用景深和运动模糊,建议使用至少8-16的Min Samples。如果要为场景营造景深的氛围或者使用大幅度的运动模糊,你需要提高Max Samples,比如用256。

Adaptive Error Threshold自适应错误阈值

This parameter controls how sensitive the noise detection algorithm will be. Lower numbers will detect noise more aggressively which means that more rays will be shot per pixel and vice-versa. It is recommended that you use the 『show samples』 feature to visualize the effect of this parameter. The default 0.01 value should work well for a variety of scenes. For production-quality results, we recommend lower settings such as 0.003.

这个参数控制演算法检测Noise的敏感程度,值越小对噪点的检测就越敏感,这就意味著每个像素需要反射更多的采样射线,建议你勾选Show Samples来显示出这个参数的效果。默认值0.01适用于大多数场景。对于产品级别的渲染,我们推荐使用更低的数值。比如0.003。

Show Samples显示采样

This option enables a debug rendering mode which shows the numbers of rays that were shot for each pixel in a grayscale form. Darker pixels mean that fewer rays were shot while brighter pixels mean that more rays were shot. A pure white color means that 『max samples』 rays were shot for that pixel. When this rendering mode is enabled, the noisier parts of the scene will be brighter – depending on the 『adaptive error threshold』 parameter. We』ll demonstrate the effect below.

调试渲染模式用灰度模式显示出每一个像素发射的一级采样射线的数量。暗的地方意味著发射的采样射线很少,亮的地方意味著发射的采样射线很多。纯白色意味著发射的采样射线达到Max Samples定义的最大值。开启这种渲染模式后,场景中的噪点区域会比别的地方亮,这是受「Adaptive Error Threshold」所控制的。我们将在下面的例子中看到这一点。

Don』t automatically reduce samples of other effects不自动降低其它效果的采样射线

We recommend not using this option. Redshift contains it solely for the benefit of users coming from other renderers. This option might be deprecated in the future.

我们并不推荐使用这个功能。Redshift提供这一功能为的是满足以前使用其他渲染器的用户。在将来的版本中,这一功能会在未来的版本中去掉。

Randomize Pattern On Each Frame随机打乱每帧的采样点

Techniques such as depth of field, motion blur, brute-force GI, glossy reflections/refractions, AO and area lighting share a common sampling pattern which, by default, is consistent per-frame. When the sample counts for these effects are not high enough and noise is visible, noise can appear to be 『stuck』 on the camera when rendering an animation. This can be visually distracting. Enabling 「Randomize Pattern On Each Frame」 randomizes the noise pattern on each frame which makes the noise look more like moving TV static or film grain. This, in some cases, can be more visually appealing.

景深模糊,运动模糊,Brute-force GI,折反射光泽,AO和区域灯光,这些演算法会使用相同的采样模式。默认情况,采样点在每一帧的分布都一样。当这些演算法使用采样率不够时会有噪点。在渲染动画时噪点可能会「钉」在画面的某个位置。对于画面而言,这是可能的瑕疵。开启Randomize Pattern ON Each Frame会在每一帧全使用不同的采样点,从而使噪点在每一帧出现的位置不同,看起来更像是电视干扰或者电影胶片的颗粒。相对而言,这样的噪点稍好一些。

How to useunified sampling 怎样使用Uinified Sampling

Important 重要提示

The following instructions should only be used when 「Don』t automatically reduce samples」 is disabled! Near the end of this document is a separate section discussing the 「don』t automatically reduce samples」 option.

下面是的内容是针对关闭「Don』t automatically reduce samples」时要采取的步骤。这篇文档的结尾部分有一个单独的章节讨论Don』t automatically reduce Samples功能

The optimal way of adjusting the unified sampling parameters is this:理想中Unified

Sampling参数的调整方法如下

1. Disable depth of field and motion blur and set min/max samples both to a low number such as 4 or 16.

取消景深模糊和运动模糊,同时设置Min/Max Samples为4或者16.

2. Adjust 『num samples』 of brute-force GI, area lighting, glossy reflection/refractions and AO etc until you get a visually acceptable frame. Please refer to the 『noise』 documentation for more info.

调节Brute-Force GI、区域光、折反射光泽和AO等等中的「Num Samples」,直到所得的渲染图片质量可以接受。

3. Re-enable depth of field andmotion blur and raise both min/max samples to a level that produces clean results. Typically these two effects require at least 32 samples and then can often require as many as 200 or more.

重新开启景深模糊和运动模糊,提高Min/Max Samples的参数,使得图片渲染结果相对平滑。通常这两个模式开启后,需要采样参数至少是32,有时甚至需要200以上的采样次数。

4. Once happy with the result, reduce 『min samples』 to 4 or 16

如果对结果比较满意,那么将Min Samples降低到4或者16。

5. Make slight adjustments to『adaptive error threshold』 until you see no grain on depth of field or motion blur. The default 0.01 setting should work on a wide variety of scenes but it』s possible that, on certain scenes, you might need to reduce it to a value like 0.003. We recommend using 『show samples』 to see which pixels require the most rays. Ideally, there should be good parts of the image that are not solid-white. If everything comes back as solid white, this means that either the scene is indeed noisy (due to DOF or motion blur) and needs a high 『max samples』 setting or that the 『adaptive error threshold』 is too low and could be raised a bit.

微调Adaptive Error Threshold,直到景深模糊和运动模糊不再出现颗粒感。默认值0.01能满足绝大部分情况,但有些时候,可能需要将这个值设定到0.003。我们建议开启Show Samples来观察那些区域需要更多采样射线。理想情况是图片中应该有大面积区域不是纯白色。如果整个图片区域都是纯白,那意味著这个场景的噪点级别比较高(受景深和运动模糊影响),需要很大的「Max Samples」数值,要不然就是「Adaptive Error Threshold」设定太低,需要提高。

We demonstrate the above process on a simple scene that uses both depth of field and motion blur. Even though a bit of noise is usually acceptable, for this particular example we』ll attempt to produce a near-flawless image. This will help demonstrate that unified sampling does not mean 『faster but with more noise』: with unified sampling it』s possible to get frames that are almost 100% identical to fixed-rate sampling and rendered faster!

我们将通过一个包含景深模糊的简单场景来展示上面和过程。尽管有一些点噪点。这样就可以间接说明Unified Sampling并非是一种「为了提高速度而向噪点妥协」的策略:通过使用Unified Sampling,我们可以用更快的速度到与固定采样率(Fixed-Rate)渲染完全相同的结果。

First, let』s see the final frame we』d like to produce:首先我们来看一下需要最终渲染聘为的图片质量

Final Desired Image最终所在达到的效果图片。

Step1: Disable motion blur and depth of field. Set min/max samples to 4 each. We are using defaults for brute-force GI and the physical sun samples. There』s evident GI noise in the shadows and the sunlight shadow silhouettes are also noisy

步骤1:取消运动模糊和景深模糊。将Min/Max Samples都设置到4。我们使用Brute-Force GI和Physical Sun Shadow的默认采样设置。很显然,图片中的GI和阳光的阴影轮廓中都有很多噪点。

Step2A: Increase the default brute-force GI samples from 16 to 256. This clears GI noise which is especially visible in the shadows (and a little bit in the white tiles too)

步骤2A:将默认Brute-Force GI采样从16增加到256。从而将阴影内部(白方块中也有一些)的噪点去除一些。

Step2B: Increase the physical sun shadow samples from 8 to 128. This clears the noise on the shadow silhouettes

步骤2B:将Physical Sun Shadow Samples从8提高到128。这将去除阴影轮廓中的噪点。

Step 3: Enable depth of field and motion blur. Increase both min/max samples until depth of field and motion blur look clean. For this example, 256 samples were enough. This frame rendered in about 11 seconds on a GTX470.

步骤3:打开景深模糊和运动模糊。将Min/Max Samples同时提高,直到景深模糊和运动模糊都是干净的。比如,这里256就够了。这一帧的渲染时间是11秒,显卡是GTX470。

Step 4: Reduce min samples to 16. Leave the 『adaptive error threshold』 to 0.01. Frame looks nearly as good as with fixed rate and rendered in 8 seconds on a GTX470. Scenes requiring even more『max samples』 (because of, say, bright-but-noisy motion blurred reflections)would have benefited even more.

步骤4:将Min Samples降低到16.Adaptive Error threshold仍保持0.01.图片看起来渲染效果与使用固定采样率相同,但相同的硬体GTX470只需要8秒。如果场景渲染需要更多Max Samples(因为要渲染高亮有噪点的运动模糊反射),那么这种方法的效率会更高。

And this is what 『show samples』 tells us about how much effort was spent per-pixel. The out-of-focus or heavily motion blurred parts of the image required more work to clean up.

这张图片显示的是Show Samples开启的效果。从中可以看到每个像素所用到的采样数量。要实现很浅的景深以及很强的运动模糊,渲染图片上的模糊区域需要进一步调整来清除噪点。

If a deadline is looming and you cannot afford to go around your scene adjusting area light samples, material gloss samples, AO samples, etc,you can simply increase unified sampling』s 『max samples』 to a high number and reduce 『adaptive error threshold』 a bit. Doing so will produce a nearly identical frame as with the method described above - but it could take longer to render! This is because you skipped the part of 『helping』 the renderer by telling it where to focus the effort - so it will have to blindly keep shooting primary rays until the noise isgone.

假如项目时间紧迫,你没有时间去调整区域光采样、材质光泽采样、AO采样等等,那么只需要直接将Unified Sampling中的Max Samples提高,并且稍微降低一些Adaptive error threshold即可。这种方法与通过上面讲述的调整方法所得到的渲染图片效果几乎是相同的。但是渲染时间可能会长一些。这是因为你没有尝试告诉渲染器应该将渲染采样资源集中到那些区域,因而渲染器只是盲目的不断增加采样射线,直到去除噪点。

How much slower the result will be (compared to the suggested method) depends on how noisy the scene is. If the scene contains very-difficult-to-clean GI which would normally need 2000-4000 brute-force GI rays but the user, instead, left the default 16 brute-force rays setting, unified sampling』s 『max samples』 would have to be raised into the thousands in order to compensate!

渲染速度(对比使用上面介绍的方法)究竟会降低多少取决一场景本身和噪点状况。如果场景中的GI噪点本身就很多,可能需要Burte-Force GI提供2000-4000的采样射线。如果场景中的GI噪点本身就很多,可能需要Brute-Force GI短提供2000-4000的采样射线。如果你不调整Brute-Force采样的默认值16,就需要在Unified Sampling的Max Samples中将数值调整到几千来平衡。

For optimal performance, it is recommended that you tweak the individual 『num samples』 settings, like suggested, instead of simply raising the unified 『max samples』.

如果希望提高渲染效率,还是推荐使用上面的方法来调整每个演算法各自的Num Samples设置,而不是简单地提高全局Max Samples。

What 「Don』t automatically reduce samples of other effects」 does 不要自动为其他类型降低采样率的作用是什么?

By default, Redshift distributes samples across effects. It only does that when 「don』t automatically reduce samples of other effects」 option is disabled.

Redshift默认会在各种渲染采样过程中分配全局采样。但前提是用户必须取消「don』t

automatically reduce samples of other effects」

To demonstrate what this 『sample distribution』 (or 『sample reduction』) means, let』s consider a simple example.

让我们来看一个简单的例子来的展示「采样分配」(或者成为优化采样)的作用。

In the scene shown below, unified sampling has been configured with 「min samples」 and 「max samples」 to be either 1 or 2. This means 「shoot 1 or 2 primary rays per pixel」. The primary (camera) rays are colored green. Now, let』s assume that these primary rays are hitting a glossy reflective material that』s using 4 reflection samples. The reflection rays are colored red.

在下面的场景中,Unified Sampling中Min Samples和Max Samples分别设置为1和2。也就是说,每像素发射1或者2条Primary Rays (主采样射线)。Primary Rays(相机采样)用绿色显示。现在让我们假设这些主采样射线将遇到使用采样率为4的磨砂反光材质。反射采样射线用红色显示。

As it can be seen, in both cases, there are a total of 4 reflection rays per pixel. This is because Redshift distributes the reflection rays across the primary rays.

可以看到,两种情况下,每个像素的反射采样射线都是4条,因为Redshift的反射采样是从主采样射线中分出去的。

Redshift distributes reflection samples when 「Don』t automatically reduce samples of other effects」 is disabled

只要关闭「Don』t automatically reduce samples of othereffects」,Redshift就会分配反射采样。

On the other hand,when「Don』t automatically reduce samples of other effects」is enabled,No sample distribution/reduction happens

另一方面,假如开启Don』t automatically reduce samples of other effects

Even though above we showed reflection samples, the same distribution/reduction (or not) happens for all secondary ray types: brute-force GI, ambient occlusion, area lighting, reflection, refraction, etc.

以上的例子我们只展示了反射采样的情况,实际上这种采样分配(或者优化)也同样会反生在其他二级采样射线类型的过程中:如Brute-Force、AO、区域光、反射、折射等等。

Why is the sample distribution useful? Well, think of the following scenario: you have your scene ready with all the settings tweaked to perfection. Then the director walks in and asks for longer motion blur or a stronger depth –of-field effect. Doing either of these and maintaining the same visual quality means increasing your primary rays. While (say) 128 samples might have worked well for your previous depth of field effect, you might find yourself having to use 512 unified samples or more. That would directly translate into a render time that is 4 times slower than before.

为什么分配采样是很有用的呢?请考虑这种情况:你已经将场景中所有的参数设定完美。然后导演走过来,要求加强运动或者景深模糊,你也许只能使用512或者更高的Unified Samples。这会导致渲染时间比之前慢4倍。

By distributing/reducing the number of other effects, Redshift ensures that you can afford increasing the unified samples without making your entire rendering time that many times slower!

通过拆分或降低其它效果的采样数,Redshift可以在满足更高的Unified Samples设定的前提下,不至于让整个渲染时间完全按比例增加。

How to use when 「Don』t automatically reduce samples of other effects」 is enabled 开启时如何调整

There are two ways of doing unified sampling when 「Don』t automatically reduce samples of other effects」 is enabled.

在开启Don』t automatically reduce samples of other effects时,可以用两种方法设置Unified Sampling。

The first, easy, way is to set all 『num samples』 to 1 (for everything, including GI, glossy, area lights, etc) and let unified sampling take care of noise by simply shooting more rays per pixel. Some Mental Ray users refer to this technique as 「brute-force unified sampling」.

首先第一种,也是最容易的一种,是将所有Num Samples设为1(每种采样都设为1,包括GI、Glossy、区域光等等),然后让Unified Sampling来负责觉得究竟使用多少采样才能取消噪点。一些Mental Ray用户将这种技术称为「暴力全局采样(Brute-Force unified Sampling)」

This technique is easy and can work in wide variety of scenes. In certain ways, it emulates what some 『unbiased』 renderers do.

这一技术使用主便,而且适合很多场景。某种意义上说,他模仿了无偏(unbiased

)渲染器的行为

However, if a particular effect (say, area lighting), is producing an excessive amount of noise, the unified sampling 『max samples』 will have to be raised to a high value such as 500 or even more. This, combined with a fairly low adaptive error threshold might force excessive pixel sampling which can be bad for performance, especially if the scene contains a lot of reflections of refractions.

但是某中一种特殊的渲染过程(就是区域光采样)会制造很多的噪点,此时Unified Sampling中的Max Sampling必须要设定得非常高,比如500甚至更高。如果这种情况下,Adaptive

Error Threshold还设定得相当小的话,可能会让渲染器不得不在每像素均发射大量的采样光线,从而对整体渲染效率产生极大的影响。如果场景还包括反射、折射的话,情况就更为严重。

So, the next best option is to start with very low samples for everything (maybe even use only 1 sample) but slightly increase 『num samples』of particularly noisy effects. For example, if your glossy reflections are clean but brute force GI is still noisy, you can try slightly increasing its『num rays』 from 1 sample to 2 or 4 samples. The cleaner the glossy, GI and lighting results are, the less work the unified sampling will have to do.

因此,第二种最佳的方法应运而生。先将所有采样值设定得很低(比如说还是1),但有针对性的将某些效果中的采样率提高一些。比如说光泽反射效果已经很干净,但Brute-Force GI 仍然有噪点,那么将它的「Num Rays」设定为2或者4即可。换句话说,Glossy、GI以及灯光采样结果越干净,全局采样所要做的就越少。

However, it』s a bit hard to suggest a solid workflow with the「Don』t automatically reduce samples of other effects」 option enabled as the results are dependent on the scene setup, both performance-wise and visual-quality-wise. Sometimes it』ll make more sense to render with 1 sample for all effects while, other times, a bit of per-effect tweaking might be necessary.

话虽如此,希望在打开「Don』t automatically reduce samples of other effects」后设定合理的参数依然没有一个十全十美的固定方法。因为对于每种类型的场景,结果可能是不一样的。要么效率优先,要么质量优先,需要权衡。有时使用全部采样设为1的方法合适,有时有针对性的每种采样设置中调整比较好。


推荐阅读:
相关文章