法线图的工作原理和烘焙过程-卡洛斯·莱莫斯-双语
843 1
实名

通过了实名认证的内容创造者

发布于 2022-8-5 17:19:37

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 七月纪旅。 于 2022-8-6 11:37 编辑

Part 1. What Normal Maps Are and How They Work
第1部分。什么是法线图以及它们的工作原理
Throughout the years, I have been trying to understand normal mapping and the problems that usually appear when working with them.
多年来,我一直试图理解法线映射以及使用它们时通常出现的问题。

Most explanations I found were usually too technical, incomplete or too hard to understand for my taste, so I decided to give it a try and explain what I gathered so far. I recognize that these explanations may be also incomplete or not 100% accurate, but I want to try anyway.
我发现的大多数解释通常太技术性,不完整或太难以理解,所以我决定尝试一下,并解释我到目前为止收集到的内容。我认识到这些解释也可能不完整或不是100%准确,但我无论如何都想尝试。

The first 3D models ever made looked something like this:
有史以来制作的第一个3D模型看起来像这样:
1.jpg


We see an obvious limitation: it looked too polygonal.
我们看到一个明显的局限性:它看起来太多边形了。

The first obvious solution was to add more polygons, making the surface more even and smooth, up to a point where the polygons would look like a single, smooth surface. Turns out this needed a huge amount of polygons (especially at that time) in order to make surfaces such as a sphere look smooth.
第一个明显的解决方案是添加更多多边形,使表面更加均匀和光滑,直到多边形看起来像单个光滑表面。事实证明,这需要大量的多边形(特别是在当时),以使球体等表面看起来光滑。
2.jpg


