Shadow Ray Biasing 阴影光线偏向
The shadow ray biasing switch can be found in Redshift's "System" tab.
阴影射线偏置开关可以在红移的“系统”标签中找到。
Introduction
引言
When a renderer computes shading, it uses the mesh's vertex normals. This way, if the mesh has smooth normal, the renderer can generate smooth lighting even if the mesh is of a low-tessellation. However, this can create the unfortunate situation where a vertex normal might be able to 'see' the light which the polygon might not!
当渲染器计算阴影时,它使用网格的顶点法线。这样,如果网格有光滑的正常,渲染器可以产生光滑的照明,即使网格是一个低镶嵌。然而,这可能会造成这样一种不幸的情况,即顶点法线可能能够“看到”多边形可能看不到的光!
To understand this, let's look at a picture of a box and a light. The box has smooth normal. The green arrows represent the box's vertex normals while the red arrows represent its polygon normals. The box's right polygon cannot 'see' the light because the light is behind that polygon's normal. But the top right vertex can see the light (dashed line) because the light if in front of the vertex normal.
为了理解这一点,让我们看看一个盒子和一盏灯的图片。这个盒子有光滑的正常。绿色箭头表示盒子的顶点法线,红色箭头表示盒子的多边形法线。盒子的正多边形不能“看到”光,因为光线在正多边形的后面。但是右顶点可以看到光线(虚线) ,因为光线如果在顶点法线的前面。
When vertex normals 'disagree' with polygon normals about which lights they can see, the polygon shadows itself! The problem appears mostly on low-poly meshes, like the sphere shown below.
当顶点法线与多边形法线不一致时,多边形就会自行投影!这个问题主要出现在低多边形网格上,如下图所示的球体。
When shadow ray biasing is disabled, polygonal artifacts can appear near the lighting silhouettes
当禁用阴影射线偏置时,在光线剪影附近会出现多边形伪影
Shadow ray biasing is a trick Redshift does in order to avoid self-shadowing artifacts, as shown below
阴影射线偏置是一个技巧红移,以避免自我阴影的人工制品,如下所示
Redshift performs shadow ray biasing by default in order to avoid such artifacts
红移默认执行阴影光线偏置,以避免这样的人工制品
Different renderers use different techniques to avoid this issue. Some renderers require the user to add a kind of "epsilon" on meshes. Redshift attempts to solve this issue automatically by looking at how big the polygon is and also how bent the vertex normals are with respect to the polygon normals. Based on these two factors, it decided how much to 'push' the shadow ray away from the polygon so that the polygon doesn't shadow itself!
不同的渲染器使用不同的技术来避免这个问题。一些渲染器要求用户在网格上添加一种“ epsilon”。红移试图通过观察多边形的大小以及顶点法线相对于多边形法线的弯曲程度来自动解决这个问题。基于这两个因素,它决定了多少’推’的阴影光线远离多边形,使多边形不阴影本身!
Problems
问题
Even though shadow ray biasing can get rid of most self-shadowing issues, it can introduce other types of artifacts in certain situations. For example, if the geometry extremely low-poly and has very 'bent' vertex normal with regards to the polygons, the rays might be pushed out too much and introduce the opposite problem of self-shadowing: light leaking!
One of the worst-case scenarios for light leaking can be seen on a cube with smooth normals, as shown below. As it can be seen, all sorts of light leaking artifacts appear on the cube, including missed shadows.
The problem here is that we are trying to achieve smooth shading on a surface that is not smooth at all! As a result, the shadow rays are pushed away from the cube too much and 'skip' the shadow-casting top mesh.
Hard edges (normals), of course don't have this problem, as shown below. That's because the polygon normal and the vertex normal are now the same.
尽管阴影射线偏置可以消除大多数自阴影问题,但在某些情况下它可以引入其他类型的人工制品。例如,如果几何图形非常低的多边形并且相对于多边形有非常“弯曲”的顶点法线,射线可能会被推出太多,从而引入自遮蔽的相反问题: 光泄漏!在法线平滑的立方体上,可以看到光线泄漏的最坏情况之一,如下所示。正如我们看到的,立方体上出现了各种漏光的人工制品,包括漏光的阴影。这里的问题是,我们正在努力实现平滑的阴影表面是不平滑的!因此,阴影射线被推离立方体太多,“跳过”投影顶部网格。硬边(法线) ,当然没有这个问题,如下所示。这是因为多边形法线和顶点法线现在是相同的。
Solutions
解决方案
So what can we do to fix the above light leaking issue? There are a couple of options.
那么,我们能做些什么来解决上面提到的光线泄漏的问题呢。
Disable Shadow Ray Biasing
禁用阴影光线偏置
If your scene is already tessellated enough you might not have any self-shadowing artifacts – or they might only be in places that are not seen by the camera. In this case, the quickest way is to globally disable shadow ray biasing.
如果你的场景已经有足够的镶嵌,你可能没有任何自我阴影的人工制品-或者他们可能只是在那些没有被摄像机看到的地方。在这种情况下,最快的方法是全局禁用阴影射线偏置。
Increase tessellation / Modify topology
增加分割/修改拓扑
As mentioned above, Redshift determines how much to bias the shadow rays depending on the size of the polygons. So one possible solution is to apply a bit of tessellation to the problematic polygons. Smaller polygons will cause less shadow biasing and, therefore, fewer light leaking artifacts.
Also, if the problems appear mostly near bevels, you can try adding extra edges near the bevels as shown below.
The first pair of images show a beveled cube. The mesh is still low-poly and all the edges are smooth. Notice the missing shadows and other artifacts on the cube's left polygon.
By adding an extra edge near the top bevel, the light leaking issues go away:
正如上面提到的,红移决定了多少偏见的阴影射线取决于多边形的大小。所以一个可能的解决方案是对有问题的多边形进行一些镶嵌。更小的多边形将导致较少的阴影偏移,因此,更少的光泄漏文物。此外,如果问题出现大部分靠近斜面,你可以尝试添加额外的边缘靠近斜面如下所示。第一对图像显示了一个斜面立方体。网格仍然是低多边形和所有的边缘是光滑的。请注意立方体左边多边形上缺少阴影和其他工件。通过在顶部斜面附近增加一个额外的边缘,光线泄漏问题就消失了:
赶快留个言打破零评论!~