Tessellation And Displacement 细分和置换
Introduction 引言
Tessellation is a computer graphics technique that can make a coarse, low-polygon mesh render smooth. This is achieved through polygonal subdivision, which happens at render-time. Working with low-polygon meshes and letting Redshift do the subdivision during rendering has certain advantages:
细分是一种计算机图形学技术,可以使一个粗糙,低多边形网格渲染平滑。这是通过多边形细分实现的,细分发生在呈现时间。使用低多边形网格并让红移在渲染过程中进行细分有一定的优势:
- Low-polygon meshes can be simpler to manage for animation reasons 由于动画的原因,低多边形网格可以更简单地管理
- The 3D program itself doesn't have to maintain large numbers of polygons which can be expensive in terms of system memory 3 d 程序本身并不需要维护大量的多边形,这些多边形对于系统内存来说是昂贵的
It can be more memory-efficient (which is important for GPUs) when combined with view-dependent and/or adaptive subdivision. Small or distant objects, for example, can render smooth with fewer subdivisions.
当与视图相关和/或自适应细分相结合时,它可以提高内存效率(这对 gpu 很重要)。例如,较小或较远的物体可以用较少的细分来渲染平滑的效果。
Redshift subdivides quad polygons using the Catmull-Clark algorithm. For triangles, it uses the Loop algorithm. Redshift supports both screen-space and world-space adaptive tessellation for improved memory usage.
Displacement is a technique typically combined with tessellation. It allows the user to add extra detail on their meshes through shader networks, i.e. textures, noise shader nodes, etc.
使用 Catmull-Clark 算法对四边形进行红移细分。对于三角形,它使用循环算法。红移支持屏幕空间和世界空间自适应细分,以改善内存使用。置换是一种技术,通常结合细分。它允许用户通过着色器网络在他们的网格上添加额外的细节,例如纹理,噪声着色器节点等。
The benefits of displacement include:
流离失所的好处包括:
- Manipulating textures and shader networks for certain displacement effects (such as a brick wall) is much easier than manipulating lots of vertices in a 3D program 操纵纹理和着色网络的某些置换效果(如砖墙)是非常容易的,比操纵大量的顶点在一个3D 程序
- Sculpting apps like ZBrush and Mudbox are easier to use compared to polygon modeling when creating organic geometry. A displacement (or vector displacement) map allows this sculpted detail to be applied on a fairly low-resolution mesh. 在创建有机几何体时,像 ZBrush 和 Mudbox 这样的雕刻应用程序比多边形建模更容易使用。一个置换(或矢量置换)地图允许这个雕塑细节适用于一个相当低的分辨率网格
Because displacement can happen on adaptively tessellated meshes, it can be more memory efficient than using a full-detail, full-tessellation mesh in memory at all times and irrespective of its size or viewpoint.
因为置换可以在自适应嵌套网格上发生,所以它可以比在内存中始终使用全细节、全嵌套网格更有效地提高内存效率。
Redshift supports both heightfield (displacing along the vertex normal) and vector displacement maps. The vector displacement maps can be in object or tangent space. Importantly, any displacement detail that couldn't be represented given the existing tessellation settings is represented, instead, using bump mapping – therefore a good level of surface detail can be present even in fairly low-quality tessellation settings.
红移支持高度场(沿顶点法线移位)和矢量置换图。矢量置换映射可以是物体或切线空间。重要的是,任何置换细节,无法表示给予现有的细分设置,相反,使用凹凸映射-因此,一个良好的表面细节水平,即使在相当低的质量细分设置。
How To Enable
如何实现
The object Tessellation and Displacement options are part of the Redshift Object Tag. In the scene tree, right-click on the desired object and select the Redshift Object tag from the Redshift Tags category.
天体细分和置换选项是红移天体标签的一部分。在场景树中,右键单击所需的对象,并从红移标签类别中选择红移对象标记。
After selecting the tag, and navigate to the Geometry tab. To activate the settings check the Override option.
选择标记后,定位到 Geometry 选项卡。要激活设置,请选中 Override 选项。
The Tessellation and Displacement settings are effective on the object that hosts the Redshift Object tag as well as any child objects.
细分和置换设置对承载红移对象标记的对象以及任何子对象都是有效的。
Tessellation Settings 细分设置
Subdivision Rule
细分规则
Redshift supports two different algorithms for polygon subdivision: "Loop", which is used for triangles and "Catmull-Clark", which is used for quads. These algorithms are also called "Subdivision Rules".
红移支持两种不同的多边形细分算法: 用于三角形的“ Loop”算法和用于四边形的“ Catmull-Clark”算法。这些算法也被称为“细分规则”。
The "CC+Loop" subdivision rule uses Catmull-Clark for quads and Loop for triangles. On the other hand, the "CC Only" option uses Catmull-Clark for triangles too, by first splitting each triangle into three quads. The "CC Only" mode should be used when Redshift is combined with other software that doesn't support Loop subdivision.
“ cc + Loop”细分规则对四边形使用 Catmull-Clark,对三角形使用 Loop。另一方面,“ CC Only”选项也对三角形使用 Catmull-Clark,首先将每个三角形分成三个四边形。当红移与其他不支持 Loop 细分的软件相结合时,应该使用“ CC Only”模式。
Screen Space Adaptive
屏幕空间适应性
Enabling screen-space adaptive tessellation means that objects that are further away from the camera will be subdivided less and will, therefore, use fewer polygons and less GPU memory. If this option is disabled, then subdivision becomes "world space adaptive". This option affects the unit used for the "minimum edge length" setting, as explained below.
启用屏幕空间自适应细分意味着远离相机的对象将被细分得更少,因此将使用更少的多边形和更少的 GPU 内存。如果此选项被禁用,那么细分将成为“世界空间适应性”。此选项影响用于“最小边缘长度”设置的单位,如下所述。
Smooth Subdivision
光滑细分
This controls whether Redshift should subdivide quads and triangles using the Catmull-Clark and Loop algorithms respectively or whether it should do a simple linear subdivision instead. If you are adding displacement on simple angular meshes (such as walls or a box) and don't want them turned into smooth, curvy objects, disabling smooth subdivision might be the right option for you.
这控制红移是否应该分别使用 Catmull-Clark 和 Loop 算法细分四边形和三角形,还是应该用简单的线性细分来代替。如果你在简单的角网格上添加置换(比如墙壁或者盒子) ,并且不希望它们变成光滑的曲线对象,那么禁用光滑的细分可能是正确的选择。
|
|
Smooth subdivision enabled 启用平滑细分 | Smooth subdivision disabled 平滑细分禁用 |
Minimum Edge Length
最小边长
Adaptive subdivision keeps dividing quads/triangles while their edges are longer than this setting. If you are using screen-space adaptive subdivision, this length is measured in screen pixels. If you are not using screen-space adaptive subdivision, this means "world space adaptive subdivision" so the length is measured in world-space units. The smaller this value, the more tessellation will be applied to the mesh. If you set the value to zero, tessellation will continue until "maximum subdivisions" (see below) has been reached.
自适应细分保持四边形/三角形的分割,而它们的边长于此设置。如果使用屏幕空间自适应细分,这个长度以屏幕像素为单位。如果您不使用屏幕空间自适应细分,这意味着“世界空间自适应细分”,因此长度是衡量在世界空间单位。这个值越小,更多的细分将适用于网格。如果您将该值设置为零,则细分将继续,直到达到“最大细分”(见下文)。
The following pictures show a tessellated cube which becomes this spherical-like shape with smooth tessellation. Notice how there is more tessellation when the min edge length becomes smaller. This is showing screen-space adaptive subdivision so 8 means "8 pixels" while 2 means "2 pixels".
下面的图片显示了一个棋盘格立方体,它成为这个球形形状与平滑棋盘。注意如何有更多的细分时,最小边缘长度变得更小。这是显示屏幕空间自适应细分,因此8意味着“8像素”,而2意味着“2像素”。
|
|
Screenspace adaptive with min edge length of 8.0 最小边长为8.0的屏幕空间自适应算法 |
Screenspace adaptive with min edge length of 2.0 最小边长为2.0的屏幕空间自适应算法 |
Maximum Subdivisions
最大分区
Subdivision happens in 'passes'. Each pass can turn single quad/triangle into 4 quads/triangles respectively. This means that the number of polygons can grow extremely quickly with this option. It is a "power of four".
细分发生在通行证。每次通过可以将单个四边形/三角形分别变成4个四边形/三角形。这意味着使用这个选项,多边形的数量可以极快地增长。这是一种“四的力量”。
- A setting of 1 can turn 1 quad into 4 quads 1的设置可以将1个四边形变成4个四边形
- A setting of 2 can turn 1 quad into 16 quads 2的设置可以将1个四边形变成16个四边形
- A setting of 3 can turn 1 quad into 64 quads 一个3的设置可以将1个四分之一变成64个四分之一
- A setting of 4 can turn 1 quad into 256 quads 4的设置可以将1个四边形变成256个四边形
- A setting of 5 can turn 1 quad into 1024 quads 设置为5可以将1个四边形变成1024个四边形
- A setting of 6 can turn 1 quad into 4096 quads 设置为6可以将1个四边形变为4096个四边形
- A setting of 7 can turn 1 quad into 16384 quads 7的设置可以将1个四边形变成16384个四边形
- A setting of 8 can turn 1 quad into 65536 quads 设置为8可以将1个四边形变为65536个四边形
So a mesh containing only 1000 quads, using a "minimum edge length" of 0.0 and a "maximum subdivisions" 8, could become a 65 million quad mesh which could take a long time to generate and would consume lots of memory! For this reason, great care has to be applied when adjusting both "maximum subdivisions" and "minimum edge length".
因此,一个只包含1000个四边形的网格,使用0.0的“最小边长”和8的“最大细分”,可以变成一个6500万个四边形网格,这可能需要很长的时间来生成,并将消耗大量的内存!因此,在调整“最大细分”和“最小边长”时必须非常小心。
|
|
|
|
Subdivision disabled 禁用细分功能 | One Level 一个级别 | Two Levels 两个层次 | Three Levels 三个层次 |
Out-Of-Frustum Tessellation Factor
出水截形细分系数
This option allows objects that are outside the camera frustum (i.e. objects that are not directly visible to the camera) to be tessellated to a lesser degree. The larger the factor, the lesser this out-of-frustum tessellation will be. This setting can help save memory by tessellating "unimportant" objects less. However, sometimes an object might be outside the camera frustum but still very visible through reflections. Or it might be casting a well-defined shadow within the camera frustum. For such objects, smaller factors should be used. A factor of 0.0 disables this optimization. For a more detailed discussion on this, please see the relevant section below.
此选项允许将摄像机视锥体外部的对象(即摄像机不能直接看到的对象)细分到较小的程度。越大的因素,较小的这出水果细分将。这种设置可以通过减少对“不重要的”对象的嵌套来帮助节省内存。然而,有时候一个物体可能在相机平截头体之外,但是仍然可以通过反射非常清晰地看到。或者它可能在摄像头平截体中投射一个清晰的阴影。对于这样的对象,应该使用较小的因子。因子为0.0将禁用此优化。关于这个问题的更详细讨论,请参阅下面的相关章节。
Limit Out-Of-Frustum Tessellation / Max Out-Of-Frustum Subdivs
极限出水果细分/最大出水果细分
When "Limit Out-Of-Frustum Tessellation" is enabled, you can specify the maximum number of subdivisions that should happen outside the camera frustum with the "Max Out-Of-Frustum Subdivs" option. This setting is useful when the "Out-Of-Frustum Tessellation Factor" setting can still yield excessive tessellation. This condition can happen when the mesh is using large displacements. For a more detailed discussion on this, please see the relevant section below.
当启用“ Limit Out-Of-Frustum tessation”时,您可以使用“ Max Out-Of-Frustum Subdivs”选项指定在相机平截头之外应该发生的最大子分割数。这个设置是有用的时候,“出水果细分因子”设置仍然可以产生过多的细分。这种情况可能发生时,网格使用大置换。关于这个问题的更详细讨论,请参阅下面的相关章节。
Displacement Settings
置换设置
Maximum Displacement
最大排水量
This parameter tells Redshift what is the maximum length the displacement shaders/textures will be displacing the vertices by. For example, if you're adding two displacement textures in the shader graph and each displacement texture can push the vertices by 1 unit, then both of them can push the vertices by a maximum of 2 units, so a setting of 2.0 should be used for this setting. Unfortunately, due to flexible nature of shaders, it's not currently possible to compute this value automatically. Settings similar to this can be found on other renderers, too. They might be called "bounds padding" or "min/max bound".
这个参数告诉红移什么是最大长度的置换着色器/纹理将取代顶点。例如,如果在着色器图中添加两个置换纹理,每个置换纹理可以将顶点推动1个单位,那么这两个纹理都可以将顶点推动最多2个单位,所以这个设置应该使用2.0的设置。不幸的是,由于着色器的灵活性,目前不可能自动计算这个值。类似的设置也可以在其他渲染器上找到。它们可以称为“边界填充”或“最小/最大界限”。
If the value for this setting is set too low, you will see a 'ceiling' on your displacements, i.e. the maximum displacement will be clamped. If, on the other hand, this value is set too high, there won't be any visual artifacts but the performance could suffer. It is, therefore, advisable to use a value that is as low as possible before seeing any artifacts.
如果这个设置的值设置得太低,你会在你的置换上看到一个“天花板”,也就是说,最大置换会被夹住。另一方面,如果这个值设置得太高,就不会有任何视觉工件,但是性能可能会受到影响。因此,在看到任何工件之前,建议使用尽可能低的值。
Displacement Scale
排水量表
This scales the displacement results, which has the effect of accentuating or toning down the displacement. While it is possible to scale the displacement in the shader graph itself, this setting was added for the case where the same displacement shader is used on different meshes but different levels of displacement 'strength' are required among these meshes.
这个尺度的置换结果,这有强调或调和下来的置换的效果。虽然可以在着色器图形本身中衡量置换,但是这个设置是为了在不同网格上使用相同的置换着色器,但是这些网格之间需要不同程度的置换‘强度’。
Below is a sphere displaced with a fractal shader.
下面是一个用分形着色器置换的球体。
|
|
|
Scale 0.05 比例0.05 | Scale 0.1 0.1分 |
Scale 0.3 0.3分 |
Enable Auto Bump Mapping
启用自动凹凸贴图
Very high-detail surface detail can require very high tessellation levels to be captured sufficiently, otherwise the result might look too soft. However, this can mean longer rendering times and higher memory usage!
非常高的细节表面细节可以要求非常高的细分水平被充分捕获,否则结果可能看起来太软。然而,这可能意味着更长的渲染时间和更高的内存使用!
The 'Enable Auto Bump Mapping' option effectively emulates what would happen if you were to tessellate your geometry to a sub-pixel level and modifies the surface normals accordingly, as if they were bump-mapped.
“启用自动凹凸映射”选项有效地模拟了如果你将你的几何图形分类到一个子像素级别,并相应地修改表面法线,就像凹凸映射一样会发生什么。
The following two spheres were rendered with exactly the same tessellation setitngs but the sphere on the right uses auto bumpmapping. Notice how it's able to capture more surface detail.
下面的两个球体渲染完全相同的细分settngs,但右边的球体使用自动凹凸映射。注意它是如何捕捉更多的表面细节的。
|
|
Without auto bump mapping 无需自动凹凸贴图 | With auto bump mapping 自动凹凸贴图 |
How To Use Displacement
如何使用置换
After configuring the tessellation settings, the displacement shader should be set. Please click here for more information.
配置细分设置后,置换着色应该设置。请点击这里了解更多信息。
UV Smoothing
紫外线平滑
When "Smooth subdivision" is enabled, Redshift will smooth not only the vertex positions but also the UV coordinates and tangent space vectors. Smoothing UV coordinates means that the UVs will be shifted to remove any 'zig-zagging' and 'UV breaks' during tessellation and maintain smooth UV-space curves. In the majority of cases, this is the desirable way to treat UVs. However, there are cases where strict UV layouts (such as with when UV tiles are aligned to quads) need to be preserved and not smoothed.
当“光滑细分”启用,红移将光滑不仅顶点位置,而且还 UV 坐标和切线空间向量。平滑的紫外线坐标意味着紫外线将被移动,以消除任何’之字形’和’紫外线破裂’在细分和保持平滑的紫外线空间曲线。在大多数情况下,这是治疗 uv 的理想方法。然而,有些情况下,严格的 UV 布局(例如当 UV 瓷砖对齐到四边形)需要保留和不平滑。
For this reason, Redshift supports enabling/disabling UV smoothing.
因此,Redshift 支持启用/禁用 UV 平滑。
Tessellation And Instancing
细分与实例化
When an mesh is instanced in Redshift, adaptive tessellation is no longer supported. However, you can still use fixed-rate tessellation (and, subsequently, displacement too).
当一个网格在 Redshift 的实例,自适应细分不再支持。然而,你仍然可以使用固定利率细分(和,随后,置换也)。
To do fixed-rate tessellation you need to:
要做定额细分,你需要:
- Disable screen-space adaptive tessellation 禁用屏幕空间自适应细分
- Set minimum edge legth to zero 设置最小边缘长度为零
- Set the maximum subdivisions to something reasonable 将最大细分值设置为合理值
Please pay particular attention to the third point above, as the default setting (6 subdivisions) is too high for fixed rate subdivision. As explained above, 6 means 4096 primitives will be generated for each original primitive. So a mesh with just 1000 faces will turn into a mesh with 4 million faces!
请特别注意上面的第三点,因为默认设置(6个细分)对于固定速率细分来说太高了。如上所述,6表示每个原语将生成4096个原语。所以一个只有1000个面的网格会变成一个有400万个面的网格!
Out Of Frustum Tessellation
在水果细分之外
The following images show what "out of frustum tessellation factor" does for polygons that are outside the camera frustum.
下面的图像显示了“出视截体细分因子”对摄像机视截体之外的多边形的作用。
The test scene is simple: it's just a quad with a mild fractal displacement. The camera is looking at the quad (slightly tilted down) from a close position.
测试场景很简单: 它只是一个具有轻微分形置换的四边形。摄像机从近距离观察四轴飞行器(略微向下倾斜)。
Scene setup
场景设置
We use a wireframe shading node so we can visualize tessellation.
我们使用一个线框阴影节点,这样我们可以可视化细分。
In the images below, we rendered once from the camera, then we froze tessellation in the RenderView and then we "pulled the camera back" so we could see the effect of polygon tessellation outside the camera frustum. As you can see, the polygons that are inside the camera frustum are tessellated the most. Polygons that are away from the camera frustum are tesselated less and depending on the "out-of-frustum tessellation factor". The farther away a polygon is from the camera frustum, the less it gets tessellated.
在下面的图像中,我们从相机渲染一次,然后我们在渲染视图中冻结细分,然后我们“拉回相机”,这样我们就可以看到多边形细分在相机平截体外面的效果。正如你所看到的,相机平截体内部的多边形是细分最多的。远离相机平截体的多边形细分较少,取决于“出平截体细分因子”。一个多边形离摄像头截锥越远,它得到的细分就越少。
|
|
|
Out-of-frustum tessellation factor: 8 出墩细分系数: 8 |
16 |
32 |
This setting should be used carefully! Even though a polygon is outside the camera frustum, it might be visible through a mirror or it might be casting a defined shadow inside the camera frustum! So, in these cases, making it tessellate less might make it look blocky/angular and generally too-low-poly in reflections or shadows!
这个设置应该小心使用!即使一个多边形位于摄像机平截体之外,它也可能通过镜子可见,或者它可能在摄像机平截体内部投射一个明确的阴影!因此,在这些情况下,使它的细分少可能会使它看起来块状/有角和一般太低多边形的反射或阴影!
While "out-of-frustum tessellation factor" allows us to get tessellation under control and save on Redshift's memory usage and rendering speed, there does exist one case where it might prove ineffective: scenes with large displacements and the camera being close to the displaced geometry.
虽然“出水果细分因子”允许我们控制细分,并节省红移的内存使用和渲染速度,但确实存在一个情况下,它可能证明是无效的: 场景大置换和相机接近移位的几何体。
To explain: When you set up displacement in Redshift, you have to declare a "maximum displacement" setting. This setting tells Redshift that displacement can go up to a certain distance. This setting is also used by Redshift when it tries to determine if a polygon is inside the frustum or outside it. The reasoning behind that is that, if a polygon is going to be displaced ("moved") by a lot, it might actually be moved inside the camera frustum, even though it was originally outside the camera frustum. In other words, Redshift applies "conservative" tessellation when it comes to displaced polygons that might end up being inside the camera frustum.
解释: 当你在 Redshift 设置排水量时,你必须声明一个“最大排水量”设置。这个设置告诉红移,置换可以上升到一定的距离。当红移试图确定一个多边形是在截锥内部还是外部时,也使用这个设置。其背后的原因是,如果一个多边形将被移动(“移动”)很多,它实际上可能被移动到摄像机平截头体内部,即使它最初是在摄像机平截头体外部。换句话说,红移应用“保守”细分当它涉及到移位多边形,可能最终在相机平截头。
When this happens, Redshift might incorrectly "think" that too many polygons are inside the camera frustum and it might, therefore, tessellate these polygons a lot!
当这种情况发生时,红移可能会错误地“认为”摄像头平截头内有太多的多边形,因此,红移可能会大量分解这些多边形!
To show this, we'll edit our scene and make "max displacement" several times larger. Notice how there is much more tessellation because Redshift now thinks that all the polygons outside the frustum could possibly end up inside the frustum!
为了显示这一点,我们将编辑我们的场景,使“最大置换”几倍大。注意如何有更多的细分,因为红移现在认为所有的多边形以外的视锥体可能最终在视锥体内!
Increasing "max displacement" produces much more tessellation
增加“最大置换”产生更多的细分
For these cases, the "Limit Out-Of-Frustum Tessellation" control should be used. In the picture below, we enabled it and set the "max out-of-frustum sudivs" to 5 (the mesh uses max subdivs 8). This means "If a polygon is outside the frustum, ensure it doesn't get subdivided more than 5 times".
对于这些情况下,“限制出水果细分”控制应该使用。在下面的图片中,我们启用了它,并将“ max out-of-frustum sudiv”设置为5(网格使用 max subdiv 8)。这意味着“如果一个多边形在截锥外面,确保它不会被细分超过5次”。
Setting "max out-of-frustum subdivs" to 5 limits the tessellation
设置“最大出水果子 div”为5限制细分
You can think of this setting as a "subdivision clamp".
你可以把这个设置想象成一个“细分钳”。
Unsupported Features
不支持的特性
Redshift doesn't currently support edge/vertex crease values in Softimage. They are supported in Maya.
红移目前不支持 Softimage 中的边/顶点折痕值。它们在 Maya 中支持。
赶快留个言打破零评论!~