Redshift Unified Sampling一并采样

海田1 发表于 2022-7-26 10:49 | 显示全部楼层 |阅读模式

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 detects the 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 环境遮挡


Redshift Unified Sampling一并采样-1.jpg
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.

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 and motion 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最终所在到达的效果图片。

Redshift Unified Sampling一并采样-2.jpg

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和阳光的阴影轮廓中都有很多噪点。

Redshift Unified Sampling一并采样-3.jpg

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。从而将阴影内部(白方块中也有一些)的噪点去除一些。

Redshift Unified Sampling一并采样-4.jpg

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。这将去除阴影轮廓中的噪点。

Redshift Unified Sampling一并采样-5.jpg

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(因为要渲染高亮有噪点的运动模糊反射),那么这种方案的效率会更高。

Redshift Unified Sampling一并采样-7.jpg

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开启的效果。从中能够看到每个像素所用到的采样数量。要实现很浅的景深以及很强的运动模糊,渲染图片上的模糊区域需要进一程序整来肃清噪点。

Redshift Unified Sampling一并采样-8.jpg

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.

Redshift Unified Sampling一并采样-9.jpg

Redshift distributes reflection samples when “Don’t automatically reduce samples of other effects” is disabled只要关闭“Don’t automatically reduce samples of other effects”,Redshift就会分配反射采样。

When 'Don't automatically reduce samples' is enabled, this division no longer happens which makes Redshift shoot more reflection rays!
当“Don't automatically reduce samples”被启用时,这个分割不再发生,使Redshift发射更多的反射采样射线!

Redshift Unified Sampling一并采样-10.jpg

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.

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的方案适宜,有时有针对性的每种采样设置中调整比较好。
您需要登录后才可以回帖 登录 | 立即注册



菜鸟C4D推荐上一条 /9 下一条


( 浙ICP备13033195号-2 )Copyright 2013-2022;菜鸟C4DPowered by Discuz! 技术支持:菜鸟C4D