|
“Portal Rendering”主题,27页
文章里关于“基于入口渲染引擎”的定义如下:
RENDER-PORTAL-ENGINE (Sector, ViewFrustum)
1 for each polygon P1 in Sector
2 if (P1 is a portal and INSIDE-FRUSTUM (ViewFrustum, P1))
3 NewFrustum = CLIP-FRUSTUM (ViewFrustum, P1)
4 NewSector = get the sector that is connected with the current sector through portal P1
5 RENDER-PORTAL-ENGINE (NewSector, NewFrustum)
6 else if (P1 has not been drawn yet)
7 draw P1
8 return
我觉得,就算是Viewer所在Sector里的多边形不是也要经过截头体(ViewFrustum)的筛选吗?为什么原定义里的 if 语句会这样写?
if (P1 is a portal and INSIDE-FRUSTUM (ViewFrustum, P1)) {...}
else if (P1 has not been drawn yet) {...}
这样一来,本地Sector里的多边形不是要全部都渲染一遍?岂不造成巨大的计算资源浪费?
我觉得应该改成下面的定义:
RENDER-PORTAL-ENGINE (Sector, ViewFrustum)
1 for each polygon P1 in Sector
2 if (INSIDE-FRUSTUM (ViewFrustum, P1))
3 if (P1 is a portal)
4 NewFrustum = CLIP-FRUSTUM (ViewFrustum, P1)
5 NewSector = get the sector that is connected with the current sector through portal P1
6 RENDER-PORTAL-ENGINE (NewSector, NewFrustum)
7 else if (P1 has not been drawn yet)
8 draw P1
9 return
不知道是否正确,希望高手指教。
(推荐"Binary Space Partioning Trees and Polygon"是篇很好的文章,值得仔细看看!地址在另外的帖子里有,但一时想不起是哪帖了) |
|