Another solution was needed, and thus normals were invented (not really, but it's easier to explain and understand that way).
需要另一种解决方案,因此发明了法线(不是真的,但以这种方式解释和理解更容易)。

Let's draw a line from the center of a polygon, completely perpendicular to its surface. We will call this line a super confusing name: normal.
让我们从多边形的中心绘制一条完全垂直于其表面的线。我们将这条线称为一个超级令人困惑的名字:正常。

The purpose of this normal is to control where a surface is pointing at so that when light bounces from this surface, it will use this normal to calculate the resulting bounce.
此法线的目的是控制曲面指向的位置,以便当光线从该曲面反射时,它将使用此法线来计算生成的反弹。

When light hits a polygon, we compare the angle of the light ray to the normal of the polygon. Light will get bounced back using the same angle relative to the normal direction:
当光线照射到多边形时,我们将光线的角度与多边形的法线进行比较。光将使用相同的相对于法线方向的角度被反射回来:



In other words, the light bounce will be symmetrical relative to the polygon normal. This is how most bounces work in the real world.
换句话说,光反射相对于多边形法线是对称的。这就是大多数反弹在现实世界中的工作方式。

By default, all polygons bounce light rays completely perpendicularly to their surface (as they would in real life), because polygon normals are, by default, perpendicular to the polygon surface. If there are gaps in the normals, we will see them as separate surfaces, since light will bounce in either one direction or the other.
默认情况下,所有多边形都会完全垂直于其表面反射光线(与在现实生活中一样),因为默认情况下,多边形法线垂直于多边形表面。如果法线中存在间隙,我们将将它们视为单独的表面,因为光线将在一个方向或另一个方向上反弹。



Now, if we have two faces connected, we can tell the computer to smooth the transition between the normal of one polygon and the other so that the normal gradually aligns with the closest polygon normal. This way, when light hits one polygon directly in its center, the light will bounce straight, following the normal direction. But, in between polygons, this normal direction is smoothed, bending how light bounces.
现在,如果我们连接了两个面,我们可以告诉计算机平滑一个多边形的法线和另一个多边形的法线之间的过渡,以便法线逐渐与最接近的多边形法线对齐。这样,当光线直接照射到其中心的一个多边形时,光线将沿着法线方向直线反射。但是,在多边形之间,这个法线方向被平滑,弯曲了光的反射方式。



We will perceive the transition as a single surface, as the light will bounce from one polygon to the other in a smooth fashion, and there will be no gaps. Effectively, the light bounces from these polygons smoothly, as it would do if it had a ton of polygons.
我们将过渡视为单个曲面,因为光线将以平滑的方式从一个多边形反射到另一个多边形,并且不会有间隙。实际上,光线会从这些多边形中平滑地反射,就像如果它有大量的多边形一样。

This is what we are controlling when we set smoothing groups (3ds Max, Blender) or set edges to be hard or smooth (Modo, Maya): we are telling the program which transitions between faces we want to be smooth and which we want to be hard.
当我们设置平滑组(3ds Max,Blender)或将边缘设置为硬或平滑(Modo,Maya)时,这就是我们要控制的内容:我们正在告诉程序,我们想要平滑的面孔之间的过渡,以及我们想要硬的面孔之间的过渡。

Here's a comparison of the same sphere with hard and smooth transitions, both with 288 polys:
以下是具有硬过渡和平滑过渡的同一球体的比较,两者均具有288个多边形:



We could potentially set something like a box so that all its vertices would have averaged normals. The 3D software will try to smooth its surface, so it'd look like a single, smooth surface. This makes perfect sense for the 3D program, but it looks very weird because we have something that should have several separate surfaces (each face of the box) but the program is trying to show it as a single, smooth surface.
我们可以像盒子一样设置一些东西,这样它的所有顶点都会平均法线。3D软件将尝试平滑其表面,因此它看起来像一个单一的光滑表面。这对于3D程序来说是完全有意义的,但它看起来非常奇怪,因为我们有一些东西应该有几个单独的表面(盒子的每个面),但程序试图将其显示为单个光滑的表面。



This is why we usually have a smoothing angle setting in 3D software: if we have 2 connected polygons in an angle greater than this smoothing angle, their transition will be soft, and polygons connected in an angle smaller than the smoothing angle will be hard. This way, extreme angles between surfaces will be shown as different surfaces, as they would in the real world.
这就是为什么我们通常在3D软件中有一个平滑角度设置:如果我们有2个连接的多边形,其角度大于此平滑角度,则它们的过渡将是柔和的,而以小于平滑角度的角度连接的多边形将是硬的。这样,曲面之间的极端角度将显示为不同的曲面,就像在现实世界中一样。

So, we used normals to control the transitions between faces in our model, but we can take this a step further.
因此,我们使用法线来控制模型中人脸之间的过渡,但我们可以更进一步。

Since we are changing how light bounces from an object, we can also make a very simple object bounce light as a complex one would. We use a texture to bend the direction of the light that bounces from a 3D object, making it look more complex than it really is.
由于我们正在改变光线从物体反射的方式,因此我们也可以使非常简单的物体像复杂的物体一样反射光线。我们使用纹理来弯曲从3D对象反射的光线的方向,使其看起来比实际情况更复杂。

A real-life example of this would be those holograms that were gifted back in the day with potato chips (at least here in Spain). These are completely flat, but bounce light in a way that's similar to how a 3D object would, making it look more complex than it really is. In the 3D world these work even better, but still have some limitations (since the surface would still be flat).
一个现实生活中的例子是那些当时赠送薯片的全息图(至少在西班牙是这样)。这些是完全平坦的,但以类似于3D对象的方式反射光线,使其看起来比实际情况更复杂。在3D世界中,这些工作得更好,但仍有一些局限性(因为表面仍然是平坦的)。

While we do use the normals of the polygons for some other black magic related things, we don't actually control the smoothing of our model surface using the polygon normals. We use the vertex normals to control the smoothing of our normals. This is basically the same idea, but a little bit more complex.
虽然我们确实将多边形的法线用于其他一些与黑魔法相关的事情,但我们实际上并没有使用多边形法线来控制模型表面的平滑。我们使用顶点法线来控制法线的平滑。这基本上是相同的想法,但有点复杂。

Each vertex can have one or more normals associated. If it has a single normal, we call it an averaged vertex normal and if it has more than one, we call it a split vertex normal.
每个顶点可以关联一个或多个法线。如果它有一个法线,我们称之为平均顶点法线,如果它有多个,我们称之为分割顶点法线。

Let's take two polygons connected by an edge. If the transition between the two faces is smooth (we set it to smooth in Maya/Modo, or they both have the same smoothing group in Max/Blender), each vertex has a single normal, which is the average of the polygon normals (this is why it's called averaged vertex normal).
让我们以两个由边连接的多边形为例。如果两个面之间的过渡是平滑的(我们在 Maya/Modo 中将其设置为平滑,或者它们在 Max/Blender 中都具有相同的平滑组),则每个顶点都有一个法线,即多边形法线的平均值(这就是为什么它被称为平均顶点法线)。

