Unified Sampling 统一采样
Introduction
引言
A renderer achieves effects such as depth-of-field, motion blur and antialiasing by shooting multiple rays at each pixel from the camera. 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'.
渲染器通过在相机的每个像素上拍摄多条射线来实现诸如景深、运动模糊和反走样效果。这些射线被称为“初级射线”。当每个像素拍摄的主光线不够时,结果可能是噪声(“颗粒状”)或锯齿状的。然而,并不是图像的所有部分都需要相同数量的主射线!例如,一个快速移动的物体需要更多的主光线来获得平滑的运动模糊,而不是静止的。同样地,与焦点对象相比,离焦物体需要更多的光线来获得准确/平滑的景深。这意味着为屏幕上的所有像素拍摄相同数量的主光线是浪费的。每个像素拍摄相同数量的主光线称为“固定采样率”。固定抽样率与自适应抽样完全相反。
Unified sampling is an adaptive sampling technique which detects the parts of the image that are noisy/jaggy and automatically adjusts the number of primary rays for each pixel. This can speed up rendering considerably.
统一采样是一种自适应采样技术,它检测图像中有噪声或噪声的部分,并自动调整每个像素的主射线数目。这可以大大加快渲染速度。
Because unified sampling detects noise and stops rendering when a pixel is 'clean enough', a desirable byproduct is that it also benefits the performance and quality of other effects requiring multiple rays ('samples') such as:
因为统一的采样检测噪音,并在像素“足够干净”时停止渲染,一个理想的副产品是,它还有利于需要多条射线(“采样”)的其他效果的性能和质量,例如:
- Glossy reflections/refractions 光滑的反射/折射
- Brute-force GI 蛮力 GI
- Area lighting 区域照明
- Ambient occlusion 环境闭塞
In Redshift 3.0.11 'Automatic Sampling' was added as an optional sampling mode meant to simplify setup and automatically optimize the sample counts per-pixel. In this mode the only paramater that has any effect on sampling count is 'Adaptive Error Threshold.'
在红移3.0.11中,“自动采样”作为一个可选的采样模式被添加,以简化设置和自动优化每像素的采样计数。在这种模式下,唯一对采样次数有影响的参数是“自适应误差阈值”。'
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 at each pixel and then, if it still detects noise around that pixel, it will keep shooting more rays until the pixel is clean enough or if it reaches 'max samples' rays. If you're using depth of field or motion blur, we recommend using at least 8-16 'min samples'. Scenes containing strong depth of field or long motion blur might require a fairly high 'max samples', such as 256 or more.
这些是每个像素拍摄的主光线的最小和最大数目。红移将首先在每个像素上发射最小采样射线,然后,如果它仍然检测到该像素周围的噪声,它将继续发射更多的射线,直到该像素足够干净或者达到最大采样射线。如果你使用景深或运动模糊,我们建议使用至少8-16分钟的样本。包含强景深或长动态模糊的场景可能需要相当高的“最大采样”,如256或更多。
Adaptive Error Threshold
自适应误差阈值
This setting 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 setting. 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.
此设置控制噪声检测算法的灵敏度。较低的数字将更积极地探测噪声,这意味着每个像素将拍摄更多的光线,反之亦然。建议您使用“显示示例”特性来可视化此设置的效果。默认的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 noisy parts of the image will typically be brighter because the unified sampler will shoot more rays trying to clean up the noise. We'll demonstrate the effect below.
此选项启用调试呈现模式,该模式以灰度形式显示每个像素的射线数。较深的像素意味着射出的光线更少,而较亮的像素意味着射出的光线更多。纯白色意味着“最大样本”射线是为该像素拍摄的。当这种渲染模式启用时,图像的噪声部分通常会更明亮,因为统一的采样器会拍摄更多的光线,试图清除噪声。我们将在下面演示效果。
Don't automatically reduce samples of other effects
不要自动减少其他影响的样本
This option is described in more detail below. We do not recommend using this option. Redshift includes 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 in Redshift, 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.
诸如景深、动态模糊、蛮力 GI、光滑的反射/折射、 AO 和区域照明等技术共享一个共同的采样模式,在 Redshift 默认情况下,每帧都是一致的。当这些效果的样本计数不够高,噪音是可见的,噪音可能会出现在相机上卡住时,渲染一个动画。这会在视觉上分散注意力。启用“每帧上的随机模式”随机化每帧上的噪音模式,使噪音看起来更像移动的电视静态或电影颗粒。在某些情况下,这可以更具视觉吸引力。
How to use unified sampling
如何使用统一抽样
The optimal way of adjusting the unified sampling settings is this:
调整统一抽样设置的最佳方式是:
- Disable depth of field and motion blur and set min/max samples both to a low number such as 4 or 16. 禁用景深和运动模糊,并设置最小/最大采样值为低数目,如4或16
- 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 调整“数量样本”的蛮力的 GI,区域照明,光滑的反射/折射和 AO 等,直到你得到一个视觉上可接受的框架。请参阅'noise' documentation “噪音”文件 for more info. 了解更多信息
- 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. 将最小/最大采样量调整到能够产生干净结果的水平。通常这两种效应需要至少32个样本,然后往往需要多达200或更多
- Once happy with the result, reduce 'min samples' to 4 or 16 一旦对结果感到满意,将最小样本减少到4或16
- 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. 对“自适应误差阈值”进行轻微调整,直到你看不到景深上的纹理或运动模糊。默认的0.01设置应该适用于各种各样的场景,但是在某些场景中,您可能需要将其减少到0.003这样的值。我们建议使用“显示样本”来查看哪些像素需要最多的光线。理想情况下,图像中应该有不是纯白色的好部分。如果一切都是纯白的,这意味着要么场景确实是噪音的(由于景深或运动模糊) ,需要一个高’最大样本’设置或’自适应误差阈值’太低,可以提高一点
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!
我们在一个使用景深和运动模糊的简单场景上演示了上述过程。即使一点噪音通常是可以接受的,对于这个特殊的例子,我们将尝试生成一个近乎完美的图像。这将有助于证明,统一采样并不意味着“更快,但有更多的噪音”: 通过统一采样,有可能获得帧几乎100% 相同的固定速率采样和渲染更快!
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
Step1: 禁用动态模糊和景深。将每个样本的最小/最大值设置为4。我们使用默认的蛮力 GI 和物理太阳样本。在阴影中有明显的 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: 将缺省蛮力 GI 示例从16增加到256。这可以清除 GI 噪音,尤其是在阴影中(在白色瓷砖也有一点)
Step2B: Increase the physical sun shadow samples from 8 to 128. This clears the noise on the shadow silhouettes
步骤2b: 将太阳阴影的物理取样从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.
第三步: 启用景深和动态模糊。增加最小/最大采样直到景深和运动模糊看起来干净。对于这个例子,256个样本就足够了。这个画面在 GTX470上渲染了大约11秒。
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.
第四步: 将最小样本减少到16个。保持“自适应误差阈值”为0.01。在 GTX470上,帧看起来几乎和固定速率渲染一样好,只需8秒。场景需要更多的“最大样本”(因为,比如说,明亮但是嘈杂的运动模糊反射)将会得到更多的好处。
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.
这就是“演示样本”告诉我们的每像素花费了多少精力。失焦或严重运动模糊的图像部分需要更多的工作,以清理。
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 is gone.
如果一个最后期限迫在眉睫,你不能去你的场景周围调整区域光样品,材料光泽样品,AO 样品,等,你可以简单地增加统一采样的最大采样数量到一个高的数字,并减少一点自适应错误阈值。这样做将产生一个与上述方法几乎相同的框架-但可能需要更长的时间来渲染!这是因为你跳过了“帮助”渲染器的部分,告诉它在哪里集中精力-所以它将不得不盲目地不断拍摄主射线,直到噪音消失。
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,通常需要2000-4000蛮力 GI 射线,但用户,相反,留下默认的16蛮力射线设置,统一采样的“最大样本”将被提高到数千,以补偿!
For optimal performance, it is recommended that you tweak the individual 'num samples' settings, like suggested, instead of simply raising the unified 'max samples'.
为了获得最佳性能,建议您调整个别的“数量样本”设置,就像建议的那样,而不是简单地提高统一的“最大样本”。
How to use Automatic Sampling 如何使用自动采样
Automatic Sampling is a per-pixel sampling technique that simplifies sampling setup and tries to decide the optimized raytraced sample counts based on shader and scene parameters solely using Adaptive Error Threshold for control. Decreasing the 'adaptive error threshold' value improves render quality and reduces noise at the cost of render time, increasing the 'adaptive error threshold' value reduces render times at the cost of noise and render quality. In the example images below you can see how decreasing the 'adaptive error threshold' automatically increases the cocentration of samples counts where necessary resulting in a much cleaner image.
自动采样是一种逐像素采样技术,它简化了采样设置,并试图仅使用自适应误差阈值来控制基于着色器和场景参数的优化光线跟踪采样计数。降低“自适应误差阈值”可以提高渲染质量,降低噪音,代价是渲染时间,增加“自适应误差阈值”可以降低渲染时间,代价是噪音和渲染质量。在下面的示例图片中,您可以看到降低“自适应误差阈值”是如何自动增加样本计数的集中,从而在必要时得到一个更清晰的图像。
|
|
Beauty - Adaptive Error Threshold: 0.1 美观-自适应误差阈值: 0.1 |
Samples view - 0.1 样本查看 -0.1 |
|
|
Beauty - Adaptive Error Threshold: 0.01 美观-自适应误差阈值: 0.01 | Samples view - 0.01 样本查看 -0.01 |
Automatic Sampling has no impact on point cloud render elements or any other non-raytraced techique.
自动采样对点云渲染元素或任何其他非光线追踪技术没有影响。
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.
默认情况下,红移通过效果分发样本。它只有在“不自动减少其他效果的样本”选项被禁用时才会这样做。
To demonstrate what this 'sample distribution' (or 'sample reduction') means, let's consider a simple example.
为了演示这个“样本分布”(或“样本简化”)的含义,让我们考虑一个简单的例子。
In the pictures below, unified sampling has been configured with "min samples" and "max samples" to both be either 1 (on the lft) or 2 (on the right). This tells Redshift to shoot exactly 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 which is using 4 reflection samples. The reflection rays are colored red.
在下面的图片中,统一的抽样已经配置为“最小样本”和“最大样本”都是1(在左侧)或2(在右侧)。这告诉红移每个像素正好拍摄1或2个主光线。初级(照相机)射线是绿色的。现在,让我们假设这些主光线正在照射一种使用4个反射样本的光滑反射材料。反射光是红色的。
When 'Don't automatically reduce samples' is disabled, Redshift will attempt to shoot the user-desired number of reflection/refraction/GI/etc rays per pixel. It does that by dividing the number of reflection rays by the number of primary (unified) rays.
当禁用“不自动减少采样”时,红移将尝试每像素拍摄用户期望的反射/折射/GI/etc 光线数。它是用反射射线的数目除以基准射线的数目来实现的。
Redshift distributes reflection samples when "Don't automatically reduce samples of other effects" is disabled
当“不要自动减少其他效果的采样”被禁用时,红移会分发反射采样
When 'Don't automatically reduce samples' is enabled, this division no longer happens which makes Redshift shoot more reflection rays!
当“不要自动减少样本”被启用时,这种分裂不再发生,使红移发出更多的反射射线!
On the other hand, when "Don't automatically reduce samples of other effects" is enabled, no sample distribution/reduction happens
另一方面,当启用“不要自动减少其他效应的样本”时,不会发生样本分发/减少
Even though the above example mentions reflection samples, the same thing happens for all secondary ray types: brute-force GI, ambient occlusion, area lighting, reflection, refraction, etc.
即使上面的例子提到了反射样本,同样的事情也会发生在所有的次级光线类型上: 强力 GI、环境遮挡、区域照明、反射、折射等等。
Why is the sample distribution useful? Well, think of the following scenario: you tweaked your settings to perfection and all surfaces look nice and clean. Then the director walks in and asks for longer motion blurs or a stronger depth-of-field effect. Doing either of these two and maintaining the same visual quality means having to increase your primary rays. If Redshift didn't divide the samples, increasing the primary rays (to clean DOF or motion blur noise) would make the entire frame considerably slower to render!
为什么样本分布是有用的?那么,想想下面的场景: 你把设置调整到完美,所有的表面看起来都很好很干净。然后导演走进来,要求更长的运动模糊或更强的景深效果。做这两件事中的任何一件,并保持相同的视觉质量意味着必须增加你的主光线。如果红移不划分样本,增加主光线(清洁自由度或运动模糊噪声)将使整个画面渲染相当慢!
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.
当启用“不自动减少其他效应的样本”时,有两种方法进行统一抽样。
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".
第一,简单,方法是设置所有’数目样本’到1(为一切,包括胃肠,光泽,面积灯等) ,并让统一的采样照顾噪声只是拍摄更多的射线每像素。一些心理射线的使用者称这种技术为“暴力统一抽样”。
This technique is easy and can work in wide variety of scenes. In certain ways, it emulates what some 'unbiased' renderers do.
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.
这种技术很简单,可以在各种各样的场景中使用。在某些方面,它模仿了一些“无偏见”渲染器所做的事情。然而,如果某一特定效应(例如区域照明)产生了过量的噪音,统一的采样“最大样本”将不得不提高到500甚至更高的数值。再加上一个相当低的自适应误差阈值,可能会迫使像素采样过多,这可能对性能不利,特别是如果场景包含大量的反射折射。
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.
因此,下一个最好的选择是从非常低的样本开始(甚至可能只使用一个样本) ,但是稍微增加特别嘈杂效果的“数量样本”。例如,如果你光滑的反射是干净的,但暴力的 GI 仍然是噪音,你可以尝试轻微增加其’数目射线’从1个样本到2或4个样本。光泽、 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”选项有点困难,因为结果取决于场景设置,无论是性能方面还是视觉质量方面。有时候使用一个样本渲染所有效果会更有意义,而其他时候,一点点的效果调整可能是必要的。
赶快留个言打破零评论!~