本文翻译一下《Mathematics for 3D games programming and computer graphics》第3版第8章“可见性判断”中的门系统(Portal Systems)这一节的一部分。
在清华大学出版社出版的詹海生译的中文版中,缺少了对此章节关键一段的翻译。可能是作者疏忽,可能是别的什么,不过下面这个中文版的图我就不能忍了。
看看两者有什么关键区别:
我就怀疑译者没弄懂这个门系统的原理,这不是误人子弟吗?虽然我也一知半解,但是我不会搞个山寨版图片放进去。哎以后还是看原版书好了。
好了下面开始翻译。
Portal Systems 门系统
A portal system is an extremely powerful technique that can be used to quickly eliminate massive regions of world geometry from the visible set. The general idea is surprisingly simple—the world is divided into many disjoint zones that are connected by portals . A portal is represented by a convex polygon through which one region can be seen from another. The advantage of a portal system is that any region of space that cannot be seen through a series of portals is never even considered for rendering. When determining what parts of a world are visible, using a portal system allows us to touch only a small fraction of the entire data set because any geometry that lies on the opposite side of an invisible portal is ignored.
门系统是一个极其强大的技术that可以用于快速地从可见集中排除大块的世界几何体。其基本思想意外地简单——将世界分隔为许多独立的区域(zone),它们通过门(portal)连接起来。一个portal由一个凸多边形表示,可以在一个zone里穿过它看到另一个zone的区域。门系统的优点是,不能通过门看到的区域,不会被渲染。当决定世界的哪一部分可见时,门系统保证了我们只需接触整个数据的一小部分,因为任何不可见的门后面的集合体都被忽略了。
Figure 8.13 illustrates how visibility determination is carried out for a portal system. We first locate the zone in which the camera resides—this zone is always considered visible. We then examine each of the portals leading out of the zone containing the camera. For each portal that intersects the view frustum, we consider the zone to which it connects visible. Each portal leading out of the connecting zone, excluding any leading back to the first zone, is then tested for visibility, but this time against a view frustum that has been reduced in size by the boundary of the portal through which we are looking. This technique is applied recursively until no new portals are visible.
(注:这是清华出版社翻译本里缺失的那一段。)
Figure 8.13展示了可见性判断在门系统中是如何实施的。我们首先找到摄像机所在的zone——这个zone总是被认为是可见的。然后,从这个包含摄像机的zone开始,我们检查每个可以从此处离开的门。对每个与视见体(View Frustum)相交的门,我们认为它连接到(注:开向,指向)的zone为可见的。然后,从这些zone开始,对于每个可以从这些zone离开的门(返回到第一个zone的除外),我们检查其可见性,但这次,所使用的视见体的大小已经被刚刚穿过的门减小了。这个过程递归下去,直到没有新的门可见。
The zones connected by portals may be further organized into tree structures, and the objects residing in these regions may still have bounding volumes. The visibility of large regions determined by the portal system is a large-scale culling process that should be supplemented by smaller-scale visibility determination in each zone.
被门连接的zone可以被进一步组织成树结构,这些区域中的对象可能仍旧保持着包围盒。门系统的大区域可见性判断是个大规模的剔除过程,在每个zone内部应当配合使用小规模的可见性判断算法。
Portal Clipping 门裁剪
Whenever the camera looks through a portal connecting to another zone, we know that the volume of visibility in that zone is smaller than the whole view frustum. Thus, we can reject a larger number of objects during smaller-scale visibility testing by using a smaller view frustum. The near and far planes remain the same, but the side planes of the new view frustum are replaced by a set of planes that represents the intersection of the original view frustum and the sides of any polygonal portals through which we are looking.
当摄像机穿过门看向下一个zone时,我们知道,那个zone的可见区域比视见体要小。因此,我们可以丢弃大量的对象during小规模可见性判断by使用更小的视见体。视见体的near和far平面保持不变,但侧面改变了,变成了原始视见体与门的凸多边形相交的面。
(注:后面的我就不翻译了。)
As a convention, the plane containing a portal must have a normal direction that points toward the camera, and the vertices of the portal must be wound counterclockwise, as shown in Figure 8.14. Consequently, portals are one-way in the sense that if a portal leads from zone X to zone Y , then the same portal does not lead backward from zone Y to zone X . When the camera lies on the negative side of a plane containing a portal, that portal is never considered visible. Two-way visibility between two zones requires that each zone have a portal leading to the other.
Whenever we consider a portal leading out of a zone, we are interested only in the visible area of that portal. The visible area of a portal is equal to the area that intersects the current view frustum, which may be the original view frustum or a reduced view frustum. To determine what area of a portal is visible, we clip its polygon against the planes bounding the current view frustum. Clipping a polygon against a plane removes the portion of the polygon lying on the negative side of the plane, resulting in a new polygon whose interior lies completely on the positive side of the plane. Clipping a polygon against every plane of the current view frustum effectively chops off any part lying outside the volume of space that is visible to the camera.
原文地址:https://www.cnblogs.com/bitzhuwei/p/visibility-determination-portal-system.html