Important note: up until very recently, each 3D program used its own method of calculating averaged vertex normals, which meant that normal maps calculated in one program might look completely different in another 3D program. I explain more about this in the second part of this tutorial (see below in this article).
重要提示:直到最近,每个3D程序都使用自己的方法来计算平均顶点法线,这意味着在一个程序中计算的法线图在另一个3D程序中可能看起来完全不同。我在本教程的第二部分中对此进行了更多解释(请参阅本文下面的内容)。



If the transition is hard (hard edge or the smoothing groups are different), each vertex has several normals: one for each connected vertex, and aligned with their normals. This leaves a gap in the normals, which looks like 2 different surfaces. This is what we call a split vertex normal.
如果过渡是硬的(硬边或平滑组不同),则每个顶点都有几个法线:每个连接的顶点对应一个法线,并与它们的法线对齐。这会在法线中留下一个间隙,看起来像 2 个不同的表面。这就是我们所说的分割顶点法线。






As you can probably guess, controlling the vertex normals is vital if we want to control our normal maps. Fortunately, we don't really need to directly modify the normals or even see them, but knowing how this works will help us understand why we do things the way we do and know more about the problems we may see.
正如您可能猜到的那样,如果我们想控制我们的法线映射,控制顶点法线至关重要。幸运的是,我们真的不需要直接修改法线,甚至不需要看到它们,但是了解它是如何工作的,这将有助于我们理解为什么我们这样做,并更多地了解我们可能看到的问题。

When baking a normal map, we are basically telling the baking program to modify the direction that the low poly normals follow so that they match the direction of the high-poly model; as a result, the low-poly model is bouncing light as the high-poly would. All this information is stored in a texture called normal map. Let's see an example.
在烘焙法线图时,我们基本上是告诉烘焙程序修改低多边形法线遵循的方向,以便它们与高多边形模型的方向相匹配;因此,低多边形模型会像高多边形模型一样反射光线。所有这些信息都存储在称为法线贴图的纹理中。让我们看一个示例。

Let's say that we have a low-poly model like this one - a flat plane with 4 vertices and a UV set that our baking program will use to create the normal map.
假设我们有一个像这样的低多边形模型 - 一个具有4个顶点和一个UV集的平面,我们的烘焙程序将使用它来创建法线贴图。



And it has to receive the normal information from this high-poly model the normals of which are more complicated.
它必须从这个高多边形模型接收正态信息,其法线更复杂。




Keep in mind that we are only transferring normal information, so the UVs, material, topology, transformations, etc. are completely irrelevant. Rule of thumb: if your high-poly looks good, it means that its normals are good and should be fine enough for baking.
请记住,我们只是在传输正常信息,因此UV,材料,拓扑,转换等是完全无关紧要的。经验法则:如果你的高聚看起来不错,这意味着它的正常值很好,应该足够好,可以烘烤。

Our baking program will take the low-poly and cast rays following its normal directions (this is why we need to control the low-poly normals). Those rays have a limited length, to avoid getting normal information from far away faces (usually named bake distance or cage distance). When those rays collide with the high-poly, the baker calculates how to bend those rays so that they follow the same normal direction as the high-poly, and stores that information into a normal map.
我们的烘焙程序将采用低多边形和投射光线,并遵循其法线方向(这就是为什么我们需要控制低多边形法线)。这些射线的长度有限,以避免从远处的面部获得正常信息(通常称为烘烤距离或笼子距离)。当这些光线与高多边形碰撞时,面包师计算如何弯曲这些光线,使它们遵循与高聚体相同的法线方向,并将该信息存储到法线贴图中。



Here's the bake result of this example:
下面是此示例的烘焙结果:



We have a texture that our engine uses to modify the low-poly normals, so light bounces from this low-poly model the way it would if we had the high-poly version. Keep in mind that this is a texture, and can't affect the silhouette of your low-poly (you can't modify how the light bounces from your model if it doesn't hit your model).
我们有一个纹理,我们的引擎用它来修改低多边形法线,所以光从这个低多边形模型中反射,就像我们有高多边形版本一样。请记住,这是一种纹理,不会影响低多边形的轮廓(如果光线没有击中模型,则无法修改光线从模型中反射的方式)。


It's obvious that normal maps are not regular textures. This is because they don't carry color information, but normal information. This also means that normal maps should not be treated as regular textures and they have special compression and gamma correction settings, as we will see.
很明显,法线贴图不是常规纹理。这是因为它们不携带颜色信息,而是正常信息。这也意味着法线贴图不应被视为常规纹理,并且它们具有特殊的压缩和伽玛校正设置,正如我们将看到的。

You can think of a normal map as a set of 3 greyscale textures, stored in a single image:
您可以将法线贴图视为存储在单个图像中的一组 3 个灰度纹理,存储在单个图像中:




- The first image is telling the engine how this model should bounce light when lit from the right side, and it's stored in the red channel of the normal map texture.
- 第一幅图像告诉引擎,当该模型从右侧点亮时,它应该如何反射光线,并将其存储在法线贴图纹理的红色通道中。

- The second image is telling the engine how the model should bounce light when lit from below*, and it's stored in the green channel of the normal map texture.
- 第二幅图像告诉引擎,当模型从下方*点亮时,模型应如何反射光线,并将其存储在法线贴图纹理的绿色通道中。

*Some programs use above instead of below, so we can have "left-handed" and "right-handed" normal maps, and this can cause some problems as we will see later.
*有些程序使用上面而不是下面,所以我们可以有“左撇子”和“右撇子”法线贴图,这可能会导致一些问题,我们将在后面看到。

- The third image is telling the engine how the model should bounce light when lit from the front, and it's stored in the blue channel of the normal map texture. Since most things look white when lit from the front, normal maps usually look blueish.
- 第三幅图像告诉引擎,当模型从正面点亮时,它应该如何反射光线,并且它存储在法线贴图纹理的蓝色通道中。由于大多数物体在从前面点亮时看起来都是白色的,因此法线贴图通常看起来很蓝。

When we combine all three images in a single one, we have a normal map. Please keep in mind that this explanation is not 100% correct, but it will hopefully help you understand the information inside a normal map and have a better understanding of what it does.
当我们将所有三个图像组合成一个图像时,我们就有一个法线地图。请记住,此解释不是100%正确的,但它有望帮助您理解法线地图中的信息,并更好地了解它的作用。

So, in conclusion:
因此,总而言之:

Normals are vectors that we use to define how light bounces from a surface. They can be used to control the transition between faces (by averaging the normals of connected vertices to make a smooth transition or splitting them to make a hard transition), but they can also be reoriented, to make a low-poly model bounce light the way a much more complex model would.
法线是我们用来定义光如何从表面反射的矢量。它们可用于控制面之间的过渡(通过平均连接顶点的法线以平滑过渡或拆分它们以使其进行硬过渡),但它们也可以重新定向,以使低多边形模型像更复杂的模型一样反射光。

This information is stored in 3 separate channels of an image, and the 3D program reads it in order to understand which direction the surface of the model should look towards.
该信息存储在图像的3个独立通道中,3D程序读取它以了解模型表面应朝哪个方向看。

Now that we have a general idea of what normals are, and how a normal map works, let's talk about how we can bake these details from high-poly to low-poly.
现在我们已经大致了解了什么是法线,以及法线映射是如何工作的,让我们来谈谈如何将这些细节从高多边形烘焙到低多边形。

Part 2. Baking Normal Maps
第2部分。烘焙法线贴图
The general idea of baking a normal map is relatively simple: you have a low-poly with UVs and a high-poly model, and you transfer the normal information from the high-poly to the low-poly. This way, the low-poly will bounce light as the high-poly would.
烘焙法线贴图的一般思想相对简单:您有一个带有UV的低多边形和一个高多边形模型,并且您将法线信息从高多边形传输到低多边形。这样,低聚体将像高聚体一样反射光线。

During this process, the baking program will basically cast rays from the low-poly, following the vertex normals and searching for the high-poly. This is the most important aspect of normal mapping, and most problems people have when working with normal maps are related to this.
在此过程中,烘焙程序基本上会从低多边形投射光线,遵循顶点法线并搜索高多边形。这是法线映射最重要的方面,人们在使用法线映射时遇到的大多数问题都与此有关。

If you don′t control the vertex normals of your low-poly model, you will lose control over your normal map.
如果不控制低多边形模型的顶点法线,您将失去对法线贴图的控制。



Bad Normal Map Correlation
错误的法线图相关性

In order to control the smoothing of our low-poly model, we can have split vertex normals (to create hard edges) or averaged vertex normals (to create soft edges).
为了控制低多边形模型的平滑,我们可以使用分割顶点法线(以创建硬边)或平均顶点法线(以创建软边)。

Turns out that not all 3D programs use the same calculations to average the vertex normals. This means that your low-poly will look different and have its vertex normals pointing at slightly different locations depending on your 3D program. This isn't a big problem usually since these deviations are very small, but it can affect how your model looks like, and these differences are exaggerated when using normal maps since your normal maps are modifying the low-poly normals that are changing between applications.
事实证明,并非所有 3D 程序都使用相同的计算来平均顶点法线。这意味着您的低多边形看起来会有所不同,并且其顶点法线指向稍微不同的位置,具体取决于您的 3D 程序。这通常不是一个大问题,因为这些偏差非常小,但它会影响模型的外观,并且在使用法线贴图时,这些差异被夸大了,因为您的法线贴图正在修改在应用程序之间变化的低多边形法线。



The 3D industry is working on fixing this problem, and one solution has recently appeared, called Mikk space. This is a method of calculating vertex normals that all 3D apps could use, so vertex normal don't change between 3D programs. Keep in mind that not all 3D apps use it yet.
3D行业正在努力解决这个问题,最近出现了一种解决方案,称为Mikk space。这是一种计算所有 3D 应用都可以使用的顶点法线的方法,因此顶点法线不会在 3D 程序之间更改。请记住,并非所有 3D 应用都使用它。

Another way to reduce this effect is not to rely too much on normal maps when baking. Try to match your low-poly more closely to the high-poly and use more hard edges on flat surfaces. This way, your normal map won't have to do all the work and these small deviations will be less noticeable.
减少这种影响的另一种方法是在烘焙时不要过分依赖法线贴图。尝试将低聚体与高聚体更紧密地匹配,并在平坦表面上使用更坚硬的边缘。这样,您的法线地图就不必完成所有工作,这些小偏差将不那么明显。

Normal Map Detail Skewing
法线贴图细节倾斜

When the computer averages the normal direction of your low-poly vertex normals, big changes in the angles of your surface can "skew" the low-poly normals and they won't be perpendicular to the low-poly surface.
当计算机对低多边形顶点法线的法线方向求平均值时,曲面角度的较大变化可能会“倾斜”低聚法线,并且它们不会垂直于低聚曲面。



Since the normal map baker uses the low-poly normal directions when searching for the high-poly details, if these directions are skewed they will appear skewed on the normal map:
由于法线贴图 Baker 在搜索高多边形细节时使用低多边形法线方向,因此如果这些方向偏斜,它们将在法线贴图上显示为偏斜:



This is a very common problem, and several solutions have been found. There isn't the best one though, it really depends on the geometry.
这是一个非常常见的问题,并且已经找到了几种解决方案。虽然没有最好的,但它实际上取决于几何形状。

- Some 3D bakers have the option of rebaking these parts modifying the low-poly normals temporarily, so they are baked without skewing. Marmoset Toolbag has this option. Reddit user Tanagashi kindly explained to me that some programs such as xNormal can tesselate the low-poly to add new vertices and make the normals perpendicular to the low-poly surface, bake an object space normal map and then convert it to tangent space using the original low-poly normals. Using this new normal map, the program can create masks to control where to use the original normal map and the one created from the tesselated low-poly.
- 一些3D面包师可以选择重新烘烤这些部分,暂时修改低多边形法线,因此它们可以烘烤而不会歪斜。狨猴工具包有这个选项。Reddit用户Tanagashi善意地向我解释说,一些程序(如xNormal)可以对低多边形进行tesselate,以添加新的顶点并使法线垂直于低多边形表面,烘烤对象空间法线映射,然后使用原始的低多边形法线将其转换为切线空间。使用此新的法线贴图,程序可以创建蒙版来控制在何处使用原始法线贴图和从镶嵌的低多边形图创建的法线贴图。




- Adding vertices will make the transition between the vertex normals less skewed, as one 90o angle can be split into smaller degrees, making the second transition less skewed. This obviously increases your polycount and, since you are adding geometry. I recommend you to use this extra geometry to add a more interesting silhouette to your model.
- 添加顶点将使顶点法线之间的过渡不那么偏斜,因为一个90o的角度可以分成更小的度,使第二个过渡不那么偏斜。这显然会增加您的多边形计数,并且,因为您正在添加几何图形。我建议您使用此额外的几何图形为模型添加更有趣的轮廓。




- Split the averaged vertex normals (making the edge hard/use separate smoothing groups): this way, each vertex will have several normals, each one perpendicular to the low-poly surface. Keep in mind that, when the 3D program has a split vertex normal it actually creates a duplicate of the vertex, so this will increase your vertex count and slightly decrease performance. Additionally, hard edges will also give you a "black edge" problem, as we will see later.
- 分割平均顶点法线(使边缘变硬/使用单独的平滑组):这样,每个顶点将具有多个法线,每个法线都垂直于低多边形表面。请记住,当 3D 程序具有正常分割顶点时,它实际上会创建顶点的副本,因此这将增加顶点计数并略微降低性能。此外,硬边也会给你一个“黑边”问题,我们稍后会看到。




- We can modify the normals of our models to bend the normals of our low-poly so that they are perpendicular to the high-poly details. Keep in mind that not all programs allow modified normals (ZBrush only has averaged normals, OBJ and older FBX files don't have custom normal information). There are basically 2 ways of modifying the normals:
- 我们可以修改模型的法线,以弯曲低多边形的法线,使它们垂直于高多边形细节。请记住,并非所有程序都允许修改的法线(ZBrush只有平均法线,OBJ和较旧的FBX文件没有自定义法线信息)。基本上有2种修改法线的方法:

1. Weighted normals: this is an automatic method similar to the average vertex normals. The idea here is that when averaging the vertex normal not all faces will have the same strength: larger faces will "pull" the vertex normals towards them with more strength than smaller faces. This way, larger faces which are usually more important will have better detail projection. This works especially well with high-poly panels.
1.加权法线:这是一种类似于平均顶点法线的自动方法。这里的想法是,当平均顶点法线时,并非所有面都具有相同的强度:较大的面将比较小的面具有更大的强度将顶点法线“拉”向它们。这样,通常更重要的较大人脸将具有更好的细节投影。这尤其适用于高聚板。



2. Custom normals: using tools of your 3D software, you can bend your low-poly normals. This is a relatively new idea and there aren't standardized tools for this. Keep in mind that bending the normals can create very weird unintended shading on other parts of your model, so this technique is usually combined with bevels. Some people call this technique "mid-poly modeling".
2.自定义法线:使用3D软件的工具,您可以弯曲低多边形法线。这是一个相对较新的想法,并且没有标准化的工具。请记住,弯曲法线会在模型的其他部分上产生非常奇怪的意外着色,因此这种技术通常与斜角结合使用。有些人称这种技术为“中多边形建模”。



Cage/Baking Distance
保持架/烘烤距离

By default, the rays that are cast from the low-poly surface travel a limited distance, to prevent the low-poly from receiving normal information from far away parts of the high-poly. This distance is usually called "frontal/rear distance", as the rays can be cast towards the inside, outside of the model, or both. You can see this distance represented in red in the following image:
默认情况下,从低多边形表面投射的光线行进的距离有限,以防止低聚体接收来自高多边形远处部分的法向信息。此距离通常称为“前/后距离”,因为射线可以投射到模型内部,外部或两者兼而有之。在下图中,您可以看到此距离以红色表示:



Some 3D apps (3ds Max, for instance) also allow us to use a cage. A cage is a "copy" of our low-poly model that we can modify so that it encapsulates the high-poly perfectly. And, in some cases (not all), it also allows us to change the direction of the rays, without changing your original low-poly vertex normals. This can help us get the best baking extremes and avoid skews, but keep in mind that though you are not baking using the normal direction of your vertex normals, in the end, you will use a normal map to modify the actual low-poly normals, so the result could look strange.
一些 3D 应用程序(例如 3ds Max)也允许我们使用笼子。笼子是我们可以修改的低多边形模型的“副本”,以便它完美地封装高多边形。而且,在某些情况下(不是全部),它还允许我们改变光线的方向,而不改变你原来的低多边形顶点法线。这可以帮助我们获得最佳烘焙极限并避免倾斜,但请记住,尽管您没有使用顶点法线的法线方向进行烘焙,但最终您将使用法线贴图来修改实际的低多边形法线,所以结果可能看起来很奇怪。



Edge Seams
边缘接缝

As we have seen, if you have a model with hard edges (some faces have more than 1 smoothing group, or some edges are set to "hard"), the baking program will split the normal of the vertices between 2 faces. This has good and bad effects.
正如我们所看到的,如果您有一个具有硬边的模型(某些面具有多个平滑组,或者某些边设置为“硬”),则烘焙程序将在 2 个面之间拆分顶点的法线。这有好有坏的影响。

The good effect is that the normals are not averaged, so there are less normal map distortions: the vertex normals are completely perpendicular to the surface of the low-poly. It can also help make your low-poly look better if it has faces on extreme angles, more appropriate for hard edges.
良好的效果是法线不平均,因此法线映射变形较少:顶点法线完全垂直于低聚体的表面。如果低多边形的面处于极端角度,则它还有助于使您的低多边形看起来更好,更适合硬边。

The bad effect is that there is now a gap between the normals, and this could mean that you lose information if your low-poly has a gap in the normals where it can't get high-poly details. Furthermore, some parts of your low-poly projection could be intersecting and will compete for the same UV space. Both effects leave a seam along the edge, that's more or less noticeable depending on your engine.
不好的效果是,现在法线之间存在间隙,这可能意味着如果您的低多边形在法线中存在间隙,则可能无法获得高多边形细节,则可能意味着您将丢失信息。此外,低多边形投影的某些部分可能相交,并将争夺相同的 UV 空间。这两种效果都会在边缘留下接缝,这取决于您的发动机,这或多或少是显而易见的。




This, however, can be easily avoided using a simple trick: if you have two faces separated by a hard edge, put each face on a different UV island, with some space between them.
然而,使用一个简单的技巧可以很容易地避免这种情况:如果你有两个面被硬边隔开,把每个面放在不同的紫外线岛上,它们之间有一些空间。

If both faces are connected in the UVs, there are drastic changes in color from one face to the other, and color can bleed (because of the processes that occur when rendering faces) which is extremely noticeable in the normal map. By separating the faces in the UVs, the baker can add padding between your faces and avoid this color bleeding. The video below might help you understand this process:
如果两张脸在UV中连接,则从一张脸到另一张脸的颜色会发生剧烈变化,并且颜色可能会出血(由于渲染人脸时发生的过程),这在法线贴图中非常明显。通过分离UV中的面孔,面包师可以在您的面孔之间添加填充物,并避免这种颜色出血。下面的视频可能会帮助您了解此过程:




In conclusion:
结论:

Once I have my low-poly model ready and adjusted to the high-poly model as close as possible, I start working on the smoothing before UVs.
一旦我准备好了我的低多边形模型并尽可能接近地调整到高多边形模型,我就开始在UV之前进行平滑处理。

I set my smoothing for the low-poly (if it's organic, I start with a completely smooth model; if it's hard-surface I start with an angle smooth set to 30-60o; and tweak the model smoothing until it looks good).
我将平滑设置为低多边形(如果它是有机的,我从完全平滑的模型开始;如果它是硬表面,我从角度平滑设置为30-60o开始;并调整模型平滑,直到它看起来不错)。

Once I have the smoothing for the model set, I work on the UVs, making sure that all hard edges are split into separate UV islands (to avoid edge seams).
一旦我完成了模型集的平滑处理,我就在UV上工作,确保所有硬边都分成单独的UV岛(以避免边缘接缝)。

If I have skewing errors, I add additional edges (usually bevels, to keep a more rounded silhouette). This works for most of my models, but I could also fix the skewing errors in Marmoset Toolbag if I used it for baking, or by using custom/weighted normals.
如果我有歪斜错误,我会添加额外的边缘(通常是斜面,以保持更圆润的轮廓)。这适用于我的大多数模型,但是如果我将其用于烘焙或使用自定义/加权法线,我也可以修复Marmoset工具袋中的偏斜错误。

If there are projection errors, I modify the baking distance/cage, modify the low-poly/high-poly so that they are better fit for baking, or erase the normal maps on certain, really hard parts such as the tip of a cone.
如果存在投影错误,我会修改烘焙距离/笼子,修改低聚/高聚,以便它们更适合烘焙,或者擦除某些非常坚硬的部分(如锥体尖端)上的法线贴图。

In the next part, I'll be making a troubleshooting guide for normal map baking and discuss some of the most common problems and solutions. If you are enjoying this tutorial so far, please comment here or below the posts on ArtStation (Part 1 & Part 2) - I'm looking forward to some feedback, even if it's negative. I'm doing this so that I could learn and improve, but a complete silence can be discouraging. Thank you for your time!
在下一部分中,我将为法线图烘焙制作故障排除指南,并讨论一些最常见的问题和解决方案。如果您到目前为止喜欢本教程,请在此处或ArtStation(第1部分和第2部分)上的帖子下方发表评论 - 我期待着一些反馈,即使它是负面的。我这样做是为了让我可以学习和提高,但完全沉默可能会令人沮丧。感谢您抽出宝贵时间接受采访!

有时候,坚持了你最不想干的事情之后,会得到你最想要的东西。
使用道具 <
bzoom  发表于 2022-8-6 11:11:31  
2#
不错,学到了 ,好东西
回复 收起回复
使用道具
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表